[Beginner api] Creating Job instance

Discussion and Support of Deadline, the Render Management System
BlueLegend78
Posts: 12
Joined: Fri May 12, 2017 11:12 am

[Beginner api] Creating Job instance

Postby BlueLegend78 » Mon May 15, 2017 12:21 pm

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

Code: Select all

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

BlueLegend78
Posts: 12
Joined: Fri May 12, 2017 11:12 am

Re: [Beginner api] Creating Job instance

Postby BlueLegend78 » Mon May 15, 2017 1:50 pm

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: Select all

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!"

kwatts
Posts: 51
Joined: Tue Mar 01, 2016 10:34 am

Re: [Beginner api] Creating Job instance

Postby kwatts » Mon May 15, 2017 3:01 pm

Hi,

yeah its pretty much the same for dl9.0.
here is the version9 docs:
http://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:
http://docs.thinkboxsoftware.com/produc ... pulse.html

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

Code: Select all

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

User avatar
MikeOwen
Posts: 3484
Joined: Thu Jul 19, 2007 5:00 am
Location: London, UK
Contact:

Re: [Beginner api] Creating Job instance

Postby MikeOwen » Mon May 15, 2017 3:07 pm

FYI. The Web Service is now separate to Pulse application:
http://docs.thinkboxsoftware.com/produc ... rvice.html
Mike Owen
Solutions Architect
Thinkbox / AWS

BlueLegend78
Posts: 12
Joined: Fri May 12, 2017 11:12 am

Re: [Beginner api] Creating Job instance

Postby BlueLegend78 » Mon May 15, 2017 3:31 pm

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 ?

User avatar
MikeOwen
Posts: 3484
Joined: Thu Jul 19, 2007 5:00 am
Location: London, UK
Contact:

Re: [Beginner api] Creating Job instance

Postby MikeOwen » Mon May 15, 2017 3:36 pm

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: http://deadline.thinkboxsoftware.com/fe ... -code-here
Mike Owen
Solutions Architect
Thinkbox / AWS

BlueLegend78
Posts: 12
Joined: Fri May 12, 2017 11:12 am

Re: [Beginner api] Creating Job instance

Postby BlueLegend78 » Mon May 15, 2017 4:08 pm

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.

kwatts
Posts: 51
Joined: Tue Mar 01, 2016 10:34 am

Re: [Beginner api] Creating Job instance

Postby kwatts » Mon May 15, 2017 4:32 pm

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.

BlueLegend78
Posts: 12
Joined: Fri May 12, 2017 11:12 am

Re: [Beginner api] Creating Job instance

Postby BlueLegend78 » Tue May 16, 2017 11:25 am

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.

Code: Select all

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

User avatar
MikeOwen
Posts: 3484
Joined: Thu Jul 19, 2007 5:00 am
Location: London, UK
Contact:

Re: [Beginner api] Creating Job instance

Postby MikeOwen » Tue May 16, 2017 12:32 pm

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


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:
http://docs.thinkboxsoftware.com/produc ... rview.html
and
http://docs.thinkboxsoftware.com/produc ... Reference/

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

which is a wrapper around our RESTful API which is here:
http://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"

mbp:Deadline owenm$ pwd
/Applications/Thinkbox/DeadlineRepository9/api/python/Deadline
mbp:Deadline owenm$ ll
total 272
-rwxrwxrwx 1 root wheel 4.1K 18 Apr 23:26 Balancer.py
-rwxrwxrwx 1 root wheel 1.5K 18 Apr 23:26 ConnectionProperty.py
-rwxrwxrwx 1 root wheel 3.8K 18 Apr 23:26 DeadlineConnect.py
-rwxrwxrwx 1 root wheel 3.6K 18 Apr 23:26 DeadlineSend.py
-rwxrwxrwx 1 root wheel 254B 18 Apr 23:26 DeadlineUtility.py
-rwxrwxrwx 1 root wheel 3.0K 18 Apr 23:26 Groups.py
-rwxrwxrwx 1 root wheel 4.1K 18 Apr 23:26 JobReports.py
-rwxrwxrwx 1 root wheel 544B 18 Apr 23:26 JobTaskLimit.py
-rwxrwxrwx 1 root wheel 16K 18 Apr 23:26 Jobs.py
-rwxrwxrwx 1 root wheel 4.0K 18 Apr 23:26 Limits.py
-rwxrwxrwx 1 root wheel 1.8K 18 Apr 23:26 MappedPaths.py
-rwxrwxrwx 1 root wheel 568B 18 Apr 23:26 MaximumPriority.py
-rwxrwxrwx 1 root wheel 760B 18 Apr 23:26 Plugins.py
-rwxrwxrwx 1 root wheel 2.9K 18 Apr 23:26 Pools.py
-rwxrwxrwx 1 root wheel 4.8K 18 Apr 23:26 ProxyServer.py
-rwxrwxrwx 1 root wheel 3.9K 18 Apr 23:26 Pulse.py
-rwxrwxrwx 1 root wheel 6.0K 18 Apr 23:26 Repository.py
-rwxrwxrwx 1 root wheel 8.6K 18 Apr 23:26 Slaves.py
-rwxrwxrwx 1 root wheel 881B 18 Apr 23:26 SlavesRenderingJob.py
-rwxrwxrwx 1 root wheel 3.5K 18 Apr 23:26 TaskReports.py
-rwxrwxrwx 1 root wheel 8.9K 18 Apr 23:26 Tasks.py
-rwxrwxrwx 1 root wheel 5.4K 18 Apr 23:26 Users.py
-rwxrwxrwx 1 root wheel 0B 18 Apr 23:26 __init__.py
mbp:Deadline owenm$


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:
http://docs.thinkboxsoftware.com/produc ... -ref-label

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

Code: Select all

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:

Code: Select all

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


If all of the above works, I then use the API as per docs here:
http://docs.thinkboxsoftware.com/produc ... ng-the-api
Mike Owen
Solutions Architect
Thinkbox / AWS


Return to “Thinkbox Software - Deadline”

Who is online

Users browsing this forum: No registered users and 1 guest