qlmaas

The qlmaas module is used to instantiate a remote QPU or a remote Plugin in a easier way. This module require a configuration file (please refer to this section of the User Guide to create a configuration file).

This module is used to instantiate Plugins and QPUs using a code very close to something you may have written directly using Qaptiva.

Note

Please note that creating a QLMaaSConnection object, even if there is no configuration file on your computer, will enable the qlmaas module.

This module is composed of few submodules one can used to import objects available on the server side

Remote QPUs, Plugins, Generators and Jobs

Qaptiva Access provides several modules to create remote objects or to extract information from the server. These modules are used to:

  • The qlmaas.qpus module to import remote QPUs

  • The qlmaas.plugins module to import remote Plugins

  • The qlmaas.generators module to import remote Generators

  • The qlmaas.jobs module to load submitted jobs. Objects imported using this module are used to download a result, get status of a job, …

  • The qlmaas.utils module to import useful functions

Importing arbitrary (remote) objects with Qaptiva Access

Some Qaptiva functions are decorated in order to be available from Qaptiva Access. These functions can be imported directly from the module that it is defined in Qaptiva.

# Import a decorated function on the server
from qlmaas.my_module import my_function
# Import local function
from qat.my_module import my_function

Similarly, pure Qaptiva objects can be imported (but not directly used) using this module. These objects are seen as placeholder useable within a Qaptiva Access stack. They can also be imported directly from the module that it is defined in Qaptiva.

# Import an object declared as an Importable on the server
from qlmaas.my_module import MY_OBJECT
# Import local object
from qat.my_module import MY_OBJECT

To retrieve the list of applications and importables that are exposed in an module on the server, the method get_importables_in_module() can be called.

Content of qat.my_module
"""
File "qat.my_module"
This file define a function importable remotly and a placeholder object
"""

from qat.core.application import application

__qlmaas_importable__ = ["MY_OBJECT"]


@application
def my_function(*args, **kwargs):
    """
    Function useable from Qaptiva Access
    """


# This object is importable from Qaptiva Access
# One can use this object as argument of "my_function", even from
# Qaptiva Access
MY_OBJECT = ...