qat.qlmaas.QLMaaSConnection

class qat.qlmaas.QLMaaSConnection(hostname: str = None, port: int = None, authentication: str = None, certificate: str = None, key: str = None, check_host: bool = None, proxy_host: str = None, proxy_port: int = None, timeout: int = None, **kwargs)

QLMaaSConnection must be used to connect to a QLMaaS server. This class provides tools to define plugins and QPUs on the server and to get informations of the submtted jobs

Note

Each argument of the constructor is optional. If one of the argument is not passed in argument, the value of this argument is taken from the QLMaaS configuration file

Parameters
  • hostname (str, optional) – Hostname of the server

  • port (int, optional) – port listened by the server Default: 443

  • authentication (str, optional) – Authentication method. The authentication is either "password" to login using a pair username/password or "ssl" to login using a SSL certificate Default: False

  • certificate (str, optional) – path to SSL certificate

  • key (str, optional) – path to SSL key

  • check_host (bool, optional) – checks the certificate of the server Default: True

  • proxy_host (str, optional) – hostname of the HTTPS proxy (if you want to use an HTTPS proxy - using an HTTPS proxy is not compatible with SSL authentication)

  • proxy_port (int, optional) – port of the HTTPS proxy (if you want to use an HTTPS proxy - using an HTTPS proxy is not compatible with SSL authentication)

  • timeout (int, optional) – keep alive connection timeout

change_password()

Interactive method for changing the current account password

>>> from qat.qlmaas import QLMaaSConnection
>>> conn = QLMaaSConnection(...)
>>> conn.change_password()  # This function does not take any argument
... New password:
... Repeat new passord:
create_config()

Saves the current connection parameters in a simple configuration file. Login-specific information is not written.

get_generator(name)

Returns a remote BatchGenerator. Its name is checked against the list of available generators.

from qat.qlmaas import QLMaaSConnection

# Create connection
conn = QLMaasConnection(...)

# Get a remote generator
MaxCutGenerator = conn.get_generator("qat.generators:MaxCutGenerator")
Parameters

name (str) – the generator name in the format module:classname

Returns

Remote generator

Return type

QLMaaSGenerator

get_generators()

Gets the list of Generators available on the server. These Generators are a list of identifiers

from qat.qlmaas import QLMaaSConnection

conn = QLMaaSConnection()
available_generators = conn.get_generators()
Returns

list of Generators available on the server

Return type

list<ServiceDescription>

get_importable(name: str)

Gets an application or remote object from its identifier. An identifier is composed of a module name and an object name (format: ‘module:name’)

Parameters

name (str) – application/object identifer

Returns

remote application or remote object

Return type

QLMaaSBasicApplication or QLMaaSRemoteObject

get_importables_in_module(module_name: str)

Get the list of applications/objects in a module available on the server side.

Parameters

module_name (str) – module name

Returns

list of Applications available on the server

Return type

list<ServiceDesription>

get_job(job_id: str)

Returns an AsyncResult using its job id. An AsyncResult is a high level class used to easily manipulate a job

Parameters

job_id (str) – the job id

Returns

the pending result

Return type

AsyncResult

get_jobs_info(*args)

List all the jobs that have been submitted by the current user. Jobs having a status DELETED are not returned by this function.

This function returns also information on each job like:

  • the status

  • the submission date

  • the amount of resources reserved for the job

  • some meta data (useful if the job has failed)

from qat.qlmaas import QLMaaSConnection

connection = QLMaaSConnection(...)
connection.get_jobs_info()

To get information on a specific job, please refer to the the class AsyncResult

Returns

list of job information

Return type

list<JobInfo>

get_plugin(name)

Returns a remote Plugin. Its name is checked against the list of available plugins.

from qat.qlmaas import QLMaaSConnection

# Create connection
conn = QLMaasConnection(...)

# Get a remote Plugin
Nnizer = conn.get_plugin("qat.plugins:Nnizer")
Parameters

name (str) – the plugin name in the format module:classname

Returns

Remote plugin

Return type

QLMaaSPlugin

get_plugins()

Gets the list of Plugins available on the server. These Plugins are a list of identifiers

from qat.qlmaas import QLMaaSConnection

conn = QLMaaSConnection()
available_plugins = conn.get_plugins()
Returns

list of Plugins available on the server

Return type

list<ServiceDescription>

get_qpu(name)

Returns a remote QPU. Its name is checked against the list of available qpus.

from qat.qlmaas import QLMaaSConnection

# Create connection
conn = QLMaasConnection(...)

# Get a remote QPU
LinAlg = conn.get_qpu("qat.qpus:LinAlg")
Parameters

name (str) – the qpu name in the format module:classname

Returns

remote QPU

Return type

QLMaaSQPU

get_qpus()

Gets the list of QPUs available on the server. These QPUs are a list of identifiers

from qat.qlmaas import QLMaaSConnection

conn = QLMaaSConnection()
available_qpus = conn.get_qpus()
Returns

list of QPUs available on the server

Return type

list<ServiceDescription>

open_prompt()

Drops in a qlmaas interactive tool. Please refer to the section prompt to get more information on the prompt interactive tool

save_certificate(certificate: str)

Save an SSL certificate as authentication parameter

Note

Calling this function will udpate the certificate linked to your profile on the server side. Logging with this certificate will then be enabled if your QLM administrator enabled this authentication method

Parameters

certificate (str) – path to the SSL certificate

save_ssl_dn(dn: Optional[str] = None, certificate: Optional[str] = None)

Save a distinguished name as authentication parameter. Either dn or certificate should be provided (not both!)

Note

Calling this function will update the DN lnked to your profile on the server. Logging with a trusted certificate will then be enabled if and only if:

  • your certificate is trusted (i.e. signed by a certificate authority approved by the server)

  • the QLM administrator allows you to login with a trusted certificate

Parameters
  • dn (str, optional) – distinguished name Default: None

  • certificate (str, optional) – path to the SSL certificate which DN should be used Default: None