profit.run.interface

Runner-Worker Interface

The Interface is responsible for the data transfer between the Runner and all Workers. Each Interface consists of two components: a Runner-Interface and a Worker-Interface

Module Contents

Classes

RunnerInterface

Helper class that provides a standard way to create an ABC using

WorkerInterface

The Worker-Interface

class profit.run.interface.RunnerInterface(size, input_config, output_config, *, logger_parent: logging.Logger = None)[source]

Bases: profit.util.component.Component

Helper class that provides a standard way to create an ABC using inheritance.

property config
property size
internal_vars = [('DONE',), ('TIME',)]
resize(size)[source]
poll()[source]
clean()[source]
class profit.run.interface.WorkerInterface(run_id: int, *, logger_parent: logging.Logger = None)[source]

Bases: profit.util.component.Component

The Worker-Interface

The Worker-side of the Interface performs two tasks: retrieving input data and transmitting output data.

Only the Worker interacts directly with the Interface, following the scheme: ```

self.interface.retrieve() -> self.interface.input timestamp = time.time() self.interface.output = simulate() self.interface.time = int(time.time() - timestamp) self.interface.transmit()

```

property config
abstract retrieve()[source]

retrieve the input

  1. connect to the Runner-Interface

  2. retrieve the input data and store it in .input

abstract transmit()[source]

transmit the output

  1. transmit the output and time data (.output and .time)

  2. signal the Worker has finished

  3. close the connection to the Runner-Interface

clean()[source]