コード例 #1
0
ファイル: task.py プロジェクト: esikachev/rally
    def use(self, task):
        """Set active task. Alias for "rally use task".

        :param task: Task uuid.
        """
        print("Using task: %s" % task)
        db.task_get(task)
        fileutils.update_globals_file("RALLY_TASK", task)
コード例 #2
0
ファイル: task.py プロジェクト: esikachev/rally
    def use(self, task):
        """Set active task. Alias for "rally use task".

        :param task: Task uuid.
        """
        print("Using task: %s" % task)
        db.task_get(task)
        fileutils.update_globals_file("RALLY_TASK", task)
コード例 #3
0
ファイル: use.py プロジェクト: sahanasj/rally
    def task(self, task_id):
        """Set active task.

        :param task_id: a UUID of task
        """
        print('Using task: %s' % task_id)
        self._ensure_rally_configuration_dir_exists()
        db.task_get(task_id)
        self._update_attribute_in_global_file('RALLY_TASK', task_id)
コード例 #4
0
    def task(self, task_id):
        """Set active task.

        :param task_id: a UUID of task
        """
        print('Using task: %s' % task_id)
        self._ensure_rally_configuration_dir_exists()
        db.task_get(task_id)
        self._update_attribute_in_global_file('RALLY_TASK', task_id)
コード例 #5
0
ファイル: use.py プロジェクト: dlenwell/rally
    def task(self, task_id):
        """Set the RALLY_TASK env var so the user does not need to specify a
        task UUID in the command requiring this parameter.
        If the task uuid specified in parameter by the user does not exist,
        a TaskNotFound will be raised by task_get().

        :param task_id: a UUID of a task
        """
        print('Using task: %s' % task_id)
        self._ensure_rally_configuration_dir_exists()
        db.task_get(task_id)
        self._update_attribute_in_global_file('RALLY_TASK', task_id)
コード例 #6
0
ファイル: use.py プロジェクト: SunilMamillapalli/rally
    def task(self, task_id):
        """Set the RALLY_TASK env var so the user does not need to specify a
        task UUID in the command requiring this parameter.
        If the task uuid specified in parameter by the user does not exist,
        a TaskNotFound will be raised by task_get().

        :param task_id: a UUID of a task
        """
        print('Using task: %s' % task_id)
        self._ensure_rally_configuration_dir_exists()
        db.task_get(task_id)
        self._update_attribute_in_global_file('RALLY_TASK', task_id)
コード例 #7
0
ファイル: task.py プロジェクト: ugvddm/rally
    def status(self, task_id):
        """Get status of task

        :param task_id: Task uuid
        Returns current status of task
        """
        task = db.task_get(task_id)
        print(_("Task %(task_id)s is %(status)s.") % {"task_id": task_id, "status": task["status"]})
コード例 #8
0
    def status(self, task_id=None):
        """Get status of task

        :param task_id: Task uuid
        Returns current status of task
        """
        task = db.task_get(task_id)
        print(_("Task %(task_id)s is %(status)s.")
              % {'task_id': task_id, 'status': task['status']})
コード例 #9
0
ファイル: task.py プロジェクト: HeidCloud/rally
    def status(self, task_id=None):
        """Get status of task

        :param task_id: Task uuid
        Returns current status of task
        """
        task = db.task_get(task_id)
        print(_("Task %(task_id)s is %(status)s.")
              % {'task_id': task_id, 'status': task['status']})
コード例 #10
0
ファイル: task.py プロジェクト: esikachev/rally
    def status(self, task_id=None):
        """Display current status of task.

        :param task_id: Task uuid
        Returns current status of task
        """

        task = db.task_get(task_id)
        print(_("Task %(task_id)s: %(status)s")
              % {"task_id": task_id, "status": task["status"]})
コード例 #11
0
ファイル: task.py プロジェクト: varunarya10/rally
    def status(self, task_id=None):
        """Display current status of task.

        :param task_id: Task uuid
        Returns current status of task
        """

        task = db.task_get(task_id)
        print(_("Task %(task_id)s: %(status)s")
              % {"task_id": task_id, "status": task["status"]})
コード例 #12
0
ファイル: task.py プロジェクト: yongfengdu/rally
 def get(uuid):
     return Task(db.task_get(uuid))
コード例 #13
0
ファイル: task.py プロジェクト: hughsaunders/rally
 def get(uuid):
     return Task(db.task_get(uuid))
