def fix_stacks(stacks, report_t): pid2pid = {} pid2jid = {} pid2part = {} job_pid = None for pid, indent, msg, t in stacks: if pid not in pid2pid and pid not in pid2jid: if msg.startswith('analysis('): pid2part[pid] = ''.join(c for c in msg if c.isdigit()) pid2pid[pid] = job_pid else: pid2jid[pid] = msg.split(' ', 1)[0] job_pid = pid elif pid not in pid2part: pid2part[pid] = msg if msg in ('prepare', 'synthesis') else 'analysis' jobpid = pid while jobpid in pid2pid: jobpid = pid2pid[jobpid] jid = pid2jid[jobpid] if indent < 0: msg = msg.split('\n') start = len(msg) - 1 while start and sum(map(bool, msg[start:])) < 5: start -= 1 msg = [line.rstrip('\r') for line in msg[start:]] t = fmttime(report_t - t) else: t = fmttime(report_t - t, short=True) yield (jid, pid, indent, pid2part.get(pid), msg, t)
def synthesis(job): joblist = [Job(j) for j in options.joblist] total = sum(j.params.exectime.total for j in joblist) with job.open('summary.html', 'w', encoding='utf-8') as fh: fh.write('<h2>Test built these jobs in ' + fmttime(total) + '</h2>\n') fh.write('<ol>\n') list_item = '<li><a href="/job/{job}" target="_blank">{job}</a> {job.method} {time}</li>\n' for j in joblist: fh.write(list_item.format(job=j, time=fmttime(j.params.exectime.total))) fh.write('</ol>\n')
def status(): status = call_s('status/full') if 'short' in bottle.request.query: if status.idle: return 'idle' else: t, msg, _ = status.current return '%s (%s)' % (msg, fmttime(status.report_t - t, short=True),) else: status.tree = list(fix_stacks(status.pop('status_stacks', ()), status.report_t)) return status
def job_data(known, jid): if jid in known: data = known[jid] else: data = DotDict(method='???', totaltime=None, current=None) try: setup = load_setup(jid) data.method = setup.method if 'exectime' in setup: data.totaltime = setup.exectime.total except Exception: pass if isinstance(data.totaltime, (float, int)): data.totaltime = fmttime(data.totaltime) if data.totaltime is None: data.klass = 'unfinished' elif data.current: data.klass = 'current' else: data.klass = 'old' return data