Pulse Web Service
Overview
Pulse has a web service feature built in, which you can use to get information directly from Pulse over an Internet connection. You can view this information with Deadline Mobile, or you can write custom Web Service Scripts to display this information in a manner of your choice, such as in a web page. Before you use the web service, you need to configure the Web Service settings in the Repository Options.
Connecting to the Web Service
When Pulse is running, you can connect to the web service using a URL containing the host name or IP address of the machine that is hosting Pulse, as well as the port, which we will assume to be 8080 for now (this can be configured in the Web Service Settings). Note that if port 8080 is being blocked by a firewall, Pulse will not be able to accept web requests. An example URL will look like the following:
http://[myhost]:8080/[command][arguments]
Where:
- myhost is your Pulse server's IP address or host name.
- command is the command you want to execute. Pulse can support two different types of commands, which are explained below.
- arguments represents the arguments being passed to the command. This can be optional, and depends on the command.
To confirm that you can at least connect to Pulse's web service, try the following URL.
http://[myhost]:8080/
You should see the following if you connect to Pulse successfully:
Error - Not a supported command.
If Pulse is running on Windows, you may also need to add a namespace reservation for the current user that Pulse is running under, so that it can reserve namespaces for the URL connection. See the Configuring Namespace Reservations section in this MSDN Article for more information.
Note that Pulse listens on http://*:8080/, so make sure this is the URL you use when reserving the namespace. For example:
netsh http add urlacl url=http://*:8080/ user=USERNAME
Calling Deadline Command
The first set of commands are the same commands that you can use with the Deadline Command application. However, these commands are disabled by default. To enable them, you need to enable the Allow Non-Script Commands setting in the Web Service settings. If left disabled, you will see the following results when trying to call one of these commands:
Error - Non-Script commands are disabled.
See the Deadline Command documentation for a list of available commands. Note that these commands are executed in a similar fashion as if they were called using Deadline Command, which means that they don't use any of the data that is currently cached by Pulse. Because of this, there may be a delay when executing these commands.
Here is an example of how you would use the web service to call the GetSlaveNames command:
http://[myhost]:8080/GetSlaveNames
Here is an example of the results that would be displayed:
Jupiter Rnd-vista Slave-29 Monkeypantswin7 Electron.franticfilms.com Test3 Monkeypants Slave-27d Proton.franticfilms.com Atom.franticfilms.com Rnd-suse Opensuse-64 Pathos Neutron.franticfilms.com
Some commands can take arguments. To include arguments, you need to place a ? between the command name and the first argument, and then a & between additional arguments. Here is an example of how you would use the web service to call the GetSlaveNamesInPool command, and pass it two pools as arguments:
http://[myhost]:8080/GetSlaveNamesInPool?show_a&show_b
Here is an example of the results that would be displayed:
Monkeypants Pathos
Calling Python Scripts
The second set of commands are actually Python scripts that you can create in the Repository. These scripts use Pulse's Python API to get data, and then return the data in a readable manner. So basically, you can create scripts to access any type of data and display it in any way you want. See the Web Service Scripting documentation for more information on how to create these scripts.
Once a script has been created, you can call it by using the name of the script, without the .py extension. For example, if you have a Pulse script called GetFarmStatistics.py, you would call it using:
http://[myhost]:8080/GetFarmStatistics
Some scripts can take arguments. To include arguments, you need to place a ? between the command name and the first argument, and then a & between additional arguments. Here is an example of how you would pass arg1, arg2, and arg3 as separate arguments to the GetFarmStatistics.py script:
http://[myhost]:8080/GetFarmStatistics?arg1&arg2&arg3
The way the results are displayed depends on the format in which they are returned. Again, see the Pulse Web Service Scripting documentation for more information.
