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 QPU

Note

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

BatchResult

abstract compile(batch, specs)

Compiles a Batch into another Batch according to some hardware specs

do_post_processing()

Returns True iff the results need to be aggregated/post processed via the plugin.

serve(port, host_ip='localhost', server_type=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