diff --git a/qiskit_ibm_runtime/ibm_runtime_service.py b/qiskit_ibm_runtime/ibm_runtime_service.py index 248f915c33..73bc8c0553 100644 --- a/qiskit_ibm_runtime/ibm_runtime_service.py +++ b/qiskit_ibm_runtime/ibm_runtime_service.py @@ -1125,7 +1125,7 @@ def jobs( are included. program_id: Filter by Program ID. instance: The service instance to use. Currently only supported for legacy runtime, - and should be in the hub/group/project. + and should be in the hub/group/project format. Returns: A list of runtime jobs. @@ -1266,6 +1266,22 @@ def least_busy( ) -> ibm_backend.IBMBackend: """Return the least busy available backend. + Args: + min_num_qubits: Minimum number of qubits the backend has to have. + instance: The service instance to use. For cloud runtime, this is the Cloud Resource + Name (CRN). For legacy runtime, this is the hub/group/project in that format. + filters: More complex filters, such as lambda functions. + For example:: + + AccountProvider.backends( + filters=lambda b: b.configuration().quantum_volume > 16) + + kwargs: Simple filters that specify a ``True``/``False`` criteria in the + backend configuration, backends status, or provider credentials. + An example to get the operational backends with 5 qubits:: + + IBMRuntimeService.least_busy(n_qubits=5, operational=True) + Returns: The backend with the fewest number of pending jobs. diff --git a/test/test_account.py b/test/test_account.py index 9b4fcecc92..91affd44ba 100644 --- a/test/test_account.py +++ b/test/test_account.py @@ -45,12 +45,14 @@ instance="crn:v1:bluemix:public:quantum-computing:us-east:a/...::", ) + # NamedTemporaryFiles not supported in Windows @skipIf(os.name == "nt", "Test not supported in Windows") class TestAccountManager(IBMTestCase): """Tests for AccountManager class.""" @temporary_account_config_file(contents={}) + @no_envs(["QISKIT_IBM_API_TOKEN"]) def test_save_get(self): """Test save and get.""" diff --git a/test/test_integration_job.py b/test/test_integration_job.py index 671e9e6e95..4804f6ce9f 100644 --- a/test/test_integration_job.py +++ b/test/test_integration_job.py @@ -658,6 +658,9 @@ def _wait_for_status(self, job, status): def _get_real_device(self, service): try: - return service.least_busy(simulator=False).name() + # TODO: Remove filters when ibmq_berlin is removed + return service.least_busy( + simulator=False, filters=lambda b: b.name() != "ibmq_berlin" + ).name() except QiskitBackendNotFoundError: raise unittest.SkipTest("No real device") # cloud has no real device diff --git a/test/test_proxies.py b/test/test_proxies.py index fb687f3732..b98c2b615e 100644 --- a/test/test_proxies.py +++ b/test/test_proxies.py @@ -229,7 +229,6 @@ def test_proxy_urls(self, qe_token, qe_url): test_urls = [ "http://{}:{}".format(ADDRESS, PORT), "//{}:{}".format(ADDRESS, PORT), - "http:{}:{}".format(ADDRESS, PORT), "http://user:123@{}:{}".format(ADDRESS, PORT), ] for proxy_url in test_urls: