strangeworks_qiskit package

Subpackages

Submodules

strangeworks_qiskit.provider module

provider.py.

class StrangeworksProvider(client: SWClient | None = None)

Bases: ProviderV1

The Strangeworks Provider allows access to Strangeworks backends and runtime wrappers for the Qiskit IBMQ Runtime services

backends(name=None, filters=None, **kwargs)

Return a list of backends matching the specified filtering.

Parameters:
  • name (str) – name of the backend.

  • **kwargs – dict used for filtering.

Returns:

a list of Backends that match the filtering

criteria.

Return type:

list[Backend]

property runtime: StrangeworksRuntimeService

Return the runtime service. :returns: The runtime service instance.

Raises:

IBMQNotAuthorizedError – If the account is not authorized to use the service.

get_backend(name=None, **kwargs)

strangeworks_qiskit.runtimes module

class RuntimeJob(api_client, job_id: str, result_id: str, result_data_id: str, program_id: str, results: str, backend: str = '', status: ~qiskit.providers.jobstatus.JobStatus = JobStatus.INITIALIZING, inputs: ~typing.Dict | None = None, params: ~typing.Dict | None = None, creation_date: str | None = None, user_callback: ~typing.Callable | None = None, result_decoder: ~typing.Type[~qiskit.providers.ibmq.runtime.program.result_decoder.ResultDecoder] = <class 'qiskit.providers.ibmq.runtime.program.result_decoder.ResultDecoder'>, interim_results: ~typing.List | None = None, polling_wait: int = 5)

Bases: object

backend() str

Return the backend where this job was executed. :returns: Backend used for the job.

TODO: Return Backend object

cancel() None

Cancel the job

cancel_result_streaming() None
property creation_date: datetime | None

Job creation date in local time.

Returns:

The job creation date as a datetime object, in local time, or None if creation date is not available.

get_status() JobStatus

Fetch the status of the job

property inputs: Dict

Job input parameters. :returns: Input parameters used in this job.

job_id() str

Return a unique ID identifying the job. :returns: Job ID.

property program_id: str

Program ID. :returns: ID of the program this job is for.

result(timeout: float | None = None, wait: float = 5, decoder: Type[ResultDecoder] | None = None) Any
stream_results(callback: Callable, decoder: Type[ResultDecoder] | None = None) None

Start streaming job results. Matches IBM signature, but utilizes polling vs websockets

Parameters:
  • callback – Callback function to be invoked for any interim results. The callback function will receive 2 positional parameters, Job ID and Job interim result. callback(job_id, interim_result).

  • decoder – A ResultDecoder subclass used to decode job results.

Raises:
  • RuntimeInvalidStateError – If a callback function is already streaming

  • results or if the job already finished.

class StrangeworksRuntimeService(provider, runtime_client)

Bases: object

delete_job(job_id: str) None
delete_program(program_id: str) None
job(job_id: str) RuntimeJob
pprint_programs(refresh: bool = False) None

Pretty print programs

program(program_id: str, refresh: bool = False) RuntimeProgram

return a runtime program

programs(refresh: bool = False) List[RuntimeProgram]

Return available runtime programs

run(program_id: str = '', strangeworks_result_id: str | None = None, options: Dict = {}, inputs: Dict = {}, callback: Callable | None = None, result_decoder: Type[ResultDecoder] | None = None) RuntimeJob

Run a runtime job via the Strangeworks API

upload_program() str

Module contents

Strangeworks Qiskit SDK