Exemplo n.º 1
0
def getTaskStatus(task: Task) -> str:
    '''Returns a short string describing the current status of the given task
    or task run.
    '''
    if task.isDone():
        result = task.result
        if result is None:
            return 'unknown'
        else:
            return result.name.lower()
    elif task.isCancelled():
        return 'cancelled'
    elif task.isRunning():
        return task.getAlert() or 'busy'
    else:
        return 'idle'
Exemplo n.º 2
0
 def taskToXML(task: Task) -> XML:
     run = task.getLatestRun()
     return xml.task(
         name = task.getName(),
         priority = task.getPriority() if taskprio else None,
         waiting = run.isWaiting(),
         running = run.isRunning(),
         done = run.isDone(),
         cancelled = run.isCancelled(),
         result = task.result,
         alert = task.getAlert(),
         summary = run.getSummary(),
         report = task.getURL(),
         starttime = formatTimeAttr(task.startTime),
         duration = task.getDuration(),
         runner = run.getTaskRunnerId(),
         )[
         ( xml.param(name = name, value = value)
           for name, value in task.getVisibleParameters().items() )
         ]