...
To set up Universal Callbacks, the site administrator needs to make a directory (default $QBDIR/callback) and create a text-based configuration file, called "callbacks.conf" in that directory. Further, in the same 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 callback code should be triggered to run on what events.
The "callbacks.conf" file
The callbacks.conf file is a text file, much like qb.conf, containing one or more lines with a "key = value" pair, associating each implementation file to a trigger event. The syntax is:
...
Code Block |
---|
# # callbacks.conf # # syntax of this file is : # filename = triggers # logFailuresToDB.py = failed-job-self mail-status.qcb = done-job-self checkWork.pl = done-work-self-* submitted.py = submit-job-self |
In this example, there are presumably 4 implementation files in the callback directory, logFailuresToDB.py, mail-status.qcb, submitted.py, and checkWork.pl, that have the implementation code in them.
Code Block | ||||
---|---|---|---|---|
| ||||
#!/usr/bin/env python import sys import qb import traceback fh = open('/tmp/univeral_callback_test', 'a') try: # ================================================== # === NOTE: === # the qb.jobinfo() in callbacks is not the # same as the one in the external python API # ================================================== job = qb.jobinfo("-id", qb.jobid())[0] fh.write('submitted %(id)s: %(name)s\n' % job) except: fh.write(traceback.format_exc()) fh.close() sys.exit(0) |
Include+ | ||||||
---|---|---|---|---|---|---|
|
qb.conf Parameters
supervisor_universal_callback_path
...