Router Commands¶
Classes¶
The Daemon Class¶
-
class
tgt_grease.router.Commands.Daemon.
DaemonProcess
(ioc)¶ Bases:
object
Actual daemon processing for GREASE Daemon
-
ioc
¶ The Grease IOC
Type: GreaseContainer
-
current_real_second
¶ Current second in time
Type: int
-
registered
¶ If the node is registered with MongoDB
Type: bool
-
impTool
¶ Instance of Import Tool
Type: ImportTool
-
conf
¶ Prototype Configuration Instance
Type: PrototypeConfig
-
contextManager
= {'jobs': {}, 'prototypes': {}}¶
-
current_real_second
= None
-
drain_jobs
(JobCollection)¶ Will drain jobs from the current context
This method is used to prevent abnormal ending of executions
Parameters: JobCollection (pymongo.collection.Collection) – Job Collection Object Returns: When job queue is emptied Return type: bool
-
impTool
= None
-
ioc
= None
-
log_once_per_second
(message, level=10, additional=None)¶ Log Message once per second
Parameters: - message (str) – Message to log
- level (int) – Log Level
- additional (object) – Additional information that is able to be str’d
Returns: Void Method to fire log message
Return type: None
-
register
()¶ Attempt to register with MongoDB
Returns: Registration Success Return type: bool
-
registered
= True
-
server
()¶ Server process for ensuring prototypes & jobs are running
By Running this method this will clear the DB of any jobs a node may have
Returns: Server Success Return type: bool
-
Commands¶
daemon¶
-
class
tgt_grease.router.Commands.DaemonCmd.
Daemon
¶ Bases:
tgt_grease.core.Types.Command.Command
Daemon Class for the daemon
-
execute
(context)¶ Base Execute Method
This method should always be overridden in child classes. This is the code that will run when your command is called. If this method is not implemented then the class will fail loading.
Parameters: context (dict) – context for the command to use Returns: Command Success Return type: bool
-
help
= '\n Provide simple abstraction for daemon operations in GREASE\n \n Args:\n install\n install the daemon on the system \n start\n start the daemon\n stop\n stop the daemon\n run\n run the daemon in the foreground \n \n --loop:<int>\n Number of cycles to run the daemon\n --foreground\n If provided this will print log messages into the foreground\n \n '¶
-
install
()¶ Handle Daemon Installation based on the platform we’re working with
Returns: installation success Return type: bool
-
purpose
= 'Control Daemon Processing in GREASE'¶
-
run
(loop=None)¶ Actual running of the daemon
Parameters: loop (int) – Amount of cycles the daemon should run for Returns: Server running state Return type: bool
-
start
()¶ Starting the daemon based on platform
Returns: start success Return type: bool
-
stop
()¶ Stopping the daemon based on the platform
Returns: stop success Return type: bool
-
help¶
-
class
tgt_grease.router.Commands.HelpCmd.
Help
¶ Bases:
tgt_grease.core.Types.Command.Command
The Help Command for GREASE
Meant to provide a rich CLI Experience to users to enable quick help
-
execute
(context)¶ Base Execute Method
This method should always be overridden in child classes. This is the code that will run when your command is called. If this method is not implemented then the class will fail loading.
Parameters: context (dict) – context for the command to use Returns: Command Success Return type: bool
-
help
= '\n Provide help information to users of GREASE about available commands. This though\n is just a demo of what you could print. Really it could be anything I suppose!\n \n Args:\n None\n '¶
-
purpose
= 'Provide Help Information'¶
-