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
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
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])
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)
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)
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)
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)
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)