Ejemplo n.º 1
0
    def start(self, task, deploy_id=None, tag=None, do_use=False):
        """Run a benchmark task.

        :param task: a file with yaml/json configration
        :param deploy_id: a UUID of a deployment
        :param tag: optional tag for this task
        """
        task = os.path.expanduser(task)
        with open(task, 'rb') as task_file:
            config_dict = yaml.safe_load(task_file.read())
            try:
                task = api.create_task(deploy_id, tag)
                print("=" * 80)
                print(_("Task %(tag)s %(uuid)s is started")
                      % {"uuid": task["uuid"], "tag": task["tag"]})
                print("-" * 80)
                api.start_task(deploy_id, config_dict, task=task)
                self.detailed(task_id=task['uuid'])
                if do_use:
                    use.UseCommands().task(task['uuid'])
            except exceptions.InvalidConfigException:
                return(1)
            except KeyboardInterrupt:
                api.abort_task(task['uuid'])
                raise
Ejemplo n.º 2
0
    def abort(self, task_id=None):
        """Abort started benchmarking task.

        :param task_id: Task uuid
        """

        api.abort_task(task_id)
Ejemplo n.º 3
0
    def start(self, task, deploy_id=None, tag=None, do_use=False):
        """Start benchmark task.

        :param task: a file with yaml/json configration
        :param deploy_id: a UUID of a deployment
        :param tag: optional tag for this task
        """
        task = os.path.expanduser(task)
        with open(task, 'rb') as task_file:
            config_dict = yaml.safe_load(task_file.read())
            try:
                task = api.create_task(deploy_id, tag)
                print("=" * 80)
                print(
                    _("Task %(tag)s %(uuid)s is started") % {
                        "uuid": task["uuid"],
                        "tag": task["tag"]
                    })
                print("-" * 80)
                api.start_task(deploy_id, config_dict, task=task)
                self.detailed(task_id=task['uuid'])
                if do_use:
                    use.UseCommands().task(task['uuid'])
            except exceptions.InvalidConfigException:
                return (1)
            except KeyboardInterrupt:
                api.abort_task(task['uuid'])
                raise
Ejemplo n.º 4
0
    def abort(self, task_id=None):
        """Abort started benchmarking task.

        :param task_id: Task uuid
        """

        api.abort_task(task_id)
Ejemplo n.º 5
0
    def abort(self, task_id):
        """Force abort task

        :param task_uuid: Task uuid
        """
        try:
            api.abort_task(task_id)
        except Exception as e:
            print(_("Something went wrong %s") % e)
Ejemplo n.º 6
0
    def abort(self, task_id=None):
        """Force abort task

        :param task_id: Task uuid
        """
        api.abort_task(task_id)
Ejemplo n.º 7
0
    def abort(self, task_id=None):
        """Force abort task

        :param task_id: Task uuid
        """
        api.abort_task(task_id)