qat.plugins.AbstractPlugin
- class qat.plugins.AbstractPlugin(*args, **kwargs)
Abstract interface of a Plugin.
- post_process(batch_result)
A plugin can optionally post-process a result. Post-processing consists of editing the
BatchResult
object returned by the QPUNote
If your plugin does not require prost-processing, not defining this method would lead to better performances
- Parameters:
batch_result (BatchResult) – object to be post-processed
- Returns:
post-processed
BatchResult
- Return type:
- abstract compile(batch, specs)
Compiles a Batch into another Batch according to some hardware specs
- Parameters:
batch (
Batch
) – batch to compilespecs (
HardwareSpecs
) – hardware specs
- Returns:
compiled batch
- Return type:
- do_post_processing()
Returns True iff the results need to be aggregated/post processed via the plugin.
- Returns:
Is post-processing needed?
- Return type:
bool
- serve(port, host_ip='localhost', server_type=None, ssl_cert: str = None, ssl_key: str = None, ssl_ca: str = None)
Runs the plugin 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