qat.qlmaas.result.AsyncResult

The class AsyncResult is a high level class used to manage a pending result. This class is used to get the status of a submitted job, download the result, cancel the job, delete the job, …

class qat.qlmaas.result.AsyncResult(job_id: str, connection)

An handle to the result of the execution of an asynchronous Batch or Job.

Note

Please note that this method is not designed to be instantiated manually. You can either use:

  • a QLMaaSConnection to create an AsyncResult object:

    from qat.qlmaas import QLMaaSConnection
    
    async_result = QLMaaSConnection(...).get_job("Job...")
    
  • the qlmaas.jobs module (if a configuration file exists on your computer)

    from qlmaas.jobs import Job...
    
submission_date

submission date

Type:

datetime

starting_date

starting date - None if the job have not started

Type:

datetime, optional

ending_date

ending date - None if the job have not finished

Type:

datetime, optional

cancel()

Tries to cancel the job. The status of the job will be set to CANCELLED if the job can be cancelled.

Returns:

whether or not the job has been cancelled

Return type:

bool

delete_files()

Tries to delete job files. The status of the job will be set to DELETED if the job files can be deleted

Returns:

whether or not the job files have been deleted

Return type:

bool

get_batch()

Returns the Batch (or the Job) submitted to the server

from qlmaas.qpus import LinAlg

batch = ...
my_job = LinAlg().submit(batch)

# Download 'batch' object
batch_cp = my_job.get_batch()
Returns:

submitted batch or job

Return type:

Batch or Job

get_info()

Get the information on the current job. These information contains:

  • the status of the job

  • the amount of resources used to execute the job

  • the submission date

Returns:

infomation on the job

Return type:

JobInfo

get_result()

Returns the result of the job. If the job is not available, an exception is raised.

Returns:

Result or BatchResult

get_status(human_readable: bool = True)

Returns the status of the job

Returns:

JobStatus

join()

Wait until the job is done and returns the result of the job

Returns:

Result or BatchResult

queue()

Returns the job’s place in the queue, a ‘None’ result means that the job is not in the queue.