Accessing Deadline python API

Hi there:

Hope all are doing well. I would like to write a commandline line submission script in python - to run few linux commands on each render nodes to do a system check. What is the initial setup that I have to do in order to get access to deadline python API on my local pc ?

For example if I have to set a pool - which is the path I can use to get access to deadline_python API ?

def getPoolStr():
sys.path.append(deadline_api)
import deadline_api
from deadline_api import GetPools
pool = [‘nuke’]
pool2 = GetPools()
for p in pool2:
if p == “nuke”: continue
pool.append(p)
poolString = “”
for i in pool:
poolString += " "+i
return poolString

Thanks
/Biju

If you want to use Deadline’s API outside of Deadline (meaning not an event plugin, application plugin or similar) you’ll want to use the standalone python API. There are details on how to set that up on that page.

Hi Justin,

On topic and related note, for the below API snippet, the DeadlineCon method requires the Deadline Repository hostname and that should have the Deadline web service running on port 8082, is that correct?

import Deadline.DeadlineConnect as Connect
connectionObject = Connect.DeadlineCon('deadlineHostName', 8082)

If so, how do I get the Deadline Web Service enabled and working for our Deadline Repository instance, as my hunch is probably that’s not setup and running in our case by choice as a part of initial installation/setup. As the below command did not return anything when run on the Deadline Repository machine:

netstat -a | find "8082"

Please let us know your thoughts or pointers in the correct direction will be helpful.

Thanks,
Bhavik
Fractal Picture

You’ll have to install the web service, and the machine you put the web service on will be the hostname you use. Port 8082 is what’s used if you don’t secure the service with a certificate.

It’s part of the client installer, details here on the web service page. It’s configured with this command run on the web service machine.

Sure thanks @Justin_B this is helpful for us to get things going. We will ping you back should we need more help on this topic.

Thanks,
Bhavik
Fractal Picture

1 Like

Hello @Justin_B I am able to import Deadline without any error

import Deadline

How do I use this library now?

Tried to use DeadlineConnect and I am getting the following error meesage ?

from Deadline.DeadlineConnect import DeadlineCon as Connect
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\ebijram\python_projects\pyver\py3107\lib\site-packages\Deadline\DeadlineConnect.py”, line 6, in
import Jobs
ModuleNotFoundError: No module named ‘Jobs’

Thanks
/Biju

Hello Biju

Did you setup the API : Standalone Python API — Deadline 10.2.1.0 documentation?

Hi @zainali:
I only did this → Copy the “Deadline” Folder containing the Standalone Python API from \your\repository\api\python to the “site-packages” folder of your Python installation and the API is ready to use.

Do I have to do Web Service configuration in Deadline Client Installation also?

Regards
/Biju

Try importing Jobs from Deadline, like:

from Deadline import Jobs

or use Deadline.Jobs in your function call.

Hello @Justin_B

Still getting error message …?

from Deadline import Jobs
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\ebijram\python_projects\pyver\py3107\lib\site-packages\Deadline\Jobs.py”, line 3, in
from ConnectionProperty import ConnectionProperty
ModuleNotFoundError: No module named ‘ConnectionProperty’

Regards
/Biju

Hello Guys:

Any help on this would be much appreciated.

Regards
/Biju

Hello @biju_ramachandran,

From what I know and I am just scratching the surface yet for the Deadline Standalone Python API. And to start testing with it Deadline requires the Web Service to be working. Which needs to be installed.

Forgot to mention, once the web service is installed and configured. You might need to run/start it with the help of the below command. I am running it on a non-repository machine in the network.

"%DEADLINE_PATH%"\deadlinewebservice.exe --console -log-api-calls -allowquickedit -ip 192.168.x.x

For more options for the web service:

"%DEADLINE_PATH%"\deadlinewebservice.exe --help

Once it is up and running, hopefully, the below snippet should help you to get started:

from pprint import pprint

from Deadline.DeadlineConnect import DeadlineCon as Connect
dlwebsrv = 'deadline_webservice_hostname'
dlwebport = 4434
dlweb_cacert = 'C:\Program Files\Thinkbox\Deadline10\webservice_certs\ca.crt'
con = Connect(dlwebsrv, dlwebport, True, dlweb_cacert, False)
con.SetAuthenticationCredentials("Users", "password", False)
pools = con.Pools.GetPoolNames()
pprint(pools)

Thanks,
Bhavik
Fractal Picture

Thanks Bhavik - but there has to be a better was or at least a good document that states this ?

Regards
/Biju

Hi @biju_ramachandran not sure if I am fully getting that. However, as for the document what is your take on: Standalone Python API — Deadline 10.1.23.6 documentation

Thanks,
Bhavik

Hello Bhavik:

I am getting the following error after installing the web services. It seems the Deadline python Module has python2 code as httplib was replaced by http.client in Python3 …?

import Deadline
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\ebijram\python_projects\pyver\py3107\lib\site-packages\Deadline_init_.py”, line 2, in
from .Jobs import Jobs
File “C:\Users\ebijram\python_projects\pyver\py3107\lib\site-packages\Deadline\Jobs.py”, line 3, in
from ConnectionProperty import ConnectionProperty
File “C:\Users/ebijram/python_projects/pyver/py3107/Lib/site-packages/Deadline\ConnectionProperty.py”, line 6, in
import DeadlineSend
File “C:\Users/ebijram/python_projects/pyver/py3107/Lib/site-packages/Deadline\DeadlineSend.py”, line 2, in
import httplib
ModuleNotFoundError: No module named ‘httplib’
import httplib
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘httplib’
import http.client

Regards
/Biju

Hello @biju_ramachandran

Not sure why I did not run into this error, but yes for this temp test/workspace environment my Python version is 3.8.10 and I have setup the python’s virtual environment for this vscode workspace.

See, if that is something feasible to setup in your case and if that helps.

Thanks,
Bhavik
Fractal Picture

Hello Bhavik:

Thanks for the response. But I think it has to do how I have installed the Deadline module. I have followed the instructions from the document you mentioned earlier - by copying the Deadline module folder to the python version site package and then activating the Web-Services. Maybe its the version of the Deadline module - I am using Deadline Client Version: 10.1.14.5 Release - I believe, this version should have Python 3 code ?

Please let me know if I am missing any steps?

Regards
Biju

Hello @biju_ramachandran

We highly recommend to upgrade your Deadline Version, as starting from version 10.1.23 and later Deadline doesn’t require any licenses. Also, ships with Python3, If possible, please upgrade to the latest version.
If you want to continue with the version 10.1.14.5, Deadline can run python3 code but we didn’t ship python3 with that version, so you won’t be able to use WebServiceAPI instead you should use RESTfulAPI

Hello Nreddy:

We did upgrade the Deadline version to 10.2.1.1 and copied the Deadline folder from this version to the Python3 site-package directory. I am able to now import

from Deadline.DeadlineConnect import DeadlineCon as Connect

con = Connect(dlwebsrv, 8081)
con.Groups.GetGroupNames()

I am getting this error - connection refused. Checked the ports and are listening.

File “C:\Users\ebijram\python_projects\pyver\py391\lib\urllib\request.py”, line 494, in _call_chain
result = func(*args)
File “C:\Users\ebijram\python_projects\pyver\py391\lib\urllib\request.py”, line 1385, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File “C:\Users\ebijram\python_projects\pyver\py391\lib\urllib\request.py”, line 1345, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>

Thanks
/Biju