optimizer_server module

The module optimizer_server implements the connection to Optimizer server.

class optimizer_server.Optimizer(server, port)

Bases: object

This class contains attributes and methods for connecting to a running Optimizer server, optimizing commands and queries, returning the result queries to be executed by Secondo.

__init__(server, port)

The constructor of the calss Optimizer.

Parameters
  • server – The IP-address of Optimizer server.

  • port – The port number of the socket.

Returns

None.

close()

This method closes the connections to Optimizer server.

async connect()

This method connects to Optimizer server using asyncio methods and sets the connection, stream- reader and writer attributes of the Optimizer class.

get_opt_conn()

This method returns the connection attribute of Optimizer object.

Returns

The connection attribute of Optimizer object.

get_opt_initialized()
get_opt_streams()

This method returns the stream reader/ writer attributes of Optimizer object.

Returns

The stream reader/ writer attributes of Optimizer object.

get_port()

This method returns the port attributes of Optimizer object. :return: The port attributes of Optimizer object, which consists of an integer number as port eg. 5678.

get_server()

This method returns the server attributes of Optimizer object.

Returns

The server attributes of Optimizer object, which consists of an IP-address eg. 127.0.0.0.

set_opt_initialized(val)

This method sets an attribute of Optimizer object that shows if the Optimizer is initialised and running. :param initialized: A boolean value, when True means the Optimizer is initialised and running.