github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/client/allocrunner/interfaces/runner.go (about) 1 package interfaces 2 3 import ( 4 "github.com/hashicorp/nomad/client/allocrunner/state" 5 cstructs "github.com/hashicorp/nomad/client/structs" 6 ) 7 8 // AllocRunner is the interface for an allocation runner. 9 type AllocRunner interface { 10 // ID returns the ID of the allocation being run. 11 ID() string 12 13 // Run starts the runner and begins executing all the tasks as part of the 14 // allocation. 15 Run() 16 17 // State returns a copy of the runners state object 18 State() *state.State 19 20 TaskStateHandler 21 } 22 23 // TaskStateHandler exposes a handler to be called when a task's state changes 24 type TaskStateHandler interface { 25 // TaskStateUpdated is used to notify the alloc runner about task state 26 // changes. 27 TaskStateUpdated() 28 } 29 30 // AllocStatsReporter gives acess to the latest resource usage from the 31 // allocation 32 type AllocStatsReporter interface { 33 LatestAllocStats(taskFilter string) (*cstructs.AllocResourceUsage, error) 34 }