Skip to content

Jobs

MQP-Database-Access Job module

cancel_hamiltonian_job

cancel_hamiltonian_job(job_id: int, note: str) -> None

Cancel a Hamiltonian job and record cancellation metadata.

cancel_job

cancel_job(job_id: int, note: str) -> None

Cancel a circuit job, or requeue it when offline retry conditions match.

complete_hamiltonian_job_with_result

complete_hamiltonian_job_with_result(
    job_id: int,
    result: str,
    executed_resource: str,
    executed_circuit: str,
    note: str = "",
) -> None

Mark a Hamiltonian job as completed and store its result fields.

complete_job_with_result

complete_job_with_result(
    job_id: int,
    result: str,
    executed_resource: str,
    executed_circuit: str,
    note: str = "",
) -> None

Mark a circuit job as completed and store its execution result fields.

create_hamiltonian_job

create_hamiltonian_job(
    interaction_str: str,
    coefficients_str: str,
    owner: str,
    budget: str,
    target_spec: str,
) -> HamiltonianJob

Create and persist a new Hamiltonian job.

create_job

create_job(
    shots: int,
    circuit: str,
    owner: str,
    budget: str,
    target_spec: str,
    circuit_format: str,
    no_modify: bool = False,
    queued: bool = False,
) -> CircuitJob

Create and persist a new circuit job.

fetch_all_pending_hamiltonian_jobs

fetch_all_pending_hamiltonian_jobs() -> (
    list[HamiltonianJob]
)

Return pending Hamiltonian jobs after marking them as waiting.

fetch_all_pending_jobs

fetch_all_pending_jobs() -> list[CircuitJob]

Return all pending circuit jobs that can be scheduled.

fetch_all_pending_jobs_except_for_resource_not_from_users

fetch_all_pending_jobs_except_for_resource_not_from_users(
    resource: str, userids: list[str]
) -> list[CircuitJob]

Return schedulable pending jobs, except a resource for non-listed users.

fetch_all_pending_jobs_except_for_resources

fetch_all_pending_jobs_except_for_resources(
    resources: list[str],
) -> list[CircuitJob]

Return schedulable pending jobs excluding the listed resources.

fetch_all_pending_jobs_for_resource_from_users

fetch_all_pending_jobs_for_resource_from_users(
    resource: str, userids: list[str]
) -> list[CircuitJob]

Return schedulable pending jobs for a resource from selected users.

fetch_all_pending_jobs_for_resource_not_from_users

fetch_all_pending_jobs_for_resource_not_from_users(
    resource: str, userids: list[str]
) -> list[CircuitJob]

Return schedulable pending jobs for a resource excluding selected users.

fetch_all_pending_jobs_from_users

fetch_all_pending_jobs_from_users(
    userids: list[str],
) -> list[CircuitJob]

Return schedulable pending jobs owned by the provided users.

fetch_all_waiting_hamiltonian_jobs

fetch_all_waiting_hamiltonian_jobs() -> (
    list[HamiltonianJob]
)

Return all Hamiltonian jobs currently in waiting state.

fetch_all_waiting_jobs

fetch_all_waiting_jobs() -> list[CircuitJob]

Return all circuit jobs currently in waiting state.

fetch_by_identity

fetch_by_identity(identity: str) -> list[CircuitJob]

Return all circuit jobs owned by the given identity.

fetch_by_identity_pages

fetch_by_identity_pages(
    identity: str,
    page: int,
    jobs_per_page: int,
    order: str,
    order_by: str,
    filter_query: str,
) -> dict[str, list[CircuitJob] | int]

Fetch paginated circuit jobs belonging to a user identity.

Only the requested page of jobs is fetched, instead of all database entries. This reduces query load when jobs are displayed on the MQP website.

fetch_hamiltonian_job_by_identity

fetch_hamiltonian_job_by_identity(
    identity: str,
) -> list[HamiltonianJob]

Return all Hamiltonian jobs owned by the given identity.

fetch_hamiltonian_job_by_task_id

fetch_hamiltonian_job_by_task_id(
    task_id: int,
) -> list[HamiltonianJob]

Return Hamiltonian jobs matching the provided task ID.

fetch_result_by_job_id_and_identity

fetch_result_by_job_id_and_identity(
    job_id: str, identity: str
) -> Optional[CircuitJob]

Return a circuit job by ID for an identity, or None if unavailable.

filter_queued_if_offline_and_fetch

filter_queued_if_offline_and_fetch(
    qdb, jobs: list[CircuitJob]
) -> list[CircuitJob]

Return pending jobs that are eligible to move into waiting state.

is_within_active_job_limit

is_within_active_job_limit(qdb, job: CircuitJob) -> bool

Count the number of active jobs for a given user.

update_hybrid_job

update_hybrid_job(
    job_id: int,
    epochs: int,
    params: str,
    parametric_circuit: str,
    note: str,
) -> None

Update stored optimization fields for a Hamiltonian job.