Add create/start to exec processes in shim

This splits up the create and start of an exec process in the shim to
have two separate steps like the initial process.  This will allow
better state reporting for individual process along with a more robust
wait for execs.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-07-31 11:26:21 -04:00
parent 2533bfeaaf
commit 63878d14ea
11 changed files with 749 additions and 249 deletions

View File

@@ -40,11 +40,13 @@ func (t *Task) Info() runtime.TaskInfo {
}
func (t *Task) Start(ctx context.Context) error {
_, err := t.shim.Start(ctx, empty)
_, err := t.shim.Start(ctx, &shim.StartRequest{
ID: t.id,
})
if err != nil {
err = errdefs.FromGRPC(err)
return errdefs.FromGRPC(err)
}
return err
return nil
}
func (t *Task) State(ctx context.Context) (runtime.State, error) {
@@ -116,6 +118,11 @@ func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runt
if _, err := t.shim.Exec(ctx, request); err != nil {
return nil, errdefs.FromGRPC(err)
}
if _, err := t.shim.Start(ctx, &shim.StartRequest{
ID: id,
}); err != nil {
return nil, errdefs.FromGRPC(err)
}
return &Process{
id: id,
t: t,