Message-ID: <247609714.8629.1711692358321.JavaMail.confluence@host3.pipelinefx.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8628_2042596608.1711692358321" ------=_Part_8628_2042596608.1711692358321 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Universal callbacks are operations which are automatically attached= to every job that is submitted. These are installed by a site administrato= r either on the Supervisor's local disk or on a file system which is access= ible by the supervisor service.
To set up Universal Callbacks, the site administrator needs to make a di= rectory (default $QBDIR/callback) and create a text-based configuration fil= e, called "callbacks.conf" in that directory. Further, in the sam= e directory, files containing the implementation (aka "code") of = each Universal Callback must also be installed.
The callbacks.conf file serves as a map that tells the system which call= back code should be triggered to run on what events.
The callbacks.conf file is a text file, much like qb.conf, containing on= e or more lines with a "key =3D value" pair, associating each imp= lementation file to a trigger event. The syntax is:
# lines starting with a hash mark are comments filename =3D trigger=20
The filename points to a file in the same directory tha= t implements the callback code. Note that Universal Callbacks support Pytho= n, Perl, and Qube callbacks, and the filename must have the extension .py, = .pl, or .qcb, respectively.
The trigger specifies the triggering event that activat= es the callback, described in details at Triggers
Here's an example:
# # callbacks.conf # # syntax of this file is : # filename =3D triggers # logFailuresToDB.py =3D failed-job-self mail-status.qcb =3D done-job-self checkWork.pl =3D done-work-self-* submitted.py =3D submit-job-self=20
In this example, there are presumably 4 implementation files in th= e callback directory, logFailuresToDB.py, mail-status.qcb, submitted.py, an= d = checkWork.pl, that have the implementation code in them.
=20 =20 =20#!/usr/bin/env python import sys import qb import traceback fh =3D open('/tmp/univeral_callback_test', 'a') try: # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D # =3D=3D=3D NOTE: =3D=3D=3D # the qb.jobinfo() in callbacks is not the # same as the one in the external python API=20 # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D job =3D qb.jobinfo("-id", qb.jobid())[0] fh.write('submitted %(id)s: %(name)s\n' % job) except: fh.write(traceback.format_exc()) fh.close()=20
At first glance, Universal Callbacks and the&= nbsp;Job Pre- and Post-FlightChecks appear similar, but they h= ave an important difference:
supervisor_universal_callback_path