Message-ID: <1777615578.8783.1711698773896.JavaMail.confluence@host3.pipelinefx.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8782_1487002131.1711698773895" ------=_Part_8782_1487002131.1711698773895 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
A callback is Qube's mechanism to allow custom executio= n of queuing logic depending upon the events which occur during the lifetim= e of a Qube job or upon pre-defined system events.
The use of callbacks can range from sending email when a job has complet= ed, to designing complex dependency trees or direct integration with an ass= et tracking system. There is also a special case that allows for= delayed execution of the job, see: How to submit a job that will= wait until later to run
When specifying a callback, Qube requires a little information in order = to execute it properly. Each callback must include:
Callbacks are defined as a list of one or more key/value pairs which is =
appended to the job's callback
list.
frameRange =3D '1-10' jobA =3D { =09'name': 'my ribgen job', =09'label': 'ribgenLabel', =09'prototype': 'cmdrange', =09'package': { =09=09'cmdline': 'my ribgen command...' =09}, =09'agenda': qb.genframes(frameRange), } jobB =3D { =09'name': 'my render job', =09'label': 'render', =09'status': 'blocked', =09'prototype': 'cmdrange', =09'package': { =09=09'cmdline': 'my render command...' =09}, =09'agenda': qb.genframes(frameRange), } callbacks =3D [ =09{=20 =09=09'triggers': 'complete-job-ribgenLabel', =09=09'language': 'qube', =09=09'code': 'unblock-self' =09} ] jobB['callbacks'] =3D callbacks qb.submit( [jobA, jobB] )=20
jobA =3D { =09. =09. =09. } jobB =3D { =09. =09. =09. } cbCode =3D 'jobId =3D qb.jobid()\n' cbCode +=3D 'qb.unblock(jobId)\n' callbacks =3D [ =09{=20 =09=09'triggers': 'complete-job-ribgenLabel', =09=09'language': 'python', =09=09'code': cbCode } jobB['callbacks'] =3D callbacks qb.submit( [jobA, jobB] )=20
frameRange =3D '1-10' jobA =3D { =09'name': 'my ribgen job', =09'label': 'ribgenLabel', =09'prototype': 'cmdrange', =09'package': { =09=09'cmdline': 'my ribgen command...' =09}, =09'agenda': qb.genframes(frameRange), } jobB =3D { =09'name': 'my render job', =09'label': 'render', =09'status': 'blocked', =09'prototype': 'cmdrange', =09'package': { =09=09'cmdline': 'my render command...' =09}, =09'agenda': qb.genframes(frameRange), } callbacks =3D [] for work in jobB['agenda']: =09work['status'] =3D 'blocked' =09callbacks.append( =09=09{=20 =09=09=09'triggers': 'complete-work-ribgenLabel-%s' % work['name'], =09=09=09'language': 'qube', =09=09=09'code': 'unblock-work-self', =09=09} =09) ] jobB['callbacks'] =3D callbacks qb.submit( [jobA, jobB] )=20
jobA =3D { =09. =09. =09. } jobB =3D { =09. =09. =09. } callbacks =3D [] for work in jobB['agenda']: =09work['status'] =3D 'blocked' =09frameNumber =3D work['name'] # the agenda item's callback should unblock both itself and the job cbCode =3D 'jobId =3D qb.jobid()\n' cbCode +=3D 'qb.workunblock("%%s:%s" %% jobId)\n' % frameNumb= er cbCode +=3D 'qb.unblock(jobId)\n' =09callbacks.append( =09=09{=20 =09=09=09'triggers': 'complete-work-ribgenLabel-%s' % frameNumber, =09=09=09'language': 'python', =09=09=09'code': cbCode, =09=09} =09) ] jobB['callbacks'] =3D callbacks qb.submit( [jobA, jobB] )=20
This can be done using any of the callback languages, the only differenc= e is the triggers value
jobA =3D { =09'label': 'ribGen', =09. =09. } jobB =3D { =09'label': 'render', =09. =09. } jobC =3D { =09'label': 'composite' =09. =09. } callbacks =3D [] for work in jobC['agenda']: =09work['status'] =3D 'blocked' =09frameNumber =3D work['name'] # the agenda item's callback should unblock both itself and the job cbCode =3D 'jobId =3D qb.jobid()\n' cbCode +=3D 'qb.workunblock("%%s:%s" %% jobId)\n' % frameNumb= er cbCode +=3D 'qb.unblock(jobId)\n' =09triggerStr =3D 'complete-work-ribgen-%s' % frameNumber' =09triggerStr +=3D ' && ' =09triggerStr +=3D 'complete-work-render-%s' % frameNumber' =09=09 =09callbacks.append( =09=09{=20 =09=09=09'triggers': triggerStr, =09=09=09'language': 'python', =09=09=09'code': cbCode, =09=09} =09) ] jobB['callbacks'] =3D callbacks qb.submit( [jobA, jobB, jobC] )=20
jobA =3D { =09'label': 'ribGen', =09. =09. } jobB =3D { =09'label': 'render', =09. =09. } jobC =3D { =09'label': 'composite', =09. =09. } jobD =3D { =09'label': 'sendToDailies', =09. =09. } callbacks =3D [] for work in jobD['agenda']: =09work['status'] =3D 'blocked', =09frameNumber =3D work['name'] # the agenda item's callback should unblock both itself and the job cbCode =3D 'jobId =3D qb.jobid()\n' cbCode +=3D 'qb.workunblock("%%s:%s" %% jobId)\n' % frameNumb= er cbCode +=3D 'qb.unblock(jobId)\n' =09triggerSt =3D '(' =09triggerStr +=3D 'complete-work-ribgen-%s' % frameNumber' =09triggerStr +=3D ' && ' =09triggerStr +=3D 'complete-work-render-%s' % frameNumber' =09triggerStr +=3D ')' =09triggerStr +=3D ' || ' =09triggerStr =3D 'complete-work-composite-%s' % frameNumber' =09=09 =09callbacks.append( =09=09{=20 =09=09=09'triggers': triggerStr, =09=09=09'language': 'python', =09=09=09'code': cbCode, =09=09} =09) ] jobB['callbacks'] =3D callbacks qb.submit( [jobA, jobB, jobC, jobD] )=20