6 def _percentCompleted(completed, total):
8 Returns precent completed as float
10 return (completed / float(total)) * 100
13 ##################################################
14 # Functions to be called by Thread(target=<func>)
15 def _cmdLineStatusMonitorFunc(conf_info):
17 Given a ConfigInfo object, provides status to stdout.
19 You should probably use startCmdLineStatusMonitor()
20 instead of ths function.
23 t = threading.Thread(target=_cmdLineStatusMonitorFunc,
31 if conf_info.status is None:
32 print "No status object yet."
33 time.sleep(SLEEP_AMOUNT)
36 fc, ft = conf_info.status.statusFirecrest()
37 bc, bt = conf_info.status.statusBustard()
38 gc, gt = conf_info.status.statusGerald()
39 tc, tt = conf_info.status.statusTotal()
41 fp = _percentCompleted(fc, ft)
42 bp = _percentCompleted(bc, bt)
43 gp = _percentCompleted(gc, gt)
44 tp = _percentCompleted(tc, tt)
46 print 'Firecrest: %s%% (%s/%s)' % (fp, fc, ft)
47 print ' Bustard: %s%% (%s/%s)' % (bp, bc, bt)
48 print ' Gerald: %s%% (%s/%s)' % (gp, gc, gt)
49 print '-----------------------'
50 print ' Total: %s%% (%s/%s)' % (tp, tc, tt)
53 time.sleep(SLEEP_AMOUNT)
56 #############################################
57 # Start monitor thread convenience functions
58 def startCmdLineStatusMonitor(conf_info):
60 Starts a command line status monitor given a conf_info object.
62 t = threading.Thread(target=_cmdLineStatusMonitorFunc, args=[conf_info])