Hi!
Is it possible to change a running job’s priorities via REST api? Or the deadlinecommand utility? Or any other way than using the deadline monitor?
Cheers,
SebastianH
Hi!
Is it possible to change a running job’s priorities via REST api? Or the deadlinecommand utility? Or any other way than using the deadline monitor?
Cheers,
SebastianH
Here’s the mile-high view. I can go into detail on anything here.
For the RESTful API, you need to pull the job out, modify it, then put it back in:
thinkboxsoftware.com/deadlin … s/#Get_Job
thinkboxsoftware.com/deadlin … /#Save_Job
Code examples on how to interact with the REST API in different languages are here:
github.com/ThinkboxSoftware/Dea … REST%20API
The fancy Python way (probably easier than rolling your own):
thinkboxsoftware.com/deadlin … pythonapi/ (example on that page for job properties)
For the command line way: (WAY WAY EASIER!)
deadlinecommand setjobsetting 53ed30b6f4b70d991c6a3be0 priority 99
I should also mention that the Python/REST API is going to be much more performant if you’re going to be setting priorities for many jobs.
The startup time for DeadlineCommand is going to be much faster in 7.0, but right now it takes a few seconds for DC to get ready to complete requests.
Oh, so you can update stuff just by saving an existing job? Cool, I didn’t realize that. Thanks!
Since I’m doing this from a python script, I don’t really want to start an external program… So REST or Python API suits me better (although the Python API connector didn’t connect for some reason, so I went with the REST API for now).
Cheers,
SebastianH
Hm, now I do need more details…
The docs say that GetJob’s response is a “JSON object containing all the job information for the job ID provided.”…
Was this changed in 6.2? Cause in 6.1 I just get a newline seperated string with lots of ‘A=B’… Such as
'AuxiliarySubmissionFileNames=scene_v010.ma\r\nBadSlaves=\r\nChunkSize=1\r\nComment=slapcomp test\r\nCommentTag=sebastian, 2014/09/26 10:01\r\n...
Which I can convert into a python modifiable thing (like a dict) in many diverse and interesting ways. But I have not found any way to make a json object that Deadline will accept with SaveJob. I get either
or
Bit lost at this point…
It should have always been JSON (or XML for the non-REST API). Can you give me the URL you’re using? I’ll test over here.
I’m told in the beta we used to do that. Can you check what version Pulse is running. Should be in the ‘Pulse’ panel in the Monitor when you created it from the ‘view’ menu.
You can try grabbing the 6.1 installer and upgrading Pulse. Ryan G’s checking on what the Standalone Python API is doing. The newer one returns a dictionary from what I’m told.
I’m attaching the 6.2 Python API if you want to give that a whirl too. Just to throw every possible scenario at you
DeadlinePythonAPI.zip (15.6 KB)
Hey, thanks for all the suggestions!
We’re running Pulse Version “v6.1.0.54665 R”. The URL I’m using is
http://192.168.94.1:8889/GetJob?JobId=54252b5f479cfa0bc85473d6
.
Here’s a small example script demonstrating the issue:
[code]import httplib2
http = httplib2.Http()
http.add_credentials(‘scriptaccessuser’, ‘oursupersecurepasswd’)
response, content = http.request(‘http://192.168.94.1:8889/GetJob?JobId=54252b5f479cfa0bc85473d6’)
[/code]
And then I get:
response:
{'content-length': '6850',
'content-location': 'http://192.168.94.1:8889/GetJob?JobId=54252b5f479cfa0bc85473d6',
'date': 'Wed, 01 Oct 2014 15:03:43 GMT',
'server': 'Microsoft-HTTPAPI/2.0',
'status': '200'}
and content:
AuxiliarySubmissionFileNames=scene_name_v010.ma\r\nBadSlaves=\r\nChunkSize=1\r\nComment=priority test\r\nCommentTag=sebastian, 2014/09/26 10:01\r\nCompletedChunks=0\r\n....
Note that if I just fetch the url with firefox or chrome, I get the same plain text content back. Doesn’t look like a JSON encoded data structure to me…
I can try the 6.2 API, does it work with 6.1 Pulse?
The url you should use is
http://192.168.94.1:8889/api/jobs?JobId=54252b5f479cfa0bc85473d6
The python api can do all of this for you though. Try grabbing and extracting the attached python api and dropping it in your python site-packages folder. If you use the attached python api you can accomplish what you are trying to do this way:
from Deadline.DeadlineConnect import DeadlineCon
http = DeadlineCon('192.168.94.1', 8889)
http.SetAuthenticationCredentials(superusername, superuserpassword)
job = http.Jobs.GetJob('54252b5f479cfa0bc85473d6')
print job
This will automatically convert the json object returned by the web service to a python dictionary containing your job’s information.
Hope this helps!
Ryan G.
Deadline.zip (44.1 KB)
Oooo, nice! It works
With the 6.1 python API, it wouldn’t connect, is it because it couldn’t authenticate? (There’s no methods for it in the deadline api in our 6.1 repository…)
And now I’m just being picky, but, the names of the properties coming back are all short names,
job['Props']['Pri']
for example is the job priority, any chance to get them back in a more readable way?
Cheers&thanks,
SebastianH
Probably. This was missing from the Deadline 6 python api. Authentication is present in the Deadline 7 python api that I posted with my last comment. The Deadline 7 python api is compatible with Deadline 6.1.
Unfortunately not, these are shortened to save space in the database.
Ryan G.