PipelineFX Forum

Qube! => Developer Customization => Topic started by: Toph on July 25, 2013, 11:39:47 PM

Title: submitting job tags in python api with qube 6.5
Post by: Toph on July 25, 2013, 11:39:47 PM
Having trouble submitting job tags in python api with qube 6.5

is it possible to fill these tags out through the python API?
here's some sample code

Code: [Select]

job                 = qb.Job()
job['name']         = 'job tag test'
job['prototype']    = 'cmdline'
job['package']      = {'cmdline' : 'dir L:\\' }
job['show']         = 'test_show'
job['shot']         = 'test_shot'
job['custom1']      = 'elite job dataz'
sub                 = qb.submit(job)


job = qb.jobinfo(id=sub[0]['id'])
print job[0].get('show')


this snippet of code returns None
same thing happened when i tried

Code: [Select]
job['prod_show'] = 'test_show'
Title: Re: submitting job tags in python api with qube 6.5
Post by: jburk on July 26, 2013, 12:14:20 AM
Are you using a 6.5 version of both the supervisor and the python API as well?

Code: [Select]
>>> import qb
>>> qb.version()
'6.5-0'
>>> j = qb.jobinfo(id=41270)[0]
>>> j['prod_show']
'another show'
>>>
Title: Re: submitting job tags in python api with qube 6.5
Post by: jburk on July 26, 2013, 01:30:39 AM
Looks like an error in our documentation tripped you up, our apologies.  All the keys have a prod_ prefix:

Code: [Select]
import qb

job                 = qb.Job()
job['name']         = 'job tag test'
job['prototype']    = 'cmdline'
job['package']      = {'cmdline' : 'dir L:\\' }
job['prod_show']    = 'test_show'
job['prod_shot']    = 'test_shot'
job['prod_custom1'] = 'elite job dataz'
sub                 = qb.submit(job)[0]

print 'submitted %(id)s: %(name)s' % sub

job = qb.jobinfo(id=sub['id'])[0]
for n in ['show', 'shot', 'custom1']:
    print '%s: %s' % (n, job.get('prod_%s' % n))

yields:

$> python tagTest.py
submitted 41287: job tag test
show: test_show
shot: test_shot
custom1: elite job dataz


I've fixed the offending piece in http://docs.pipelinefx.com/display/QUB065/Tags+and+the+Qube+API
Title: Re: submitting job tags in python api with qube 6.5
Post by: Toph on July 26, 2013, 05:33:11 PM
i was in fact importing the wrong version of the API. After that and adding the prefix it works perfectly!