[Beginner api] Creating Job instance


#1

I see in
http://docs.thinkboxsoftware.com/products/deadline//5.2/User%20Manual/manual/scriptoverview.html
that you can do this to make a job instance

from Deadline.Jobs import * myJob = Job() jobName = myJob.JobName myJob.JobName = "A new name"

How would i go about creating an instance of a job in deadline 9.0.2.0


#2

I see this example but i was wondering if i could just sent up a job object first that is able to use those job properties on that 5.2 doc

[code]import Deadline.DeadlineConnect as Connect

if name == ‘main’:

Deadline = Connect.DeadlineCon('WebServiceName', 8082)

JobInfo = {
    "Name": "Submitted via Python",
    "UserName": "UserName",
    "Frames": "0-1",
    "Plugin": "VraySpawner"
    }

PluginInfo = {
    "Version": "Max2014"
    }

try:
    newJob = Deadline.Jobs.SubmitJob(JobInfo, PluginInfo)
    print newJob
except:
    print "Sorry, Web Service is currently down!"

[/code]


#3

Hi,

yeah its pretty much the same for dl9.0.
here is the version9 docs:
docs.thinkboxsoftware.com/produc … ython.html

If your planning on using the python standalone api, i believe you will still require a pulse node to connect to:
docs.thinkboxsoftware.com/produc … pulse.html

so when you update your code, the name of the pulse node and the port go:

Deadline = Connect.DeadlineCon(<pulse node>, <pulse port>)

The JobInfo and plugininfo can be found on an already submitted job for the type you want to submit.
In the monitor , select a job’s properties, then select submission params. this is all the info needed to submit a job of that type.

Hope this helps.
Cheers
Kym


#4

FYI. The Web Service is now separate to Pulse application:
docs.thinkboxsoftware.com/produc … rvice.html


#5

Hi,

Yeah i already setup deadline and the API. I am correctly trying to create a job on python to send to the machine. So the best way to do it on python is to make a dict with with all the job information and then submit the jobinfo/plugininfo like that example on the docs ?


#6

It is indeed one of many ways you can interact with Deadline via its various entry points. Can you provide more context here on what exactly you are trying to achieve? If it helps, this recent blog post provides a good overview of our entry points: deadline.thinkboxsoftware.com/fe … -code-here


#7

I was seeing if there are other ways i can make a job on the python API. I am currently making a deadline class that builds the jobs before it gets submitted into the farm. What i have is i would gather all the farm job data into a ‘job dictionary’ and from there submit the job to the farm. I was wondering if this was the most optimal way to write this program.


#8

What you are describing is in a nutshell how we work.
We have some default templates for job types and then submit a template with whatever overrides that job requires.


#9

I might not have installed the API correctly. I followed http://docs.thinkboxsoftware.com/products/deadline/9.0/1_User%20Manual/manual/standalone-python.html but when i look inside the folder it doesn’t have the jobs or scripting files.

from Deadline.Scripting import *
from Deadline.Jobs import *

I was wondering if there is something else that i needed to install to get everything to work properly
Thanks


#10

These are from our Scripting API built-in to Deadline environment, which is different from the Standalone Python API “wrapper” around our RESTful http API. Our Scripting API is here:
docs.thinkboxsoftware.com/produc … rview.html
and
docs.thinkboxsoftware.com/produc … Reference/

whilst, our Standalone Python API is here:
docs.thinkboxsoftware.com/produc … tated.html

which is a wrapper around our RESTful API which is here:
docs.thinkboxsoftware.com/produc … /#rest-api

In my Deadline 9.0.2.0 repo, I have this directory, which contains the various *.py files that make up our Standalone Python API:

“<your_repo_path>/api/python/Deadline”

I copied this “Deadline” directory to my local Python install path and place the directory under the “site-packages” directory.

I then configure and startup the Deadline Web Service (on my local machine for testing purposes only), noting the port number as per:
docs.thinkboxsoftware.com/produc … -ref-label

As a quick validation, I then open my browser and type the following:

http://mbp.local:8082/

where “mbp.local” is my computer name and “8082” is the port as configured in Repo Options.

As a further validation test, I type:

http://mbp.local:8082/api/slaves

If all of the above works, I then use the API as per docs here:
docs.thinkboxsoftware.com/produc … ng-the-api


#11

Thanks for all the help! I set up that so far. What I’m asking is when I open up /deadlineRepository/scripts the files in there will import in
From deadline.scripting import *

And I cant seem to find that in the api I installed


#12

No, this will not work. The plugins/scripts stored in the directories under the Deadline repo all (except the ‘api’ directory) require to be executed within the environment of Deadline and it’s built-in “Python Scripting API”, which is NOT the same as our offered “Standalone Python API”. If you wish to use our scripts or Python modules (which technically aren’t modules but rather namespaces anyway) such as:

from Deadline.Scripting import * from Deadline.Jobs import *

then you will need to execute your script/plugin/event, etc from within the context of the Deadline environment via one of our applications or via our command-line tool:

./DeadlineCommand -ExecuteScript "/path/to/script.py"

#13

So right now our render farm is set up with Qube! and I am trying to set up Deadline as a possible replacement. In our farm engine, here are the qube! parameters we use.

qb_job['id'] 
qb_job['name']			job_info["Name"]
qb_job['label']			job_info["Comment"] = "my comment"	
qb_job['priority']		job_info["Priority"] = 80
qb_job['cmdline']		job_info["Plugin"] ="CommandLine"
qb_job['package']
qb_job['cpus']
qb_job['env']			job_info["IncludeEnvironment"] = False 
qb_job['reservations']
qb_job['prototype']		job_info["Plugin"] ="CommandLine"
qb_job['agenda']
qb_job['dependency']		job_info["JobDependencies"]=["5055005","5050505"]
qb_job['requirements']	job_info["RequiredAssets"] = ["5050545","545454"]
qb_job['cluster']			job_info["Region"] = "clusters" 
qb_job['groups']			job_info["Group"] = "group1"
qb_job['hosts']  			job_info["Whitelist"] = ["555555"]	
qb_job['mailaddress']		job_info["NotificationEmails"] ="testmail@mail.com"
qb_job['callbacks']		job_info['OnJobComplete']

Do i acheive the same in deadline? Would this be how I go about changing the Qube! variables(left) to their deadline equivalents(right)


#14

Hey,

I recently finished up on a project to help another customer with the same questions. Do you want to submit a support ticket and we can continue the conversation there so we can provide more direct support if required? support.thinkboxsoftware.com/ or via email: support [@] thinkboxsoftware [dot] com

Cheers,
Mike


#15

sure thing! just submitted it.