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
execute(*args, **kwargs)

Executes the application (generates batches and executes them)

Arguments given to this method are passed to the generate method of the generator

Note

The first argument passed to generate is the HardwareSpecs 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)

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