Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How can I bump autostop to leave room for long-running scripts? #15515

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

Closed
bpmct opened this issue Nov 14, 2024 · 6 comments Β· Fixed by #15895
Closed

How can I bump autostop to leave room for long-running scripts? #15515

bpmct opened this issue Nov 14, 2024 · 6 comments Β· Fixed by #15895
Assignees
Labels
customer-reported Bugs reported by enterprise customers. Only humans may set this. needs-triage Issue that require triage

Comments

@bpmct
Copy link
Member

bpmct commented Nov 14, 2024

We currently have documentation for using the REST API to imitate session activity to bump the workspace if a script is not working, but we have seen some reports of this not working.

Similarly, the coder schedule override-stop does not work if a policy is set on the template for autostop. Can we spend some cycles to have a revised opinion on how to recommend users keep the workspace running if they have, for example, a training job running?

Some ideas:

  • Introduce a coder schedule bump CLI command
  • Improved visibility in UI (a customer reported the autostop warning UI only shows up when the workspace hits the deadline, not always)
  • verify the endpoint and/or update the docs
@bpmct bpmct added the customer-reported Bugs reported by enterprise customers. Only humans may set this. label Nov 14, 2024
@coder-labeler coder-labeler bot added the needs-triage Issue that require triage label Nov 14, 2024
@aaronlehmann
Copy link
Contributor

Specifically, the /extend endpoint doesn't work for us because it requires the "Allow users to customize autostop duration for workspaces" setting to be enabled. We don't want users to be able to customize the autostop duration, but do want to allow them to bump autostop when needed (up to the limit imposed by the template).

@aaronlehmann
Copy link
Contributor

After evaluating the implications of "Allow users to customize autostop duration for workspaces", we decided we're comfortable turning this on, so this ticket is no longer a high priority for me. Thanks, though!

@DanielleMaywood
Copy link
Contributor

DanielleMaywood commented Dec 6, 2024

As Aaron noted, the PUT /workspaces/{workspace}/extend endpoint verifies that the user has permission to modify their workspace's autostop.

coder/coderd/workspaces.go

Lines 1214 to 1218 in 9fe71d9

if !tmpl.AllowUserAutostop {
code = http.StatusBadRequest
resp.Message = "Cannot extend workspace: template does not allow user autostop."
return xerrors.New("cannot extend workspace: template does not allow user autostop")
}

I'm not sure the current approach makes the most sense. This endpoint doesn't provide the ability to extend the workspace's "MaxDeadline", meaning it doesn't enable a user to do anything they couldn't already do by just connecting to their workspace. Restricting users from calling this endpoint doesn't really solve anything I feel (from a point of cost-saving or otherwise).

@bpmct thoughts on this?

@bpmct
Copy link
Member Author

bpmct commented Dec 12, 2024

I'm not sure the current approach makes the most sense. This endpoint doesn't provide the ability to extend the workspace's "MaxDeadline", meaning it doesn't enable a user to do anything they couldn't already do by just connecting to their workspace. Restricting users from calling this endpoint doesn't really solve anything I feel (from a point of cost-saving or otherwise).

@bpmct thoughts on this?

Totally agree. I think the user should be able to hit this endpoint since it doesn't impact the max deadline. Being able to use this endpoint to keep the workspace running for a long script would be great.

Thoughts on also making/renaming a CLI command to coder schedule bump?

@DanielleMaywood
Copy link
Contributor

I think the cli command should probably mirror the api endpoint name.

Also I just checked the git blame of this area and it looks like a few months ago this check was added to resolve issue #13078

@stirby what are your thoughts on this?

@stirby
Copy link
Collaborator

stirby commented Dec 16, 2024

My opinion has changed; we should revert that check. These actions are around "activity bump" - a distinct feature from autostop.

All of the methods for simulating user activity should be executable by the user.

DanielleMaywood added a commit that referenced this issue Dec 18, 2024
Fixes #15515

This change effectively reverts the changes introduced by
#13182 (for
#13078).

We also rename the `override-stop` command name to `extend` to match the
API endpoint's name (keeping an alias to allow `override-stop` to be used).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Bugs reported by enterprise customers. Only humans may set this. needs-triage Issue that require triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants