farm-ng-core
core.event_service_recorder Namespace Reference

Classes

class  EventServiceRecorder
 
class  RecorderService
 

Functions

str get_file_name_base ()
 
def service_command (_args)
 
def client_start_command (_args)
 
def client_stop_command (_args)
 
def record_command (_args)
 

Variables

 DEFAULT_TIMEZONE = timezone.utc
 
 parser = argparse.ArgumentParser()
 
 sub_parsers = parser.add_subparsers()
 
 service_parser = sub_parsers.add_parser("service")
 
 default
 
 func
 
 client_parser = sub_parsers.add_parser("start")
 
 record_parser = sub_parsers.add_parser("record")
 
 required
 
 True
 
 type
 
 args = parser.parse_args()
 

Detailed Description

# run the event_service which starts a simple test publisher
python -m farm_ng.core.event_service
# run the event_recorder which subscribes to the test publisher and records the events to a file
python -m farm_ng.core.event_service_recorder record --service-config=config.json --config-name=record_all foo
# note that the config file has an EventServiceConfig with name "record_all" which subscribes to the test publisher

# then try playing back log file:
python -m farm_ng.core.events_file_reader playback foo.0000.bin

# or try running the event_service_recorder in service mode:
# start the service
python -m farm_ng.core.event_service_recorder service --service-config config.json --service-name recorder

# in a separate terminal, start recording
python -m farm_ng.core.event_service_recorder start --service-config config.json  --service-name recorder
# then stop recording
python -m farm_ng.core.event_service_recorder stop --service-config config.json  --service-name recorder

Function Documentation

◆ client_start_command()

def core.event_service_recorder.client_start_command (   _args)

◆ client_stop_command()

def core.event_service_recorder.client_stop_command (   _args)

◆ get_file_name_base()

str core.event_service_recorder.get_file_name_base ( )
Returns the base name of the file.

The base name is the current date and time, and the host name.

Returns:
    str: the base name of the file.

Example:
    >>> get_file_name_base()
    '2021_08_31_15_54_00_000000_ubuntu'

◆ record_command()

def core.event_service_recorder.record_command (   _args)

◆ service_command()

def core.event_service_recorder.service_command (   _args)

Variable Documentation

◆ args

core.event_service_recorder.args = parser.parse_args()

◆ client_parser

core.event_service_recorder.client_parser = sub_parsers.add_parser("start")

◆ default

core.event_service_recorder.default

◆ DEFAULT_TIMEZONE

core.event_service_recorder.DEFAULT_TIMEZONE = timezone.utc

◆ func

core.event_service_recorder.func

◆ parser

core.event_service_recorder.parser = argparse.ArgumentParser()

◆ record_parser

core.event_service_recorder.record_parser = sub_parsers.add_parser("record")

◆ required

core.event_service_recorder.required

◆ service_parser

core.event_service_recorder.service_parser = sub_parsers.add_parser("service")

◆ sub_parsers

core.event_service_recorder.sub_parsers = parser.add_subparsers()

◆ True

core.event_service_recorder.True

◆ type

core.event_service_recorder.type