swergio_toolbox package
swergio_toolbox.objects module
- class swergio_toolbox.objects.MutableBool(value=False)[source]
Bases:
MutableObject
A class representing a mutable boolean value.
- Parameters:
value (bool) – The initial value of the boolean.
- class swergio_toolbox.objects.MutableNumber(value=0)[source]
Bases:
MutableObject
A class representing a mutable number value.
- Parameters:
value (int or float) – The initial value of the number.
swergio_toolbox.swarm_control module
- class swergio_toolbox.swarm_control.Component(filepath, envpath=None, delay=None, terminal_cmd=None, python_cmd='python')[source]
Bases:
object
A class representing a component that can be started and stopped.
- Parameters:
filepath (str) – The file path of the component.
envpath (str) – Path to environment used to execute python or julia code.
delay (int or float) – The delay in seconds before starting the component.
terminal_cmd (str) – Command used to start the component in a terminal. When None no terminal is used.
python_cmd (str) – Command to run python file. Default “python”.
- Variables:
filepath (str) – The file path of the component.
envpath (str) – Path to environment used to execute python or julia code.
delay (int or float) – The delay in seconds before starting the component.
process (subprocess.Popen) – The subprocess object representing the running component.
terminal_cmd (str) – Command used to start the component in a terminal. When None no terminal is used.
python_cmd (str) – Command to run python file. Default “python”.
- class swergio_toolbox.swarm_control.Swarm(config_file=None)[source]
Bases:
object
A class representing a swarm of components that can be started and stopped as a group.
- Parameters:
config_file (str) – The file path of the configuration file.
- Variables:
config (dict) – The configuration for the swarm.
components (dict) – The components in the swarm.
- add(name, filepath, envpath=None, delay=None, terminal_cmd=None, python_cmd='python')[source]
Add a new component to the swarm.
- Parameters:
name (str) – The name of the new component.
filepath (str) – The file path of the new component.
envpath (str) – Path to environment used to execute python or julia code.
delay (int or float) – The delay in seconds before starting the new component.
terminal_cmd (str) – Command used to start the component in a terminal. When None no terminal is used. If terminal_cmd is “”, the terminal_cmd of the swarm will be used.
python_cmd (str) – Command to run python file. Default “python”. If python_cmd is “”, the python_cmd of the swarm will be used.
- Returns:
None