コード例 #14
0
    def collect_and_send_report(self, task_name, task_output):
        """
        {
            "results": {
                "actions": {
                     "$action": {
                         "duration": {
                             "summary": {
                                 "min (sec)": xx,
                                 "max (sec)": xx,
                                 "avg (sec)": xx,
                                 "success": xx,
                                 "errors": xx,
                                 "total": xx
                             },
                             "data": [xx,xx,xx]
                         }
                     }
                },
                'total_errors': x
            },
            "category": "xxx",
            "raw_output": {...}
        }
        """
        report_name = get_report_name(task_name)
        report_url = "/".join((self.url, report_name))
        match = re.search("\s?rally task results\s+([\da-f\-]+)\s?", task_output)
        if not match:
            raise HealthException("Unknown rally internel error!", report_url)

        task_uuid = match.group(1)
        task_obj = db.task_get(task_uuid)
        if task_obj["status"] == "failed":
            raise HealthException(task_obj["verification_log"], report_url)

        command = "rally task results %s" % task_uuid
        logging.info("[collect_and_send_report] command is %s" % command)

        logging.info("Start to collect report for task [%s]" % task_name)
        return_code, task_result, err = self.exec_cli(command)
        if return_code > 0:
            raise HealthException(err, report_url)

        output = json.loads(task_result)[0]
        report = {"actions": {}}
        actions = []

        # Get the name of actions
        actions = []
        if output["result"]:
            actions = output["result"][0]["atomic_actions"].keys()

        for result in output["result"]:
            if result["error"]:
                continue
            actions = result["atomic_actions"].keys()
            break

        if not actions:
            actions.append(report_name)

        # Get and set report for each action
        for action in actions:
            report["actions"].setdefault(action, {"duration": {}})
            report["actions"][action]["duration"] = self._get_action_dur_report(action, output)

        # Get and set errors if any
        errors = self._get_total_errors(output)
        report["total_errors"] = errors

        logging.debug("task [%s] report is: %s" % (task_name, report))

        final_report = {"results": report, "raw_output": output}
        self.send_report(final_report, report_url)
コード例 #15
0
 def _get_task(self, uuid):
     return db.task_get(uuid)
コード例 #16
0
ファイル: test_api.py プロジェクト: danielmellado/rally
 def _get_task(self, uuid):
     return db.task_get(uuid)
コード例 #17
0
    def collect_and_send_report(self, task_name, task_output):
        """
        {
            "results": {
                "actions": {
                     "$action": {
                         "duration": {
                             "summary": {
                                 "min (sec)": xx,
                                 "max (sec)": xx,
                                 "avg (sec)": xx,
                                 "success": xx,
                                 "errors": xx,
                                 "total": xx
                             },
                             "data": [xx,xx,xx]
                         }
                     }
                },
                'total_errors': x
            },
            "category": "xxx",
            "raw_output": {...}
        }
        """
        report_name = get_report_name(task_name)
        report_url = '/'.join((self.url, report_name))
        match = re.search('\s?rally task results\s+([\da-f\-]+)\s?',
                          task_output)
        if not match:
            raise HealthException('Unknown rally internel error!', report_url)

        task_uuid = match.group(1)
        task_obj = db.task_get(task_uuid)
        if task_obj['status'] == 'failed':
            raise HealthException(task_obj['verification_log'], report_url)

        command = "rally task results %s" % task_uuid
        logging.info("[collect_and_send_report] command is %s" % command)

        print "Start to collect report for task [%s]" % task_name
        return_code, task_result, err = self.exec_cli(command)
        if return_code > 0:
            raise HealthException(err, report_url)

        output = json.loads(task_result)[0]
        report = {'actions': {}}
        actions = []

        # Get the name of actions
        actions = []
        if output['result']:
            actions = output['result'][0]['atomic_actions'].keys()

        for result in output['result']:
            if result['error']:
                continue
            actions = result['atomic_actions'].keys()
            break

        if not actions:
            actions.append(report_name)

        # Get and set report for each action
        for action in actions:
            report['actions'].setdefault(action, {'duration': {}})
            report['actions'][action]['duration'] \
                = self._get_action_dur_report(action, output)

        # Get and set errors if any
        errors = self._get_total_errors(output)
        report['total_errors'] = errors

        logging.info("task [%s] report is: %s" % (task_name, report))

        final_report = {"results": report, "raw_output": output}
        self.send_report(final_report, report_url)