tac.platform package

Submodules

tac.platform.oef_health_check module

This script waits until the OEF is up and running.

class tac.platform.oef_health_check.OEFHealthCheck(oef_addr: str, oef_port: int, loop: Optional[asyncio.events.AbstractEventLoop] = None)

Bases: object

A health check class.

exception_handler(url=None, ex=None)

Handle exception during a connection attempt.

on_connect_ok(url=None)

Handle a successful connection.

on_connect_terminated(url=None)

Handle a connection failure.

run() → bool

Run the check, asynchronously.

Returns

True if the check is successful, False otherwise.

tac.platform.oef_health_check.main(oef_addr, oef_port)

Launch the health check.

tac.platform.simulation module

This module implements a TAC simulation.

It spawn a controller agent that handles the competition and several baseline agents that will participate to the competition.

It requires an OEF node running and a Visdom server, if the visualization is desired.

You can also run it as a script. To check the available arguments:

python -m tac.platform.simulation -h

class tac.platform.simulation.SimulationParams(oef_addr: str = 'localhost', oef_port: int = 10000, nb_baseline_agents: int = 10, register_as: tac.agents.participant.v1.base.strategy.RegisterAs = <RegisterAs.BOTH: 'both'>, search_for: tac.agents.participant.v1.base.strategy.SearchFor = <SearchFor.BOTH: 'both'>, services_interval: int = 1, pending_transaction_timeout: int = 120, verbose: bool = False, dashboard: bool = False, visdom_addr: str = 'localhost', visdom_port: int = 8097, data_output_dir: Optional[str] = 'data', version_id: str = '2942', seed: int = 42, nb_baseline_agents_world_modeling: int = 0, tac_parameters: Optional[tac.agents.controller.base.tac_parameters.TACParameters] = None)

Bases: object

Class to hold simulation parameters.

tac.platform.simulation.build_simulation_parameters(arguments: argparse.Namespace) → tac.platform.simulation.SimulationParams

From argparse output, build an instance of SimulationParams.

Parameters

arguments – the arguments

Returns

the simulation parameters

tac.platform.simulation.parse_arguments()

Arguments parsing.

tac.platform.simulation.run(params: tac.platform.simulation.SimulationParams) → None

Run the simulation.

Parameters

params – the simulation parameters

Returns

None

tac.platform.simulation.spawn_baseline_agents(params: tac.platform.simulation.SimulationParams) → List[multiprocessing.context.Process]

Spawn baseline agents.

Parameters

params – the simulation params.

Returns

the processes running the agents (as a list).

tac.platform.simulation.spawn_controller_agent(params: tac.platform.simulation.SimulationParams) → multiprocessing.context.Process

Spawn a controller agent.

Parameters

params – the simulation params.

Returns

the process running the controller.

Module contents

Contains the TAC platform package.