Skip to content

Common method for command execution #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #666
0x2b3bfa0 opened this issue Nov 24, 2021 · 0 comments
Open
Tracked by #666

Common method for command execution #291

0x2b3bfa0 opened this issue Nov 24, 2021 · 0 comments
Labels
dvc enhancement New feature or request p2-nice-to-have Low priority resource-task iterative_task TF resource

Comments

@0x2b3bfa0
Copy link
Member

0x2b3bfa0 commented Nov 24, 2021

It would be nice1 to have an Execute method to run commands in any of the active instances.

type Task interface {
Read(ctx context.Context) error
Create(ctx context.Context) error
Delete(ctx context.Context) error
Start(ctx context.Context) error
Stop(ctx context.Context) error
Push(ctx context.Context, source string) error
Pull(ctx context.Context, destination string) error

Loose ends

  • How to deal with parallelism?
    • Run the command on every instance and return a slice of results.
    • Allow users to specify an index in the range [0, parallelism[ and return an error if there aren't enough instances running to satisfy the requested index.
    • Allow users to list the running instances for a given task and select one of them to run the command on.
    • Pick a random instance every time. I had to include it. 😂

Draft proposal

  • Execute(instance uint16, input string, command ...string) (Result, error)

    • instance represents the instance index in the range [0, parallelism[; maybe we can use a string identifier instead.
    • input optionally, the standard input to feed the remote command with; "" will disable this function.
    • command is the slice of exec–like arguments; “no arguments” can default to sh or bash if appropriate.
    • Result is a struct containing
      • Standard output
      • Standard error
      • Exit code
  • ExecuteTTY(instance uint16, streams Streams, command ...string) error
    Same as above but with TTY and interactive streams, so it behaves like an ordinary SSH session. See kubectl exec for an example implementation.

Footnotes

  1. Not necessary because Integrate task resource #237 eliminates the need of SSH by implementing Standardize on logs and storage for communication #126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dvc enhancement New feature or request p2-nice-to-have Low priority resource-task iterative_task TF resource
Projects
None yet
Development

No branches or pull requests

2 participants