RepositoryUtils.GetJob doesn't retrun anything

Hi.

I’m trying Deadline python api.
I wrote a following script and executed it by deadlinecommand.exe -ExecuteScriptNoGui .

I expected RepositoryUtils.GetJobs would return all Job instance but it returned no item.
There is somthing wrong with me?

from Deadline.Scripting import RepositoryUtils


def __main__(*args):
    job_id = "job id"

    jobs = RepositoryUtils.GetJobs(False)
    print(jobs) # empty

    jobs = RepositoryUtils.GetJobs([job_id], False)
    print(jobs) # empty

    job = RepositoryUtils.GetJob(job_id, False)
    print(job) # job name is printed


Your script looks fine. Perhaps it’s your connection to the repo? Could you have been connected to a wrong repository?

If my connection to repo is wrong, wouldn’t the result of GetJob also be wrong?
It seems that GetJob works correcly.

Yeah that is strange indeed.
Did you try passing True for the invalidateCache parameter?
RepositoryUtils.GetJobs([job_id], True)

I tried it but it has no effect…

If I set invalidateCache to True I get proper results back on 10.1.20.3. for all functions you’re calling. Leaving it as False returns the same behaviour because the local cache is empty/out of date.

I did make some little tweaks but it’s effectively your script:

from Deadline.Scripting import RepositoryUtils


def __main__(*args):
    job_id = "62266f4da7d9b68468b47a7a"

    jobs = RepositoryUtils.GetJobs(True)
    print("RepositoryUtils.GetJobs(True)")
    for foo in jobs:    
        print(foo)

    jobs = RepositoryUtils.GetJobs([job_id], True)
    print("RepositoryUtils.GetJobs([job_id], True)")
    for foo in jobs:    
        print(foo)

    job = RepositoryUtils.GetJob(job_id, True)
    print("RepositoryUtils.GetJob(job_id, True)")
    print(job) # job name is printed

What’s your Deadline version, maybe there’s some version-specific issue?

2 Likes

Thanks! It works fine!

1 Like