qat.qlmaas.job_id.get_job_id
- qat.qlmaas.job_id.get_job_id()
This function is intended to be used only on the server side. If the environment variable is not set during the instantiation, an
EnvironmentErroris raised.ExampleCan be used to create a logger to know what job your qpu is processing
import logging from qat.core import Result from qat.qpus import QPUHandler from qat.qlmaas.job_id import get_job_id # Define logger LOGGER = logging.getLogger("QPU_LOGGER") class LoggingQPU(QPUHandler): ''' QPUHandler which logs the Qaptiva Access job ID, for each submission of a job. ''' def submit_job(self, job): " Execute a job " # Retrieve and log the job ID # Raises an exception if not called in a Qaptiva Access job job_id = get_job_id() LOGGER.info("Executing job with ID: %s", job_id) # Create a simple result result = Result() ... return result
- Raises:
EnvironmentError – Error raised if the Qaptiva Access job ID cannot be retrieved. This occur if this function is called in a process not managed by Qaptiva Access.
- Returns:
The job ID string stored in the environment.
- Return type:
str