MorphoCloud / MorphoCloudWorkflow

Reusable GitHub Workflows to manage JetStream2 backed on-demand virtual machines
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Give an active user the option of extending their session for another 4h #35

Closed muratmaga closed 2 weeks ago

muratmaga commented 2 months ago

Allow people to continue working with the instance, and skip the auto-shelving at 4h.

jcfr commented 1 month ago

User will be presented with a popup like the following:

image

To show the dialog from the self-hosted runner using SSH:

instance_ip=X.X.X.X
ssh \
  -o StrictHostKeyChecking=no \
  -o UserKnownHostsFile=/dev/null \
  -o LogLevel=ERROR \
  exouser@$instance_ip \
    'export DISPLAY=:1 && zenity --question --timeout=60 --title="Automatic Instance Shelving" --text="Instance will be shelved in ~30 minutes.\n\nWould you like to keep the instance running for an additinal 4 hours?" --ok-label="Yes" --cancel-label="No"'

To show the dialog directly from the instance:

export DISPLAY=:1 && \
zenity \
  --question \
  --timeout=60 \
  --title="Automatic Instance Shelving" \
  --text="Instance will be shelved in ~30 minutes.\n\nWould you like to keep the instance running for an additinal 4 hours?" --ok-label="Yes" --cancel-label="No"
muratmaga commented 1 month ago

any updates on this?

jcfr commented 2 weeks ago

I have a working protoype and will integrate shortly.

Existing instance will also be gracefully handled (current mechanism will apply), the question will be asked only in the context of newly created instance.

jcfr commented 2 weeks ago

This feature improves the user experience by allowing active users to extend their session by 4 hours. It has been implemented and deployed across multiple projects:

  1. exosphere
  2. MorphoCloudWorkflow
  3. MorphoCloudInstances

exosphere

MorphoCloudWorkflow

MorphoCloudInstances

User Notification Preview

The user notification is triggered by the following cron job:

# Ansible: Ask user for instance shelving extension
*/5 * * * * /home/exouser/dist/check-instance-shelve.sh -a

The cron job runs the script every 5 minutes, prompting active users to extend their session before automatic shelving occurs. Below is a preview of the notification:

image
muratmaga commented 2 weeks ago

I am sure this is working, but displaying the message is only for 5 minutes is not going to work well. I missed it yesterday while stepped out for a thing... Can you display until a response is received or the for 30 minutes (whichever is sooner)?

jcfr commented 2 weeks ago

To follow up on @muratmaga comment shared by email:

And also I am still not seeing it pop up. So that 5 minutes is very restrictive. I might just have gone to have coffee and miss it.

It turns out there was an issue with the script, the fix (https://github.com/MorphoCloud/exosphere/commit/620f82fdf19ff4a42ac324b4710d72039d1e6331) is currently being tested in jcfr/MorphoCloudPortal and will deployed later to MorphoCloudInstances

jcfr commented 2 weeks ago

To follow up on @muratmaga comment shared by email:

I suggest making this file hidden and maybe put it under ~exouser/.local/ If they delete it for one reason or another, it will break things.

Ditto. As a first step, I will improve the script to simply create the file if doesn't exist.

As a second step, we should then address:

jcfr commented 2 weeks ago

To follow-up on @muratmaga comment shared by email:

Is there any reason you can keep it until a response is recorder, or it times out?

After integrating the fix referenced in https://github.com/MorphoCloud/MorphoCloudWorkflow/issues/35#issuecomment-2435769518, the popup will keep being displayed until the user either click "Yes" or the instance is shelved. So this should not be an issue.

jcfr commented 2 weeks ago

The fix ensuring the script check-instance-shelve.sh works has been deployed to the MorphoCloudInstances project through https://github.com/MorphoCloud/MorphoCloudInstances/commit/445198ffe212396dd3993df2302ddb8c52828112

muratmaga commented 1 week ago

This seems to work well now, thank you.

Going forward, would it be possible to implement this as little widget that sits on the top menu bar like countdown, from which they can renew the session whenever they want.

Screenshot 2024-10-29 at 11 15 58 AM

If you think it is feasible (i.e., won't require extensive development time), I will open a separate issue to track.