AWS Thinkbox Discussion Forums

Deadline 10.23 GetJobIds()

hello,
I’ve recently upgraded from Deadline 10.05 to 10.23.
after the upgrade I can’t use the GetJobIds() command. it returns None.
is there a new way to get the Job ID?

Hmm. Works pour moi:

from Deadline.Scripting import RepositoryUtils

def __main__():
    print("Test")
    for job_id in RepositoryUtils.GetJobIds():
        print("Job: {}".format(job_id))

Output:

C:\Program Files\Thinkbox\Deadline10\bin>deadlinecommand --version
v10.0.23.4 Release (e0d42871d)
C:\Program Files\Thinkbox\Deadline10\bin>deadlinecommand executescript c:\users\me\Downloads\getjobs.py
Qt: Untested Windows version 10.0 detected!
Test
Job: 5c1770739d904c0311f02e75
Job: 5c17723ec6c1e50008d26eda
Job: 5c23069a64249a3d241aff39
Job: 5c33d36bc3ca4f365cda8afc
Job: 5c4216dcc3ca4f03b00bbe9b

actually my issue with with getting the jobID of the job that is currently rendering on my machine.
getting the jobID from the running slave.

thanks for your reply.
i will try to answer your questions in the order that you have sent them:

  1. we are using the standalone Python API

  2. i’m calling the GetJobIds() from the jobs.py

  3. here is a code snippet:

        from Deadline.Scripting import *
        currentJob= self.GetJob().JobId
    

5.there is no error message. the result is None instead of the actual jobID
6.the deadline web service is runing.

i will add a longer snippet from the code since it seems more complicated then i=I’ve initially thought .

from System.IO import *

from System.Text.RegularExpressions import *

from Deadline.Plugins import *
from Deadline.Scripting import *

import os
import sys
import re

def GetDeadlinePlugin():
    return PythonPlugin()

def CleanupDeadlinePlugin( deadlinePlugin ):
    deadlinePlugin.Cleanup()

class PythonPlugin (DeadlinePlugin):
    
    def __init__( self ):
        self.InitializeProcessCallback += self.InitializeProcess
        self.RenderExecutableCallback += self.RenderExecutable
        self.RenderArgumentCallback += self.RenderArgument
    
    def Cleanup(self):
        for stdoutHandler in self.StdoutHandlers:
            del stdoutHandler.HandleCallback
        
        del self.InitializeProcessCallback
        del self.RenderExecutableCallback
        del self.RenderArgumentCallback
    
    def InitializeProcess(self):
        self.PluginType = PluginType.Simple
        self.SingleFramesOnly = True
        self.StdoutHandling = True

        self.AddStdoutHandlerCallback( ".*Progress: (\d+)%.*" ).HandleCallback += self.HandleProgress
        
        pythonPath = self.GetEnvironmentVariable( "PYTHONPATH" ).strip()
        addingPaths = self.GetConfigEntryWithDefault( "PythonSearchPaths", "" ).strip()
        
        if addingPaths != "":
            addingPaths.replace( ';', os.pathsep )
            
            if pythonPath != "":
                pythonPath = pythonPath + os.pathsep + addingPaths
            else:
                pythonPath = addingPaths
            
            self.LogInfo( "Setting PYTHONPATH to: " + pythonPath )
            self.SetEnvironmentVariable( "PYTHONPATH", pythonPath )
        
        currentJob = self.GetJob().JobId

Mmm. This might be too early in the process to get the job object that way. I’ve hit this problem myself in the past.

You can test that by moving that code into something like RenderArgument() to see if you get the JobId value there.

Hey Edwin,

I’ve tested placing the code in different parts of the main code but with the same result.

The thing is, it works in deadline 10.05.

Hey, sorry for the delay here.

I’ve taken a look and it seems that DeadlinePlugin’s GetJob() call under the hood is in fact just returning what its current cached job is set to. If it’s None, then the plugin doesn’t have its job set yet. In fact, this is somewhat expected as we have guards for that in the neighboring functions:

if( m_job == null )
    throw new RenderPluginException( "IsMaintenanceJob: No job has been loaded yet", null, RenderPluginExceptionCause.JobError, ManagedProcess.AbortLevel.Major );

The job value is set after we call some initialization code internally, but I can’t see where we’re calling InitializeProcess from C# land… I’ll have to loop with a developer on this one.

Hey Edwin, any progress with this?
maybe you have suggestions for simple tests that i can perform in order to get locally rendering job ID?
does it works for you if you write the code differently?

Privacy | Site terms | Cookie preferences