-
Notifications
You must be signed in to change notification settings - Fork 38
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
Check --await
and --timeout
interaction
#2124
Comments
Now we wait for ~120 seconds before saying I think we can go three ways:
I'm somewhere b/w /cc @fyrchik, @cthulhu-rider, @anikeev-yadro, @realloc, @acid-ant |
I vote for 3, we can specify in help value for default timeout |
I'd leave single timeout for the command since user doesn't care what's going on inside. Awaiting option just tells to finish successfully if container is persisted only, so it doesn't have any relation to timeout. With |
In previous implementation `--timeout` flag affected RPC timeouts only. Since from the user perspective each command (even async) is monolithic, it doesn't make sense to tune RPC timeout. On the contrary, the user understands the whole command timeout setting in the CLI. Build context with timeout in command's `Run` function. Use the context for all client operations. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
In previous implementation `--timeout` flag affected RPC timeouts only. Since from the user perspective each command (even async) is monolithic, it doesn't make sense to tune RPC timeout. On the contrary, the user understands the whole command timeout setting in the CLI. Build context with timeout in command's `Run` function. Use the context for all client operations. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
|
IMO, the best for us is |
|
There is a need to limit execution time of some commands. In Cobra CLI, the best way to do this is to set command context with timeout. Add `commonflag.AcceptTimeout` function over `cobra.Command` which registers `--timeout` flag and precedes `Run` call with time limited context setting. As before, timeout defaults to 15s. Refs nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
After recent changes, each command has context with particular global timeout. There is a need to perform network communication within this context. Make `client.GetSDKClient` function to accept `context.Context`. Pass context parameter to the `client.Client.Dial()`. Make deadline of client call and single stream message to the context deadline. Make `client.GetSDKClientByFlag` to pass underlying `cobra.Command.Context()` to `GetSDKClient`. Refs nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously internal NeoFS API client used by CLI used context without deadline. Since some of the commands are time limited, there is a need to execute client operations within particular context. Add `context.Context` parameter to all op functions of internal client package. Pass `cobra.Command.Context()` to them in all `Run` scripts. Refs nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously some NeoFS CLI commands like `container create` waited for the operation persistence for a fixed period of time, decoupled from the command timeout specified by `--timeout` flag. The wait process should terminate when the command timeout expires. Use command context as a waiting stop in contract write ops (`put`, `delete`, `set-eacl`). Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously internal NeoFS API client used by CLI used context without deadline. Since some of the commands are time limited, there is a need to execute client operations within particular context. Add `context.Context` parameter to all op functions of internal client package. Pass `cobra.Command.Context()` to them in all `Run` scripts. Refs nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously some NeoFS CLI commands like `container create` waited for the operation persistence for a fixed period of time, decoupled from the command timeout specified by `--timeout` flag. The wait process should terminate when the command timeout expires. Use command context as a waiting stop in contract write ops (`put`, `delete`, `set-eacl`). Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously some NeoFS CLI commands like `container create` waited for the operation persistence for a fixed period of time, decoupled from the command timeout specified by `--timeout` flag. The wait process should terminate when the command timeout expires. Use command context as a waiting stop in contract write ops (`put`, `delete`, `set-eacl`). Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
After recent changes, each command has context with particular global timeout. There is a need to perform network communication within this context. Make `client.GetSDKClient` function to accept `context.Context`. Pass context parameter to the `client.Client.Dial()`. Make deadline of client call and single stream message to the context deadline. Make `client.GetSDKClientByFlag` to pass underlying `cobra.Command.Context()` to `GetSDKClient`. Refs nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously internal NeoFS API client used by CLI used context without deadline. Since some of the commands are time limited, there is a need to execute client operations within particular context. Add `context.Context` parameter to all op functions of internal client package. Pass `cobra.Command.Context()` to them in all `Run` scripts. Refs nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously some NeoFS CLI commands like `container create` waited for the operation persistence for a fixed period of time, decoupled from the command timeout specified by `--timeout` flag. The wait process should terminate when the command timeout expires. Use command context as a waiting stop in contract write ops (`put`, `delete`, `set-eacl`). Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Some CLI commands like `container create` are async-await. Previously, default execution timeout was 15s for such commands. Since more than one RPC is needed for theses commands (e.g. creation request and polling), there is a need to increase default timeout in waiting mode. Add `GetCommandContextWithAwait` and use it in `create`, `delete` and `set-eacl` commands of `container` section. Make command to time out after 1m if `--await` flag is set while `--timeout` one is omitted. Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Some CLI commands like `container create` are async-await. Previously, default execution timeout was 15s for such commands. Since more than one RPC is needed for theses commands (e.g. creation request and polling), there is a need to increase default timeout in waiting mode. Add `GetCommandContextWithAwait` and use it in `create`, `delete` and `set-eacl` commands of `container` section. Make command to time out after 1m if `--await` flag is set while `--timeout` one is omitted. Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Some CLI commands like `container create` are async-await. Previously, default execution timeout was 15s for such commands. Since more than one RPC is needed for theses commands (e.g. creation request and polling), there is a need to increase default timeout in waiting mode. Add `GetCommandContextWithAwait` and use it in `create`, `delete` and `set-eacl` commands of `container` section. Make command to time out after 1m if `--await` flag is set while `--timeout` one is omitted. Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Some CLI commands like `container create` are async-await. Previously, default execution timeout was 15s for such commands. Since more than one RPC is needed for theses commands (e.g. creation request and polling), there is a need to increase default timeout in waiting mode. Add `GetCommandContextWithAwait` and use it in `create`, `delete` and `set-eacl` commands of `container` section. Make command to time out after 1m if `--await` flag is set while `--timeout` one is omitted. Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Some CLI commands like `container create` are async-await. Previously, default execution timeout was 15s for such commands. Since more than one RPC is needed for theses commands (e.g. creation request and polling), there is a need to increase default timeout in waiting mode. Add `GetCommandContextWithAwait` and use it in `create`, `delete` and `set-eacl` commands of `container` section. Make command to time out after 1m if `--await` flag is set while `--timeout` one is omitted. Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Some CLI commands like `container create` are async-await. Previously, default execution timeout was 15s for such commands. Since more than one RPC is needed for theses commands (e.g. creation request and polling), there is a need to increase default timeout in waiting mode. Add `GetCommandContextWithAwait` and use it in `create`, `delete` and `set-eacl` commands of `container` section. Make command to time out after 1m if `--await` flag is set while `--timeout` one is omitted. Closes nspcc-dev#2124. Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Check how they interact and describe the behavior.
Maybe add
--await-timeout
The text was updated successfully, but these errors were encountered: