def default(self, job_id): try: job = self.job_pool.get_job_by_id(job_id) except KeyError: raise HTTPError(404) job_string = "<html><head><title>Job Browser</title></head>" job_string += "<body><table>" job_string += table_row("ID", job.id) job_string += table_row("Root task", task_link(job, job.root_task)) job_string += table_row("State", JOB_STATE_NAMES[job.state]) job_string += table_row("Output ref", ref_id_link(job, job.root_task.expected_outputs[0])) job_string += span_row("Task states") for name, state in TASK_STATES.items(): try: job_string += table_row("Tasks " + name, job.task_state_counts[state]) except KeyError: job_string += table_row("Tasks " + name, 0) job_string += span_row("Task type/duration", 5) job_string += table_row( "*", str(job.all_tasks.get()), str(job.all_tasks.min), str(job.all_tasks.max), str(job.all_tasks.count) ) for type, avg in job.all_tasks_by_type.items(): job_string += table_row(type, str(avg.get()), str(avg.min), str(avg.max), str(avg.count)) job_string += "</table></body></html>" return job_string
def as_descriptor(self): counts = {} ret = {'job_id': self.id, 'task_counts': counts, 'state': JOB_STATE_NAMES[self.state], 'root_task': self.root_task.task_id if self.root_task is not None else None, 'expected_outputs': self.root_task.expected_outputs if self.root_task is not None else None, 'result_ref': self.result_ref} with self._lock: for (name, state_index) in TASK_STATES.items(): counts[name] = self.task_state_counts[state_index] return ret
def default(self, job_id): try: job = self.job_pool.get_job_by_id(job_id) except KeyError: raise HTTPError(404) job_string = '<html><head><title>Job Browser</title></head>' job_string += '<body><table>' job_string += table_row('ID', job.id) job_string += table_row('Root task', task_link(job.root_task)) job_string += table_row('State', JOB_STATE_NAMES[job.state]) job_string += table_row('Output ref', ref_id_link(job.root_task.expected_outputs[0])) job_string += span_row('Task states') for name, state in TASK_STATES.items(): try: job_string += table_row('Tasks ' + name, job.task_state_counts[state]) except KeyError: job_string += table_row('Tasks ' + name, 0) job_string += '</table></body></html>' return job_string
def as_descriptor(self): counts = {} ret = { 'job_id': self.id, 'task_counts': counts, 'state': JOB_STATE_NAMES[self.state], 'root_task': self.root_task.task_id if self.root_task is not None else None, 'expected_outputs': self.root_task.expected_outputs if self.root_task is not None else None, 'result_ref': self.result_ref } with self._lock: for (name, state_index) in TASK_STATES.items(): counts[name] = self.task_state_counts[state_index] return ret
def default(self, job_id): try: job = self.job_pool.get_job_by_id(job_id) except KeyError: raise HTTPError(404) job_string = header('Job Browser', job_id) job_string += '<table>' job_string += table_row('ID', job.id) job_string += table_row('Root task', task_link(job, job.root_task)) job_string += table_row('State', JOB_STATE_NAMES[job.state]) job_string += table_row('Output ref', ref_id_link(job, job.root_task.expected_outputs[0])) job_string += span_row('Task states') for name, state in TASK_STATES.items(): try: job_string += table_row('Tasks ' + name, job.task_state_counts[state]) except KeyError: job_string += table_row('Tasks ' + name, 0) job_string += span_row('Task type/duration', 5) job_string += table_row('*', str(job.all_tasks.get()), str(job.all_tasks.min), str(job.all_tasks.max), str(job.all_tasks.count)) for type, avg in job.all_tasks_by_type.items(): job_string += table_row(type, str(avg.get()), str(avg.min), str(avg.max), str(avg.count)) job_string += '</table></body></html>' return job_string