diff --git a/qiskit_ibm_runtime/options/options.py b/qiskit_ibm_runtime/options/options.py index b9f894c2ff..2b1599c168 100644 --- a/qiskit_ibm_runtime/options/options.py +++ b/qiskit_ibm_runtime/options/options.py @@ -90,7 +90,6 @@ class Options: _MAX_OPTIMIZATION_LEVEL = 3 _MAX_RESILIENCE_LEVEL_ESTIMATOR = 3 _MAX_RESILIENCE_LEVEL_SAMPLER = 1 - _MIN_EXECUTION_TIME = 300 _MAX_EXECUTION_TIME = 8 * 60 * 60 # 8 hours for real device optimization_level: Optional[int] = None @@ -168,14 +167,10 @@ def validate_options(options: dict) -> None: ResilienceOptions.validate_resilience_options(options.get("resilience")) TranspilationOptions.validate_transpilation_options(options.get("transpilation")) execution_time = options.get("max_execution_time") - if not execution_time is None: - if ( - execution_time < Options._MIN_EXECUTION_TIME - or execution_time > Options._MAX_EXECUTION_TIME - ): + if execution_time is not None: + if execution_time > Options._MAX_EXECUTION_TIME: raise ValueError( - f"max_execution_time must be between " - f"{Options._MIN_EXECUTION_TIME} and {Options._MAX_EXECUTION_TIME} seconds." + f"max_execution_time must be below " f"{Options._MAX_EXECUTION_TIME} seconds." ) EnvironmentOptions.validate_environment_options(options.get("environment")) diff --git a/qiskit_ibm_runtime/utils/qctrl.py b/qiskit_ibm_runtime/utils/qctrl.py index bc8338e47c..221ae65b0c 100644 --- a/qiskit_ibm_runtime/utils/qctrl.py +++ b/qiskit_ibm_runtime/utils/qctrl.py @@ -32,14 +32,10 @@ def validate(options: Dict[str, Any]) -> None: # Default validation otherwise. TranspilationOptions.validate_transpilation_options(options.get("transpilation")) execution_time = options.get("max_execution_time") - if not execution_time is None: - if ( - execution_time < Options._MIN_EXECUTION_TIME - or execution_time > Options._MAX_EXECUTION_TIME - ): + if execution_time is not None: + if execution_time > Options._MAX_EXECUTION_TIME: raise ValueError( - f"max_execution_time must be between " - f"{Options._MIN_EXECUTION_TIME} and {Options._MAX_EXECUTION_TIME} seconds." + f"max_execution_time must be below " f"{Options._MAX_EXECUTION_TIME} seconds." ) EnvironmentOptions.validate_environment_options(options.get("environment")) diff --git a/test/integration/test_job.py b/test/integration/test_job.py index 8c63a8d8de..2e2f966e9b 100644 --- a/test/integration/test_job.py +++ b/test/integration/test_job.py @@ -130,12 +130,6 @@ def test_run_program_override_max_execution_time(self, service): job.wait_for_final_state() self.assertEqual(job._api_client.job_get(job.job_id())["cost"], job_max_execution_time) - @run_integration_test - def test_invalid_max_execution_time_fails(self, service): - """Test that program fails when max_execution_time is less than 300.""" - with self.assertRaises(ValueError): - self._run_program(service, max_execution_time=299) - @run_integration_test @production_only def test_cancel_job_queued(self, service): diff --git a/test/unit/test_ibm_primitives.py b/test/unit/test_ibm_primitives.py index 27e020079e..ff2a2c76b9 100644 --- a/test/unit/test_ibm_primitives.py +++ b/test/unit/test_ibm_primitives.py @@ -688,7 +688,6 @@ def test_transpilation_options(self): def test_max_execution_time_options(self): """Test transpilation options.""" options_dicts = [ - {"max_execution_time": Options._MIN_EXECUTION_TIME - 1}, {"max_execution_time": Options._MAX_EXECUTION_TIME + 1}, ] session = MagicMock(spec=MockSession) @@ -708,7 +707,7 @@ def test_max_execution_time_options(self): inst = cls(session=session, options=opts_dict) inst.run(self.qx, observables=self.obs) self.assertIn( - "max_execution_time must be between 300 and 28800 seconds", + "max_execution_time must be below 28800 seconds", str(exc.exception), )