Documentation ¶
Overview ¶
Package event standardizes communication of events from Lucifer commands.
Events are sent by printing to stdout.
Changes must be backward compatible with handlers. Currently, there is a handler for Skylab (skylab_swarming_worker) and one for Autotest (job_reporter). The Autotest handler is implemented with the Python eventlib module.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Send ¶
func Send(e Event)
Send sends an event by printing to stdout.
Example ¶
Send(Starting) Send(Completed)
Output: starting completed
func SendWithMsg ¶
SendWithMsg sends an event with a message by printing to stdout. The message should not contain newlines, non-ASCII characters, non-printable characters, or trailing whitespace.
Example ¶
SendWithMsg(Starting, "some message")
Output: starting some message
Types ¶
type Event ¶
type Event string
Event is a string enum type for valid events to pass to Send and SendWithMsg. Handler functions should be able to handle all of these.
const ( // Starting indicates that the task is beginning to run. Starting Event = "starting" // The following events indicate task status. The handler may // use these to track task status. Provisioning Event = "provisioning" Running Event = "running" Gathering Event = "gathering" Parsing Event = "parsing" Aborted Event = "aborted" // Completed indicates that the task has completed. The // handler may run any post-task logic on receiving this // event. Completed Event = "completed" )
Task status events.
const ( // HostClean indicates that the host is ready to run tests and // that it is clean. The handler should mark the host as not // dirty if the handler is tracking host dirtiness. HostClean // should be considered a superset of HostReady. HostClean Event = "host_clean" HostFailedRepair Event = "host_failed_repair" HostNeedsCleanup Event = "host_needs_cleanup" HostNeedsRepair Event = "host_needs_repair" HostNeedsReset Event = "host_needs_reset" // HostReady indicates that the host is ready to run tests. // HostReady should not be sent together with HostClean. HostReady Event = "host_ready" // HostReadyToRun indicates that the host is ready to run // tests, after provisioning and before running tests as part // of a Lucifer task. This is a transitory state, not a final // state like HostReady. HostReadyToRun Event = "host_ready_to_run" // HostRunning indicates that the host is running a test. The // handler may mark the host as dirty if the handler is // tracking host dirtiness. HostRunning Event = "host_running" // HostNeedsDeploy indicates that the host fails the deploy task and needs // to be deployed again. HostNeedsDeploy Event = "host_needs_deploy" // HostNeedsManualRepair indicates that the host required manual attention // to be fixed. HostNeedsManualRepair Event = "host_needs_manual_repair" // HostNeedsReplacement indicates that the host is not fixable due issues // with hardware and has to be replaced. HostNeedsReplacement Event = "host_needs_replacement" )
Host status events.