mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
executor: implement streaming stats API
plugins/driver: update driver interface to support streaming stats client/tr: use streaming stats api TODO: * how to handle errors and closed channel during stats streaming * prevent tight loop if Stats(ctx) returns an error drivers: update drivers TaskStats RPC to handle streaming results executor: better error handling in stats rpc docker: better control and error handling of stats rpc driver: allow stats to return a recoverable error
This commit is contained in:
@@ -496,13 +496,13 @@ func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error) {
|
||||
return handle.TaskStatus(), nil
|
||||
}
|
||||
|
||||
func (d *Driver) TaskStats(taskID string) (*drivers.TaskResourceUsage, error) {
|
||||
func (d *Driver) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error) {
|
||||
handle, ok := d.tasks.Get(taskID)
|
||||
if !ok {
|
||||
return nil, drivers.ErrTaskNotFound
|
||||
}
|
||||
|
||||
return handle.exec.Stats()
|
||||
return handle.exec.Stats(ctx, interval)
|
||||
}
|
||||
|
||||
func (d *Driver) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error) {
|
||||
|
||||
Reference in New Issue
Block a user