Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom_max_execution_time test #405

Merged
merged 6 commits into from
Jul 1, 2022
Merged
Changes from 5 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
21 changes: 8 additions & 13 deletions test/integration/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,20 @@ def test_run_program_failed_ran_too_long(self, service):
def test_run_program_failed_custom_max_execution_time(self, service):
"""Test a program that failed with a custom max_execution_time."""
# check that program max execution time is overridden
max_execution_time = 300
program_max_execution_time = 400
job_max_execution_time = 350
program_id = self._upload_program(
service, max_execution_time=max_execution_time
service, max_execution_time=program_max_execution_time
)
inputs = {"iterations": 1, "sleep_per_iteration": 60}
job = self._run_program(
service, program_id=program_id, inputs=inputs, max_execution_time=1
service, program_id=program_id, max_execution_time=job_max_execution_time
)
job.wait_for_final_state()
job_result_raw = service._api_client.job_results(job.job_id)
self.assertEqual(JobStatus.ERROR, job.status())
self.assertIn(
API_TO_JOB_ERROR_MESSAGE["CANCELLED - RAN TOO LONG"].format(
job.job_id, job_result_raw
),
job.error_message(),
self.assertEqual(
job._api_client.job_get(job.job_id)["cost"], job_max_execution_time
)
with self.assertRaises(RuntimeJobFailureError):
job.result()
with self.assertRaises(IBMRuntimeError):
self._run_program(service, program_id=program_id, max_execution_time=1)
rathishcholarajan marked this conversation as resolved.
Show resolved Hide resolved

@run_integration_test
def test_run_program_failed_invalid_execution_time(self, service):
Expand Down