本文整理汇总了Python中lsst.pex.logging.Log类的典型用法代码示例。如果您正苦于以下问题:Python Log类的具体用法?Python Log怎么用?Python Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
"execute the launchMospipe script"
logger = Log(Log.getDefaultLog(), "launchMos")
try:
(cl.opts, cl.args) = cl.parse_args()
Log.getDefaultLog().setThreshold(-10 * cl.opts.verbosity)
if cl.opts.pipeverb is None:
cl.opts.pipeverb = "trace"
t = filter(lambda x: x.startswith(cl.opts.datatype.lower()),
datatypes.keys())
if len(t) > 1:
raise ValueError("Ambiguous data type name: " + cl.opts.datatype)
if len(t) == 0:
raise ValueError("Unrecognized data type name: "+ cl.opts.datatype)
cl.opts.datatype = datatypes[t[0]]
colls = []
# parse the collection names
if cl.opts.colls is not None:
colls = cl.opts.colls.split(',')
launchMos(cl.args[0], cl.args[1], cl.args[2:], colls, cl.opts, logger)
except run.UsageError, e:
print >> sys.stderr, "%s: %s" % (cl.get_prog_name(), e)
sys.exit(1)
示例2: showAllLogProperties
def showAllLogProperties(self, show):
"""control whether log properties are displayed to the screen. These
include, for example, the DATE (and time) of the message.
@param show if true, show all the properties when a log message is
printed. If false, don't show them.
"""
Log.getDefaultLog().setShowAll(show)
示例3: IsrBiasStageParallel
class IsrBiasStageParallel(harnessStage.ParallelProcessing):
"""
Description:
Policy Dictionary:
Clipboard Input:
ClipboardOutput:
"""
def setup(self):
self.log = Log(self.log, "IsrBiasStage - parallel")
policyFile = pexPolicy.DefaultPolicyFile("ip_pipeline", "IsrBiasStageDictionary.paf", "policy")
defPolicy = pexPolicy.Policy.createPolicy(policyFile, policyFile.getRepositoryPath())
if self.policy is None:
self.policy = pexPolicy.Policy()
self.policy.mergeDefaults(defPolicy)
def process(self, clipboard):
"""
"""
self.log.log(Log.INFO, "Doing bias subtraction.")
#grab exposure and bias from clipboard
biasexposure = clipboard.get(self.policy.getString("inputKeys.biasexposure"))
exposure = clipboard.get(self.policy.getString("inputKeys.exposure"))
ipIsr.biasCorrection(exposure, biasexposure)
#output products
clipboard.put(self.policy.get("outputKeys.biasSubtractedExposure"), exposure)
示例4: IsrCcdSdqaStageParallel
class IsrCcdSdqaStageParallel(harnessStage.ParallelProcessing):
"""
Description:
Policy Dictionary:
Clipboard Input:
ClipboardOutput:
"""
def setup(self):
self.log = Log(self.log, "CcdSdqaStage -- Parallel")
policyFile = pexPolicy.DefaultPolicyFile("ip_pipeline",
"IsrCcdSdqaStageDictionary.paf", "policy")
defPolicy = pexPolicy.Policy.createPolicy(policyFile, policyFile.getRepositoryPath())
if self.policy is None:
self.policy = pexPolicy.Policy()
self.policy.mergeDefaults(defPolicy)
def process(self, clipboard):
"""
"""
self.log.log(Log.INFO, "Calculate SDQA metrics based on the assembled ccd.")
#grab exposure from clipboard
exposure = clipboard.get(self.policy.getString("inputKeys.ccdExposure"))
ipIsr.calculateSdqaCcdRatings(exposure)
#output products
clipboard.put(self.policy.get("outputKeys.sdqaCcdExposure"),
exposure)
示例5: IsrDarkStageParallel
class IsrDarkStageParallel(harnessStage.ParallelProcessing):
"""
Description:
Policy Dictionary:
Clipboard Input:
ClipboardOutput:
"""
def setup(self):
self.log = Log(self.log, "IsrDarkStage - parallel")
policyFile = pexPolicy.DefaultPolicyFile("ip_pipeline", "IsrDarkStageDictionary.paf", "policy")
defPolicy = pexPolicy.Policy.createPolicy(policyFile, policyFile.getRepositoryPath())
if self.policy is None:
self.policy = pexPolicy.Policy()
self.policy.mergeDefaults(defPolicy)
def process(self, clipboard):
"""
"""
self.log.log(Log.INFO, "Doing dark subtraction.")
#grab exposure and dark from clipboard
darkexposure = clipboard.get(self.policy.getString("inputKeys.darkexposure"))
exposure = clipboard.get(self.policy.getString("inputKeys.exposure"))
darkscaling = darkexposure.getCalib().getExptime()
expscaling = exposure.getCalib().getExptime()
ipIsr.darkCorrection(exposure, darkexposure, float(expscaling),
float(darkscaling))
#output products
clipboard.put(self.policy.get("outputKeys.darkSubtractedExposure"), exposure)
示例6: checkExitByStage
def checkExitByStage(self):
log = Log(self.log, "checkExitByStage")
if((self._stop.isSet()) and (self.exitLevel == 3)):
log.log(Log.INFO, "Pipeline stop is set at exitLevel of 3")
log.log(Log.INFO, "Exit here at the end of the Stage")
self.forceShutdown = 1
示例7: checkExitBySyncPoint
def checkExitBySyncPoint(self):
log = Log(self.log, "checkExitBySyncPoint")
if((self._stop.isSet()) and (self.exitLevel == 2)):
log.log(Log.INFO, "Pipeline stop is set at exitLevel of 2")
log.log(Log.INFO, "Exit here at a Synchronization point")
self.forceShutdown = 1
示例8: main
def main():
"""execute the watchLogs script"""
try:
(cl.opts, cl.args) = cl.parse_args()
Log.getDefaultLog().setThreshold(
run.verbosity2threshold(cl.opts.verbosity, 0))
if cl.opts.inclhosts:
cl.opts.inclhosts = cl.opts.inclhosts.split(',')
if cl.opts.exclhosts:
cl.opts.exclhosts = cl.opts.exclhosts.split(',')
hosts = cl.opts.inclhosts
if not hosts:
hosts = cl.opts.exclhosts
if cl.opts.minimport and cl.opts.maximport and \
cl.opts.minimport > cl.opts.maximport:
raise run.UsageError(
"-m value (%i) should be less than -M value (%i)" %
(cl.opts.minimport, cl.opts.maximport))
watchLogs(cl.args[0], cl.args[1:], cl.opts.sleep,
cl.opts.slice, hosts, not bool(cl.opts.inclhosts),
cl.opts.minimport, cl.opts.maximport)
except run.UsageError, e:
print >> sys.stderr, "%s: %s" % (cl.get_prog_name(), e)
sys.exit(1)
示例9: shutdown
def shutdown(self):
"""
Shutdown the Slice execution
"""
shutlog = Log(self.log, "shutdown", Log.INFO);
shutlog.log(Log.INFO, "Shutting down Slice")
self.cppSlice.shutdown()
示例10: checkExitByVisit
def checkExitByVisit(self):
log = Log(self.log, "checkExitByVisit")
if((self._stop.isSet()) and (self.exitLevel == 4)):
log.log(Log.INFO, "Pipeline stop is set at exitLevel of 4")
log.log(Log.INFO, "Exit here at the end of the Visit")
self.forceShutdown = 1
示例11: FakeOutput
class FakeOutput(harnessStage.ParallelProcessing):
"""
this stage simulates work by sleeping
"""
def setup(self):
if not self.log:
self.log = Log.getDefaultLog()
self.mylog = Log(self.log, "output")
self.outputDatasetsKey = \
self.policy.getString("inputKeys.outputDatasets")
self.possibleDatasetsKey = \
self.policy.getString("inputKeys.possibleDatasets")
def process(self, clipboard):
expected = clipboard.get(self.possibleDatasetsKey)
outputds = clipboard.get(self.outputDatasetsKey)
# this implementation will pretend to write out all of the
# expected datasets. It will also put each dataset written
# out into the outputDatasets list.
if expected:
for ds in expected:
self.mylog.log(Log.INFO, "Writing out " + ds.toString())
outputds.append(ds)
else:
self.log.log(Log.WARN, "No expected datasets on clipboard")
clipboard.put(self.outputDatasetsKey, outputds)
示例12: IsrVarianceStageParallel
class IsrVarianceStageParallel(harnessStage.ParallelProcessing):
"""
Description:
Policy Dictionary:
Clipboard Input:
ClipboardOutput:
"""
def setup(self):
self.log = Log(self.log, "IsrVarianceStage - parallel")
policyFile = pexPolicy.DefaultPolicyFile("ip_pipeline", "IsrVarianceStageDictionary.paf", "policy")
defPolicy = pexPolicy.Policy.createPolicy(policyFile, policyFile.getRepositoryPath())
if self.policy is None:
self.policy = pexPolicy.Policy()
self.policy.mergeDefaults(defPolicy)
def process(self, clipboard):
"""
"""
self.log.log(Log.INFO, "Calculating variance from image counts.")
#grab exposure from clipboard
exposure = clipboard.get(self.policy.getString("inputKeys.exposure"))
ipIsr.updateVariance(exposure)
#output products
clipboard.put(self.policy.get("outputKeys.varianceAddedExposure"), exposure)
示例13: _StopThread
class _StopThread(threading.Thread):
def __init__(self, joboffice, stopTopic, runId, brokerHost,
brokerPort=None, waittime=60):
threading.Thread.__init__(self, name=joboffice.getName()+".stop")
self.setDaemon(True)
self.jo = joboffice
self.timeout = waittime
self.log = Log(self.jo.log, "stop")
selector = ""
if runId: selector = "RUNID='%s'" % runId
if brokerPort:
self.rcvr = EventReceiver(brokerHost, brokerPort, stopTopic,
selector)
else:
self.rcvr = EventReceiver(brokerHost, stopTopic, selector)
def run(self):
while True:
event = self.rcvr.receiveEvent(self.timeout)
if event:
self.log.log(Log.INFO-1, "received stop event; " +
"shutting down JobOffice thread")
self.jo.stop()
if self.jo.halt:
return
示例14: main
def main():
"""execute the testEventLogger script"""
try:
(cl.opts, cl.args) = cl.parse_args()
Log.getDefaultLog().setThreshold(
run.verbosity2threshold(cl.opts.verbosity, 0))
props = {}
if cl.opts.stage:
props["stageId"] = cl.opts.stage
if cl.opts.pipeline:
props["pipeline"] = cl.opts.pipeline
broker = None
if len(cl.args) > 0:
broker = cl.args[0]
input = None
if cl.opts.stdin:
input = sys.stdin
testEventLogger(broker, cl.opts.runid, cl.opts.slice, props,
input, cl.opts.logname, cl.opts.logtopic)
except run.UsageError, e:
print >> sys.stderr, "%s: %s" % (cl.get_prog_name(), e)
sys.exit(1)
示例15: setup
def setup(self):
if not self.log:
self.log = Log.getDefaultLog()
self.mylog = Log(self.log, "output")
self.outputDatasetsKey = \
self.policy.getString("inputKeys.outputDatasets")
self.possibleDatasetsKey = \
self.policy.getString("inputKeys.possibleDatasets")