Ejemplo n.º 1
0
    def take_action(self, parsed_args):
        self.logger.debug('take_action(%s)', parsed_args)

        job_info = self.xcute.job_show(parsed_args.job_id)

        if not parsed_args.raw:
            job_main_info = job_info['job']
            duration = job_main_info['mtime'] - job_main_info['ctime']
            job_main_info['duration'] = duration

            job_tasks = job_info['tasks']
            job_tasks['sent_percent'] = \
                job_tasks['sent'] * 100. / (job_tasks['total'] or 0.00001)
            job_tasks['processed_per_second'] = \
                job_tasks['processed'] / (duration or 0.00001)
            job_tasks['processed_percent'] = \
                job_tasks['processed'] * 100. / (job_tasks['total'] or 0.00001)

            if parsed_args.formatter == 'table':
                if not job_tasks['all_sent']:
                    if job_tasks['is_total_temp']:
                        total_state = 'estimating'
                    else:
                        total_state = 'estimated'
                    job_tasks['total'] = "%d (%s)" % (job_tasks['total'],
                                                      total_state)

            job_info.pop('orchestrator', None)
            job_main_info.pop('request_pause', None)
            job_tasks.pop('all_sent', None)
            job_tasks.pop('last_sent', None)
            job_tasks.pop('is_total_temp', None)
            job_tasks.pop('total_marker', None)

        return zip(*sorted(flat_dict_from_dict(parsed_args, job_info).items()))
Ejemplo n.º 2
0
    def take_action(self, parsed_args):
        self.logger.debug('take_action(%s)', parsed_args)

        job_config = self.get_job_config(parsed_args)
        job_info = self.xcute.job_create(self.JOB_CLASS.JOB_TYPE,
                                         job_config=job_config)
        return zip(*sorted(flat_dict_from_dict(parsed_args, job_info).items()))
Ejemplo n.º 3
0
    def take_action(self, parsed_args):
        SingleServiceCommandMixin.check_and_load_parsed_args(
            self, self.app, parsed_args)
        self.logger.debug('take_action(%s)', parsed_args)

        conf = self.app.client_manager.admin.service_get_info(
            parsed_args.service)
        return zip(*sorted(flat_dict_from_dict(parsed_args, conf).items()))
Ejemplo n.º 4
0
    def take_action(self, parsed_args):
        self.logger.debug('take_action(%s)', parsed_args)

        job_config = dict()
        if parsed_args.tasks_per_second is not None:
            job_config['tasks_per_second'] = parsed_args.tasks_per_second
        if parsed_args.tasks_batch_size is not None:
            job_config['tasks_batch_size'] = parsed_args.tasks_batch_size
        if parsed_args.params is not None:
            job_config['params'] = parsed_args.params
        new_job_config = self.xcute.job_update(parsed_args.job_id, job_config)

        return zip(
            *sorted(flat_dict_from_dict(parsed_args, new_job_config).items()))