quantum_launcher.workflow.pilotjob_scheduler#

Summary#

Classes:

Reference#

class quantum_launcher.workflow.pilotjob_scheduler.JobManager(manager: Manager | None = None)[source]#

Bases: object

submit(problem: Problem, algorithm: Algorithm, backend: Backend, output_path: str, cores: int | None = None) str[source]#

Submits Quantum Launcher job to the scheduler

Parameters:
  • problem (Problem) – Problem.

  • algorithm (Algorithm) – Algorithm.

  • backend (Backend) – Backend.

  • output_path (str) – Path of output file.

  • cores (Optional[int], optional) – Number of cores per task, if None value set to number of free cores (at least 1). Defaults to None.

Returns:

Job Id.

Return type:

str

submit_many(problem: Problem, algorithm: Algorithm, backend: Backend, output_path: str, cores_per_job: int = 1) List[str][source]#

Submits as many jobs as there are currently available cores.

Parameters:
  • problem (Problem) – Problem.

  • algorithm (Algorithm) – Algorithm.

  • backend (Backend) – Backend.

  • output_path (str) – Path of output file.

  • cores_per_job (int, optional) – Number of cores per job. Defaults to 1.

Returns:

List with Job Id’s.

Return type:

List[str]

wait_for_a_job(job_id: str | None = None, timeout: int | float | None = None) tuple[str, str][source]#

Waits for a job to finish and returns it’s id and status.

Parameters:
  • job_id (Optional[str], optional) – Id of selected job, if None waiting for any job. Defaults to None.

  • timeout (Optional[int | float], optional) – Timeout in seconds. Defaults to None.

Raises:

ValueError – Raises if job_id not found or there are no jobs left.

Returns:

job_id, job’s status

Return type:

tuple[str, str]

read_results(job_id: str) Result[source]#

Reads the result of given job_id.

Parameters:

job_id (str) – Job Id.

Returns:

Result of selected Job.

Return type:

Result

clean_up()[source]#

Removes all output files generated in the process and calls self.manager.cleanup().

stop()[source]#

Stops the manager process.