Is it possible to create a new deadline job, without running the command line executable?
If we already have a live python sesson, and have all the job info data, is it possible through either the restful api, or some other way? Sometimes we need to publish jobs en-masse and the overhead of initiating a new process really adds up.
The standalone API is a pretty good solution. There’s overhead there and it’s a bit tricky because the web API doesn’t support auxiliary files directly (you have to pass in paths the web service can access).
If you were doing thousands, I’d use deadlinecommand executescript
and pass in another Python script that submits those bulk jobs, but if you’re already in your own interpreter that may be difficult from a code maintenance perspective as opposed to just importing the standalone API.
Right now we are using ‘deadlinecommand’ at the moment, and its the overhead of spawning that additional process and then parsing its output for the job id is what we are hoping to trim off.
We are going to give a try to the direct standalone API submission, see how it goes! Thanks!
Well, a loop inside the DLC is pretty quick. I just submitted 100 jobs in 2 seconds:
PYTHON: Job 99 done sumbitting
PYTHON: Total time:00:00:02
Here’s the script:
# Submit a single job many times
import time
from Deadline.Scripting import RepositoryUtils
def __main__():
start_time = time.time()
for a in range(100):
RepositoryUtils.SubmitJob([
'C:/Users/myuseraccount/Desktop/Mutli-Submit/jobInfo.job',
'C:/Users/myuseraccount/Desktop/Mutli-Submit/pluginInfo.job'])
print("Job {} done sumbitting".format(a))
elapsed_time = time.time() - start_time
print("Total time:" + time.strftime("%H:%M:%S", time.gmtime(elapsed_time)))