profit.run
Submodules
Package Contents
Classes
Helper class that provides a standard way to create an ABC using |
|
The Worker-Interface |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
- class profit.run.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',)]
- class profit.run.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
connect to the Runner-Interface
retrieve the input data and store it in .input
- class profit.run.Runner(*, interface: profit.run.interface.RunnerInterface = 'memmap', worker: Mapping = 'command', work_dir='.', debug=False, parallel=0, sleep=0.1, logfile='runner.log', logger=None)[source]
Bases:
profit.util.component.Component
Helper class that provides a standard way to create an ABC using inheritance.
- property config
- property input_data
- property output_data
- property flat_output_data
- classmethod from_config(run_config, base_config)[source]
Constructor from run config & base config dict
- abstract spawn(params=None, wait=False)[source]
spawn a single run
- Parameters:
params – a mapping which defines input parameters to be set
wait – whether to wait for the run to complete
- class profit.run.Worker(run_id: int, *, interface: profit.run.interface.WorkerInterface = 'memmap', debug=False, log_path='log', logger=None)[source]
Bases:
profit.util.component.Component
Helper class that provides a standard way to create an ABC using inheritance.
- classmethod wrap(label, outputs=None, inputs=None)[source]
``` @Worker.wrap(‘label’, [‘f’, ‘g’], [‘x’, ‘y’]) def func(x, y):
…
@Worker.wrap(‘label’, [‘f’, ‘g’]) def func(x, y):
…
@Worker.wrap(‘label’) def func(x, y) -> [‘f’, ‘g’]:
…
@Worker.wrap(‘name’, ‘f’, ‘x’) def func(x):
…
@Worker.wrap(‘name’) def func(x) -> ‘f’:
…
@Worker.wrap(‘name’) def f(x):
…