def presentCell(self, record: Task, **kwargs: object) -> XMLContent: table = cast(TaskRunsTable, kwargs['table']) if table.taskNameLink: return createTaskInfoLink(record.getJob().getId(), record.getName()) else: return record.getName()
def checkAbort(task: Task) -> bool: if onlyWaiting and not task.isWaiting(): return False elif taskNames and task.getName() not in taskNames: return False else: return True
def presentCell(self, record: Task, **kwargs: object) -> XMLContent: if record.canBeAborted(): proc = cast(PageProcessor, kwargs['proc']) return pageLink( 'AbortTask', TaskIdArgs(jobId=proc.args.jobId, taskName=record.getName()))['Abort'] else: return '-'
def addRun(self, task: Task) -> TaskRun: taskRun = self.factory.createTaskrun({'id': createInternalId()}) # pylint: disable=protected-access taskRun._task = task taskRun._job = task.getJob() self.add(taskRun) return taskRun
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'
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() ) ]
def taskSummary(task: Task) -> XML: return pageLink( 'Task', TaskIdArgs(jobId=task.getJob().getId(), taskName=task.getName()) )[ task.getLatestRun().getSummary() or '(empty summary)' ]
def presentCell(self, record: Task, **kwargs: object) -> XMLContent: proc = cast(ExtractedData_GET.Processor, kwargs['proc']) runId = record.getLatestRun().getId() data = proc.dataByRunId.get(runId) return '-' if data is None else data.get(self.__key, '-')