NotifierCommand
- class commands2.NotifierCommand(*args, **kwargs)[source]
Bases:
Command
A command that starts a notifier to run the given Callable periodically in a separate thread. Has no end condition as-is; either subclass it or use
commands2.Command.withTimeout()
orcommands2.Command.until()
to give it one.Warning
Do not use this class unless you are confident in your ability to make the executed code thread-safe. If you do not know what “thread-safe” means, that is a good sign that you should not use this class.
Creates a new NotifierCommand.
- Parameters:
toRun – the Callable for the notifier to run
period – the period at which the notifier should run, in seconds
requirements – the subsystems required by this command
- end(interrupted: bool)[source]
The action to take when the command ends. Called when either the command finishes normally, or when it interrupted/canceled.
Do not schedule commands here that share requirements with this command. Use
andThen()
instead.- Parameters:
interrupted – whether the command was interrupted/canceled