Hi,
Our need is to modify job limits in some cases (like adding “128gb” limit if memory peaks for a task is upper than 60gb by example).
With the rest api, there is no problem to do that:
# Scan all task for the job and get max memory limit, if upper than some value, assign new limit
import Deadline.DeadlineConnect as Connect
cnn = Connect.DeadlineCon(ip, port)
job_id = "5ea9c6fa0550ce3024028c20"
job = cnn.Jobs.GetJob(job_id)
jtasks = cnn.Tasks.GetJobTasks(job_id)
peaks = [x["RamPeak"] for x in jtasks["Tasks"]]
gb_ram_peak = max(peaks) * 1e-9
limits = job["Props"]["Limits"]
for x in ["128gb", "192gb", "256gb"]:
while x in limits:
limits.remove(x)
if gb_ram_peak < 50:
pass
elif gb_ram_peak < 110:
limits.append("128gb")
elif gb_ram_peak < 160:
limits.append("192gb")
else:
limits.append("256gb")
job["Props"]["Limits"] = limits
cnn.Jobs.SaveJob(job)
So, i started an event plugin to check that for each task completed:
from Deadline.Events import DeadlineEventListener
def GetDeadlineEventListener():
return AutoLimitMemoryEvent()
def CleanupDeadlineEventListener(deadlinePlugin):
pass
class AutoLimitMemoryEvent(DeadlineEventListener):
def __init__(self):
self.OnJobFinishedCallback += self.OnJobFinished
def OnJobFinished(self, job):
print(">>> ", job.JobId)
For now, everything work as expected.
The problem comes here:
In the method “onJobFinished”, it seems we can only use the low level deadline api and i can’t find classes or method to get a similar result as with the rest api.
(https://docs.thinkboxsoftware.com/products/deadline/10.0/2_Scripting%20Reference/index.html)
I tried using the job object, the WebServiceUtils, and some others but no results.
How can I do that?
Thanks for your answers.
Arnaud.