Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def handle_raw_exception(e):
if "Error starting job" in stringErr:
raise CLIInternalError("There was an error starting the job execution. Please check input parameters and try again.")

if "Requested job execution" in stringErr and "not found" in stringErr:
raise CLIInternalError("Requested job execution not found. Please check input parameters and try again.")

if "{" in stringErr and "}" in stringErr:
jsonError = stringErr[stringErr.index("{"):stringErr.rindex("}") + 1]
jsonError = json.loads(jsonError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ def stop_job(cls, cmd, resource_group_name, name, job_execution_name, job_execut
job_execution_name,
cls.api_version)

r = send_raw_request(cmd.cli_ctx, "POST", request_url, body=json.dumps(job_execution_names))
r = send_raw_request(cmd.cli_ctx, "POST", request_url, body=job_execution_names)
return r.json()

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,14 @@ def stop_containerappsjob(cmd, resource_group_name, name, job_execution_name=Non
if execution_name_list is not None:
execution_name_list = execution_name_list.split(",")
execution_name_list = json.dumps({'jobExecutionName': execution_name_list})
return ContainerAppsJobClient.stop_job(cmd=cmd, resource_group_name=resource_group_name, name=name, job_execution_name=job_execution_name, job_execution_names=execution_name_list)
r = ContainerAppsJobClient.stop_job(cmd=cmd, resource_group_name=resource_group_name, name=name, job_execution_name=job_execution_name, job_execution_names=execution_name_list)

# if stop is called for a single job execution, return generic response
if job_execution_name:
return "Job Execution: " + job_execution_name + ", stopped successfully."

# else return the response
return r
except CLIError as e:
handle_raw_exception(e)

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def test_containerapp_job_executionstest_e2e(self, resource_group):
# stop the most recently started execution
self.cmd("az containerapp job stop --resource-group {} --name {} --job-execution-name {}".format(resource_group, job, execution['name'])).get_output_in_json()

# get stopped execution for the job and check status
# get stopped execution for the job and check status after waiting for 5 seconds to ensure job has stopped
time.sleep(5)
singleExecution = self.cmd("az containerapp job execution show --resource-group {} --name {} --job-execution-name {}".format(resource_group, job, execution['name'])).get_output_in_json()
self.assertEqual(job in singleExecution['name'], True)
self.assertEqual(singleExecution['properties']['status'], "Stopped")
Expand Down