Client Service Connection¶
ParityOS’s primary goal is to provide the user-facing interaction layer for services provided by ParityQC. ParityOS utilizes a decoupled architecture to separate user interaction from job and user management and heavy computational workloads. The system consists of three primary components:
ParityOS (This Python Client): The high-level interaction layer used by the user to define problems and retrieve and analyze solutions.
ParityAPI (Webapp): Manages authentication, user management and permissions, job queuing and communication routing.
ParityCore: The backend execution engine. It receives tasks from ParityAPI for executing jobs and sends the results back to ParityAPI, from where they can be retrieved when they are ready
Every cloud service can be accessed by using its corresponding APIService class:
Layout Service: Uses
LayoutServiceand Maps problem representations to specific device connectivities.Circuit Service: Uses
CircuitServiceand generates quantum circuits from operator polynomials.Driver Service: Uses
DriverServiceand generates Hamiltonians for QAOA optimization.Initial State Service: Uses
InitialStateServiceand prepares initial states for constraint-preserving algorithms.Twine QAOA Service: Uses
TwineQAOAServiceand handles Parity Twine circuit construction for optimization problems.
The available methods of the client are:
submit: A non-blocking job submission of the input data, a configuration preset and an optional description to the backend that returns a job ID. The returned identifier is the handle used for subsequent job queries.get_info: Retrieves the current job state, such as current status, status change times, failure reasons etc.get_result: Retrieves the output of a completed job.run: A blocking call that combines the above three methods by submitting, polling the job status at fixed intervals and returning the result once the job is complete.
A typical user workflow would be as follows:
from parityos.services.authentication import InteractiveAuth
from parityos.services.client import HTTPClient
from parityos.services.job_info import JobStatus
from parityos.services.service import LayoutService
# Construct a client and authenticate once, handles authentication
client = HTTPClient(InteractiveAuth("my_parityos_username"))
# Create service instances by using the same client, handles API communication with the cloud service
service = LayoutService(client)
# Provide the input objects
layout_input = ...
# Submit job: Call `run()` for a synchronous workflow, or `submit()` for asynchronous control
job_id = service.submit(input_data=layout_input)
# Inspect the job status
job_info = service.get_info(job_id)
# Fetch the result when the job is complete
if job_info.status == JobStatus.COMPLETED:
result = service.get_result(job_id)