+__docformat__ = "restructuredtext en"
+
import glob
import re
import os
s_firecrest = None
-def _four_digit_num_in_string(num):
- if num < 0:
- pass
- elif num < 10:
- return '000' + str(num)
- elif num < 100:
- return '00' + str(num)
- elif num < 1000:
- return '0' + str(num)
- elif num < 10000:
- return str(num)
-
- msg = 'Invalid number: %s' % (num)
- raise ValueError, msg
-
-def _two_digit_num_in_string(num):
- if num < 0:
- pass
- elif num < 10:
- return '0' + str(num)
- elif num < 100:
- return str(num)
-
- msg = 'Invalid number: %s' % (num)
- raise ValueError, msg
-
-
# FIRECREST PATTERNS
# _p2f(<pattern>, lane, tile, cycle)
PATTERN_FIRECREST_QCM = 's_%s_%s_%s_qcm.xml'
# lane, and cycle provided (INVALID)
if tile is None and cycle is not None:
msg = "Handling of cycle without tile is not currently implemented."
- raise ValueError, msg
+ raise ValueError(msg)
# lane, tile, cycle provided
elif cycle:
return pattern % (lane,
- _four_digit_num_in_string(tile),
- _two_digit_num_in_string(cycle))
+ "%04d" % (tile,),
+ "%02d" % (cycle,))
# lane, tile provided
elif tile:
- return pattern % (lane, _four_digit_num_in_string(tile))
+ return pattern % (lane, "%04d" % (tile,))
# lane provided
else:
"""
firecrest = self.status['firecrest']
total = len(firecrest)
- completed = firecrest.values().count(True)
+ completed = list(firecrest.values()).count(True)
return (completed, total)
"""
bustard = self.status['bustard']
total = len(bustard)
- completed = bustard.values().count(True)
+ completed = list(bustard.values()).count(True)
return (completed, total)
"""
gerald = self.status['gerald']
total = len(gerald)
- completed = gerald.values().count(True)
+ completed = list(gerald.values()).count(True)
return (completed, total)
You should probably use startCmdLineStatusMonitor()
instead of ths function.
- Use with:
- t = threading.Thread(target=_cmdLineStatusMonitorFunc,
- args=[conf_info])
- t.setDaemon(True)
- t.start()
+ .. python:
+ def example_launch():
+ t = threading.Thread(target=_cmdLineStatusMonitorFunc,
+ args=[conf_info])
+ t.setDaemon(True)
+ t.start()
"""
SLEEP_AMOUNT = 30
while 1:
if conf_info.status is None:
- print "No status object yet."
+ print("No status object yet.")
time.sleep(SLEEP_AMOUNT)
continue
report = conf_info.status.statusReport()
- print os.linesep.join(report)
- print
+ print(os.linesep.join(report))
+ print()
time.sleep(SLEEP_AMOUNT)
parser.error("need name of configuration file")
status = GARunStatus(args[0])
- print os.linesep.join(status.statusReport())
+ print(os.linesep.join(status.statusReport()))
return 0
if __name__ == "__main__":