Beispiel #1
0
 def print_jobs(self, jobs, in_short=True):
     target_nodes = {
         'title': 'Target nodes',
         'value': lambda j: len(j.target_nodes)
     }
     command = {
         'title': 'Command',
         'value': lambda j: shorten(j.command_line, 60) if in_short else arrange(j.command_line, 60)
     }
     print_table(['id', command, 'state', target_nodes, 'created_at'], jobs)
Beispiel #2
0
 def print_tests(self, tests):
     test = {
         'title': 'Test',
         'value': lambda t: '%s-%s' % (t.category, t.name)
     }
     description = {
         'title': 'Description',
         'value': lambda t: arrange(t.description, 80),
     }
     print_table([test, description], tests)
Beispiel #3
0
 def print_jobs(self, jobs):
     target_nodes = {
         'title': 'Target nodes',
         'value': lambda j: len(j.target_nodes)
     }
     test = {
         'title':
         'Test',
         'value':
         lambda j: '%s-%s' %
         (j.diagnostic_test.category, j.diagnostic_test.name)
     }
     print_table(['id', test, 'state', target_nodes, 'created_at'], jobs)
Beispiel #4
0
    def list_tasks(self, job):
        def task_info(task, result):
            return {
                'id': task.id,
                'node': task.node,
                'state': task.state,
                'result_url': '%s/output/clusrun/%s/raw' % (self.args.host, result.result_key) if result else ''
            }

        tasks = self.api.get_clusrun_tasks(job.id, count=len(job.target_nodes))
        if not tasks:
            print("No tasks created yet!")
            return

        task_results = self.wait_task_results(tasks)
        results = [task_info(t[0], t[1]) for t in zip(tasks, task_results)]
        print_table(['id', 'node', 'state', 'result_url'], results)
Beispiel #5
0
 def print_nodes(self, nodes, in_short=True):
     jobs = {
         'title': 'Running Jobs',
         'value': lambda n: n.running_job_count
     }
     cores = {
         'title': 'Cores',
         'value': lambda n: n.node_registration_info.core_count
     }
     memory = {
         'title': 'Memory(MB)',
         'value': lambda n: n.node_registration_info.memory_megabytes
     }
     os = {
         'title': 'OS',
         'value': lambda n: shorten(n.node_registration_info.distro_info, 60) \
                     if in_short else arrange(n.node_registration_info.distro_info, 60)
     }
     print_table(['name', 'health', 'state', jobs, cores, memory, os],
                 nodes)