def main(args: argparse.Namespace): """Entry point. """ # Set run context. network_id = factory.create_network_id(args.network) node_id = factory.create_node_id(network_id, args.node) ctx = factory.create_run_context(args=Arguments.create(args), network_id=network_id, node_id=node_id, run=args.run, run_type=constants.TYPE) # Flush previous cache data. cache.flush_run(ctx) # Initialise MQ broker. mq.initialise() # Import actors. import stests.generators.correlator import stests.generators.wg_100.phase_1 import stests.generators.wg_100.phase_2 import stests.generators.wg_100.step_incrementor # Start workflow. logger.log("... workload generator begins") # Execute first actor in pipeline. from stests.generators.wg_100.step_incrementor import PIPELINE PIPELINE[0].send(ctx)
def _setup(output_mode: OutputMode): """Perform setup tasks standard to all workers. """ # Initialise logging. logging.initialise(output_mode) # Initialise message broker. mq.initialise() # Initialise message encoder. encoder.initialise()
def _import_actors(): """Import actors used during launch. """ # Initialise broker. from stests.core import mq mq.initialise() # Initialise encoder. from stests.core.mq import encoder encoder.initialise() # Import actors: generators. import stests.generators.wg_100.meta import stests.generators.wg_101.meta import stests.generators.wg_110.meta import stests.generators.wg_111.meta import stests.generators.wg_200.meta import stests.generators.wg_201.meta import stests.generators.wg_210.meta import stests.generators.wg_211.meta
# Import MQ sub-package & initialise. from stests.core import mq mq.initialise() # Import monitoring. import stests.monitoring.chain # Import correlator. import stests.generators.correlator # Import WG-100. import stests.generators.wg_100.args import stests.generators.wg_100.step_incrementor import stests.generators.wg_100.phase_1 import stests.generators.wg_100.phase_2
from stests.core import cache from stests.core import mq from stests.core.utils import factory # Initialise MQ sub-package. mq.initialise(mq.BrokerMode.MONITORS) from stests.monitoring.chain import do_monitor_blocks # Iterate networks & wire upto streaming events. for network in cache.get_networks(): network_id = factory.create_network_id(network.name) do_monitor_blocks.send(network_id)