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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow idle timeout to be set on Notebook Instances (Vertex AI Workbench) #15654

Open
oscar-barlow opened this issue Aug 29, 2023 · 9 comments
Open

Comments

@oscar-barlow
Copy link

oscar-barlow commented Aug 29, 2023

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

Leaving notebook VMs running when they're not being actively used is a waste of money, so GCP offer an 'idle timeout' configuration option in the Vertex Workbench console. It would be really helpful to be able to configure this in Terraform, to save money.

New or Affected Resource(s)

  • google_notebooks_instance

Potential Terraform Configuration

resource "google_notebooks_instance" "instance" {
  name = "notebooks-instance"
  location = "us-west1-a"
  machine_type = "e2-medium"
  idle_shutdown = 60 # 1 hour in minutes
  vm_image {
    project      = "deeplearning-platform-release"
    image_family = "tf-latest-cpu"
  }
}

b/299312211

@github-actions github-actions bot added forward/review In review; remove label to forward service/notebooks labels Aug 29, 2023
@rileykarson rileykarson added size/s and removed forward/review In review; remove label to forward labels Sep 5, 2023
@rileykarson rileykarson added this to the Goals milestone Sep 5, 2023
@rileykarson
Copy link
Collaborator

This may be managed through the unstructuredmetadata field. That's how it looks like it's done in the v2 API, at least, snippet from a REST response:

        "metadata": {
          "idle-timeout-seconds": "10800",
... other entries ...
        },

@mahvar
Copy link

mahvar commented Dec 22, 2023

@rileykarson Is that already doable via metadata?

@enlightenalpha
Copy link

Can confirm that the metadata approach described above worked for me:

"metadata": { "idle-timeout-seconds": "10800" }

@bcreddy-gcp
Copy link

@rileykarson Is there some documentation that'll help the users discover this better? Seems to be a very common question. Otherwise this ticket can be closed.

@bcreddy-gcp
Copy link

Documentation has been added here: https://cloud.google.com/vertex-ai/docs/workbench/instances/idle-shutdown

@markustoivonen
Copy link

Sorry if this is a stupid question but is the correct syntax?

resource "google_workbench_instance" "workbench_instance_test" {
  ...
  metadata = {
    idle-timeout-seconds = 1000
  }

Also, would it be possible to add the information to the resource documentation, considering that this is a new feature, and something that is new at least for those who are migrating from user managed notebooks.

@bcreddy-gcp
Copy link

bcreddy-gcp commented Feb 1, 2024

Here's the syntax:

resource "google_workbench_instance" "workbench_instance_test" {
  ...
  metadata = {
    idle-timeout-seconds = "10800"
  }

@sonnysideup
Copy link

This worked for me as well. Thanks for the tip.

@codrinsah
Copy link

I haven't seen this mentioned yet, but if a notebook's idle timeout was already set e.g.

metadata = {
  idle-timeout-seconds = "10800"
}

In order to disable the idle timeout, you need to set the metadata to an empty string (not null or removing it!) like so:

metadata = {
  idle-timeout-seconds = ""
}

I noticed that simply removing it would not change the setting of the notebook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants