def defineCmdLine(usage=usage, description=desc): cl = optparse.OptionParser(usage=usage, description=description) run.addAllVerbosityOptions(cl, "V", "verb") cl.add_option("-b", "--broker", action="store", dest="broker", default="newfield.as.arizona.edu", help="event broker host") cl.add_option("-t", "--topic", action="store", dest="topic", default="triggerImageprocEvent", help="event topic name") cl.add_option("-M", "--metadata-policy", action="store", dest="mdpolicy", default=None, help="policy file defining the event metadata types") return cl
from lsst.pex.policy import Policy import lsst.pex.harness.run as run usage = """usage: %prog policy_file runid [pipelineName] [-vqsd] [-L lev] [-n file]""" desc = """ Launch a pipeline with a given policy and Run ID. If a node list file is not provided via the -n option, a file called "nodelist.scr" in the current directory will be used. If the policy_file refers to other policy files, the path to those files will taken to be relative to the current directory. If a log verbosity is not specified, the default will be taken from the policy file. """ cl = optparse.OptionParser(usage=usage, description=desc) run.addAllVerbosityOptions(cl) cl.add_option("-n", "--nodelist", action="store", dest="nodelist", metavar="file", help="file containing the MPI machine list") # command line results cl.opts = {} cl.args = [] pkgdirvar = "PEX_HARNESS_DIR" def createLog(): log = Log(Log.getDefaultLog(), "harness.launchPipeline") return log def setVerbosity(verbosity): logger.setThreshold(run.verbosity2threshold(verbosity, -1))
from lsst.pex.policy import Policy import lsst.pex.harness.run as run usage = """usage: %prog policy_file runid [pipelineName] [-vqsd] [-L lev] [-n file]""" desc = """ Launch a pipeline with a given policy and Run ID. If a node list file is not provided via the -n option, a file called "nodelist.scr" in the current directory will be used. If the policy_file refers to other policy files, the path to those files will taken to be relative to the current directory. If a log verbosity is not specified, the default will be taken from the policy file. """ cl = optparse.OptionParser(usage=usage, description=desc) run.addAllVerbosityOptions(cl) cl.add_option("-n", "--nodelist", action="store", dest="nodelist", metavar="file", help="file containing the MPI machine list") # command line results cl.opts = {} cl.args = [] pkgdirvar = "PEX_HARNESS_DIR" def createLog():
from __future__ import with_statement import sys, os, time, datetime import optparse, traceback import lsst.pex.harness.run as run import lsst.pex.logging as logging from lsst.pex.logging import Log, LogRec from lsst.pex.exceptions import LsstException from lsst.daf.base import PropertySet import lsst.ctrl.events as events usage = """Usage: %prog [-vqsd] [-V int] [broker]""" desc = """send log messages as events to a log broker.""" cl = optparse.OptionParser(usage=usage, description=desc) run.addAllVerbosityOptions(cl, "V") cl.add_option("-r", "--runid", action="store", type="str", default="testEventLogger001", dest="runid", metavar="runid", help="runid to attach to messages") cl.add_option("-S", "--slice", action="store", type="int", default=-1, dest="slice", metavar="id",
# from __future__ import with_statement import sys, os, time, datetime import optparse, traceback import lsst.pex.harness.run as run from lsst.pex.logging import Log, LogRec from lsst.pex.exceptions import LsstException from lsst.daf.base import PropertySet import lsst.ctrl.events as events usage = """Usage: %prog [-vqsd] [-V int] [-w seconds] broker topic ...""" desc = """listen for and print events and their properties.""" cl = optparse.OptionParser(usage=usage, description=desc) run.addAllVerbosityOptions(cl, "V") cl.add_option("-w", "--wait-time", action="store", type="int", default=10, dest="sleep", metavar="seconds", help="seconds to sleep when no events available (def: 10)") logger = Log(Log.getDefaultLog(), "showEvents") VERB = logger.INFO-2 timeoffset = time.time() def main(): """execute the showEvents script""" try: (cl.opts, cl.args) = cl.parse_args() Log.getDefaultLog().setThreshold( run.verbosity2threshold(cl.opts.verbosity, 0))