コード例 #1
0
ファイル: task.py プロジェクト: itskewpie/rally
    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
コード例 #2
0
ファイル: task.py プロジェクト: sahanasj/rally
    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
コード例 #3
0
ファイル: task.py プロジェクト: mohitsethi/rally
    def start(self, task, deploy_id=None, tag=None):
        """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
        """
        with open(task, 'rb') as task_file:
            config_dict = yaml.safe_load(task_file.read())
            try:
                task = api.create_task(deploy_id, tag)
                self.list(task_list=[task])
                api.start_task(deploy_id, config_dict, task=task)
                self.detailed(task_id=task['uuid'])
            except exceptions.InvalidArgumentsException:
                print(_("Reason: %s") % sys.exc_info()[1])
コード例 #4
0
ファイル: task.py プロジェクト: ugvddm/rally
    def start(self, task, deploy_id=None, tag=None):
        """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
        """
        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"])
            except exceptions.InvalidConfigException:
                sys.exit(1)
コード例 #5
0
ファイル: test_api.py プロジェクト: marcoemorais/rally
 def test_create_task(self, mock_task):
     deployment_uuid = uuid.uuid4()
     tag = "a"
     api.create_task(deployment_uuid, tag)
     mock_task.assert_called_once_with(deployment_uuid=deployment_uuid,
                                       tag=tag)
コード例 #6
0
ファイル: test_api.py プロジェクト: SunilMamillapalli/rally
 def test_create_task(self, mock_task):
     deployment_uuid = uuid.uuid4()
     tag = "a"
     api.create_task(deployment_uuid, tag)
     mock_task.assert_called_once_with(deployment_uuid=deployment_uuid,
                                       tag=tag)
コード例 #7
0
ファイル: test_api.py プロジェクト: sahanasj/rally
 def test_create_task(self, mock_task):
     deployment_uuid = "b0d9cd6c-2c94-4417-a238-35c7019d0257"
     tag = "a"
     api.create_task(deployment_uuid, tag)
     mock_task.assert_called_once_with(deployment_uuid=deployment_uuid,
                                       tag=tag)
コード例 #8
0
ファイル: test_api.py プロジェクト: slashk/rally
 def test_create_task(self, mock_task):
     deployment_uuid = 'b0d9cd6c-2c94-4417-a238-35c7019d0257'
     tag = "a"
     api.create_task(deployment_uuid, tag)
     mock_task.assert_called_once_with(deployment_uuid=deployment_uuid,
                                       tag=tag)
コード例 #9
0
ファイル: test_api.py プロジェクト: linhuacheng/rally
 def test_create_task(self, mock_task, mock_d_get):
     tag = "a"
     api.create_task(mock_d_get.return_value["uuid"], tag)
     mock_task.assert_called_once_with(
         deployment_uuid=mock_d_get.return_value["uuid"], tag=tag)