Skip to content
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

Add backend.ai exec command to execute a shell command in a running session #283

Open
achimnol opened this issue Sep 6, 2021 · 0 comments
Labels
comp:agent Related to Agent component comp:cli Related to CLI component type:feature Add new features
Milestone

Comments

@achimnol
Copy link
Member

achimnol commented Sep 6, 2021

Currently backend.ai run command requires to specify a file to execute a shell command, due to a prior parsing limitation of Click with mixing required positional arguments and a zero-or-more positional argument.
This makes unnecessary confusion for new users and we feel also difficult to explain to them.

Let's make a new command, just like docker exec:

  • backend.ai [root-options] exec {session-id-or-name} {cmdargs...}
    • Following the new CLI command hierarchy (refactor: Make CLI commands consistent backend.ai-client-py#163), backend.ai exec should be an alias of backend.ai session exec.
    • The session ID or name may be a partial prefix of session ID or names, like in backend.ai rm.
    • This command does not create the session but raises an explicit error if it does not exist.
    • All the rest of arguments are passed as-is.

Considerations for implementing this feature in various client environments:

Client Env Command/Function Implementation detail
CLI backend.ai run --exec "<cmdargs>" <image> <files> session create API + kernel file upload API + batch-mode execution API
CLI backend.ai app <session> <appname> stream proxy API
CLI backend.ai ssh <session> <cmdargs> kernel file download API (to get ssh key) + alias of app command + wrapper of OpenSSH client
CLI backend.ai exec <session> <cmdargs> alias of ssh command
Browser Running a shell command in session batch-mode execution API

The advantage of making exec to be an alias of ssh is that it supports the full terminal and interactive stdin support through the SSH session. But in the web browsers we don't have the SSH client available for Javascript codes, so we need to fallback to use the batch-mode execution API.

@achimnol achimnol added type:feature Add new features comp:agent Related to Agent component comp:cli Related to CLI component labels Sep 6, 2021
@achimnol achimnol added this to the 21.09 milestone Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:agent Related to Agent component comp:cli Related to CLI component type:feature Add new features
Projects
None yet
Development

No branches or pull requests

1 participant