AWS Thinkbox Discussion Forums

cant use deadline python api

Im having trouble connecting for some reason:

import Deadline

a = Jobs.Jobs(r'deadline.scanlinevfxla.com')
b = a.GetJobs()

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
C:\python26_64\<ipython-input-18-2033faeb787c> in <module>()
----> 1 b = a.GetJobs()

\\inferno2.scanlinevfxla.com\deadline\repository6\api\python\Deadline\Jobs.py in GetJobs(self, ids)
     43         if ids != None:
     44             script = script +"?JobID=" + ArrayToCommaSeperatedString(ids)
---> 45         return self.__get__(script)
     46
     47     def GetJob(self, id):

\\inferno2.scanlinevfxla.com\deadline\repository6\api\python\Deadline\Jobs.py in __get__(self, commandString)
     14     def __get__(self, commandString):
     15
---> 16         return DeadlineSend.send(self.address,commandString, "GET")
     17
     18     def __put__(self, commandString, body):

\\inferno2.scanlinevfxla.com\deadline\repository6\api\python\Deadline\DeadlineSend.py in send(address, message, requestType)
     10     """
     11     conn = httplib.HTTPConnection(address)
---> 12     conn.request(requestType, message)
     13
     14     response = conn.getresponse()

C:\python26_64\lib\httplib.py in request(self, method, url, body, headers)
    896
    897         try:
--> 898             self._send_request(method, url, body, headers)
    899         except socket.error, v:
    900             # trap 'Broken pipe' if we're allowed to automatically reconnect


C:\python26_64\lib\httplib.py in _send_request(self, method, url, body, headers)
    933         for hdr, value in headers.iteritems():
    934             self.putheader(hdr, value)
--> 935         self.endheaders()
    936
    937         if body:

C:\python26_64\lib\httplib.py in endheaders(self)
    890             raise CannotSendHeader()
    891
--> 892         self._send_output()
    893
    894     def request(self, method, url, body=None, headers={}):

C:\python26_64\lib\httplib.py in _send_output(self)
    762         msg = "\r\n".join(self._buffer)
    763         del self._buffer[:]
--> 764         self.send(msg)
    765
    766     def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):

C:\python26_64\lib\httplib.py in send(self, str)
    721         if self.sock is None:
    722             if self.auto_open:
--> 723                 self.connect()
    724             else:
    725                 raise NotConnected()

C:\python26_64\lib\httplib.py in connect(self)
    702         """Connect to the host and port specified in __init__."""
    703         self.sock = socket.create_connection((self.host,self.port),
--> 704                                              self.timeout)
    705
    706         if self._tunnel_host:

C:\python26_64\lib\socket.pyc in create_connection(address, timeout)
    512                 sock.close()
    513
--> 514     raise error, msg

error: [Errno 10061] No connection could be made because the target machine actively refused it

We dont need to run the webservice for the python api to work, right?

In any case, even with the webservice running, i get the same message.
The 80 and 8080 ports are open

Are you using the same Port for the Web Service as is being used for the Throttling? They need to be different. The web service does need to be running. Also I’m assuming you’re actually running Pulse :slight_smile:

Yeah, surprisingly, it doesnt work even from the pulse machine directly.
The throttling port is 17062, while the webservice is 8080. We had bad experience with the webservice (like, 2 our of 3 connections from the mobile app would crash pulse), so i would rather leave that off for now… its too bad its a requirement for the python api to work.

I might end up going directly to the database, it seems like a faster approach with less overhead, way more risk and guaranteed to break at some point with a future deadline update. Living on the edge.

OK, well here’s an example of how to connect to the web service, assuming a the host is local and the port the web service is listening on is 6428:

import Deadline.DeadlineConnect as Connect

connection = Connect.DeadlineCon(‘localhost’, 6428)

a = connection.Jobs
b = a.GetJobs()

This will work provided that you provide the correct hostname and port number, that the web service is listening, and Pulse is running.

How about gathering info with deadlinecommand.exe using subprocess.call() ?

Yeah that’s also an option. The python api leaves the connection open, so i’m hoping it would be faster. The process we might have to apply would need to run every couple of seconds, so we are going for the fastest possible solution.

I have not yet tried Ryan’s suggestion of explicitly defining the port to be used (i was only trying with the defaults).

If you’re using the API, I strongly suggest you make your requests through the DeadlineCon object. If you do so, providing the port number is required. The API was not meant to allow connection through the attribute objects like Jobs and Groups. The DeadlineCon object will build the address for you given the port and the host.

import Deadline.DeadlineConnect as Connect

Traceback (most recent call last): File "<pyshell#19>", line 1, in <module> import Deadline.DeadlineConnect as Connect ImportError: No module named DeadlineConnect

That will be fixed for Beta 9.

Privacy | Site terms | Cookie preferences