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 last_used to user workspaces #381

Open
iyannsch opened this issue Dec 3, 2024 · 3 comments
Open

Add last_used to user workspaces #381

iyannsch opened this issue Dec 3, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@iyannsch
Copy link

iyannsch commented Dec 3, 2024

Is your feature request related to a problem? Please describe.

We are currently writing a functionality to clean up old persistent workspaces that were not used for a longer time. Unfortunately, the workspace, the PCV, and the PV all only feature a CreationDate property but not when the resource was last accessed.
Using this information, we could not only delete workspaces that are older than 2 weeks but also implement more advanced eviction techniques.

Describe the solution you'd like

A new property on the workspace resource providing information about when it was last accessed or mounted to a session.

Describe alternatives you've considered

Only delete based on creation date

Cluster provider

No response

Additional information

No response

@iyannsch iyannsch added the enhancement New feature or request label Dec 3, 2024
@lucas-koehler
Copy link
Contributor

Thanks for the issue!
We discussed with the team and it is definitely a good idea to track the last "use" time of a workspace in its status.
In addition, we propose adding a second property that tracks whether the workspace is currently in use (i.e. a session is running for it). This status property could be named inUse, isUsed or isRunning. It should automatically be reset to false by the operator on session deletion (which also happens when a session times out).

@iyannsch
Copy link
Author

iyannsch commented Dec 4, 2024

Your proposed features would definitely make some processes a bit easier but might also add additional data transfers and load on the system by default.
In our use case (garbage collecting workspaces), we got the K8s API running anyways so we could simply add a check ourselves whether a session exists for a given workspace (assuming stable naming) 👍

@lucas-koehler
Copy link
Contributor

Your proposed features would definitely make some processes a bit easier but might also add additional data transfers and load on the system by default.

You are right that additional data needs to be transmitted. However, I think the impact on system load should be negligible. Updating a isRunning flag would only need status changes once a session is launched and once when it is stopped. Updating a boolean field for this IMO should not have a measurable impact on performance.

In our use case (garbage collecting workspaces), we got the K8s API running anyways so we could simply add a check ourselves whether a session exists for a given workspace (assuming stable naming) 👍

That is good to know :) However, I think long-term we should not depend on internal resources names being stable forever: We do not consider the names of temporary resources (i.e. a Session) as part of the API. Furthermore, names might be different than expected, e.g. due to truncation and/or character replacements.
In contrast information exposed via the resources themselves, and especially the REST service, is.

Another use case is that such a flag allows easy inspection/filtering of running workspaces for admins without writing custom code cross-referencing with running sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants