Implement task update

This allows tasks to have their resources updated as they are running.

Fixes #1067

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-26 16:38:49 -07:00
parent 1f478be14d
commit f36e0193a4
15 changed files with 749 additions and 152 deletions

View File

@@ -451,6 +451,17 @@ func (s *Service) Checkpoint(ctx context.Context, r *api.CheckpointTaskRequest)
}, nil
}
func (s *Service) Update(ctx context.Context, r *api.UpdateTaskRequest) (*google_protobuf.Empty, error) {
t, err := s.getTask(ctx, r.ContainerID)
if err != nil {
return nil, err
}
if err := t.Update(ctx, r.Resources.Value); err != nil {
return nil, err
}
return empty, nil
}
func (s *Service) writeContent(ctx context.Context, mediaType, ref string, r io.Reader) (*types.Descriptor, error) {
writer, err := s.store.Writer(ctx, ref, 0, "")
if err != nil {