qat.core.application.Application
- class qat.core.application.Application(generator, qpu)
An application is a class used to generate results. An application is composed of a BatchGenerator and of a QPU
Warning
This class is not designed to be instantiated by hand, but by piping a BatchGenerator to a QPU
- Parameters
generator (AbstractGenerator) – Batch generator
QPU (CommonQPU) – QPU
- execute(*args, **kwargs)
Executes the application (generates batches and executes them)
Arguments given to this method are passed to the
generate
method of the generatorNote
The first argument passed to
generate
is theHardwareSpecs
object returned by the QPU. Following arguments are those passed in argument of this function.- Returns
Any python object
- Return type
any
- serve(port, host_ip='localhost', server_type=None, ssl_cert: Optional[str] = None, ssl_key: Optional[str] = None, ssl_ca: Optional[str] = None)
Runs the application inside a server
- Parameters
port (int) – the port on which to listen
host_ip (str) – the url on which to publish the API. Optional. Defaults to ‘localhost’.
server_type (str, optional) –
type of server. The different types of server are:
”simple”: single-thread server, accepts one connection at a time (default server type)
”threaded”: multi-thread server, each connection starts a new thread
”pool”: multi-thread server, each connection runs in a thread, with a maximum of 10 running threads
”fork”: multi-process server, each connection runs in a new process
ssl_cert (str, optional) – path to the server SSL certificate (mandatory for SSL) Default: None
ssl_key (str, optional) – path to the server SSL key (mandatory for SSL) Default: None
ssl_ca (str, optional) – path to the server SSL certificate authority (only serves requests with signed certificates) Default: None