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

Implement and utilize countdown widget (for temporary deployments) #198

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

edan-bainglass
Copy link
Member

@edan-bainglass edan-bainglass commented Mar 4, 2025

This PR implement a count down widget for use in temporary deployments. The widget is added to the main notebook within a check for a demo-server-config.yml file.

To test, add ~/.aiidalab/demo-server-config.yml with duration: "##:##:##" in it. Try different times. In particular, try near 5 minutes to check the color change, and near 0 to see the final message.

Checking elapsed time is done via ps -o etime= -p 1, as suggested by @yakutovicha


image

image

image

@edan-bainglass
Copy link
Member Author

@superstar54 @mikibonacci can I get a review please? 🙏 Pinging @danielhollas also if he has time 🙂

Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @edan-bainglass , I missed the previous review request since I get flooded with hundreds of GitHub (action) emails daily. 🤣 .

See my comments below.

"\n",
"# For temporary deployments (e.g. demo server), duration is read from a local\n",
"# config file. This will initiate the countdown widget.\n",
"demo_server_config_file = Path.home() / \".aiidalab\" / \"demo-server-config.yml\"\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the QEapp, we don't want to hardcode the demo-server in the app, so I would suggest using aiidalab-home.yaml, or aiidalab.yaml directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this is explicitly for demo servers (not our demo server, but for demo servers)

start.ipynb Outdated
"demo_server_config_file = Path.home() / \".aiidalab\" / \"demo-server-config.yml\"\n",
"if demo_server_config_file.exists():\n",
" demo_server_config = safe_load(demo_server_config_file.read_text())\n",
" countdown = CountDownWidget(duration=demo_server_config.get(\"duration\", \"12:00:00\"))\n",
Copy link
Member

@superstar54 superstar54 Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • change duration to a better name, e.g., container_lifetime
  • if the lifetime does not set explicitly in the config file, the default value should be a very long time (e.g., 10 years), instead of 12:00:00.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, if the duration is not set in the config file, there should be no countdown widget deployed. I will adjust the conditional.

Comment on lines +234 to +236
if len(elapsed_str) < 6:
elapsed_str = f"00:{elapsed_str}"
elapsed_time = datetime.strptime(elapsed_str, "%H:%M:%S")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also consider time longer than one day, (maybe even months).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What use case are you thinking of here? I'm not trying to make this general. This is specifically for demo server deployments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that our current demo server only supports 12 hours, but since this is in the AiiDAlab-home, it should be more general, because other people may use this feature, or, we may use this feature in another deployment longer than 12 hours.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can update this for "other people" down the road. For now, this is fine for our use case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just more caution for the aiidalab-home because every time we make a new release, the docker image must be upgraded.

But OK to me if you intend to leave this for the future.

@danielhollas
Copy link
Contributor

@edan-bainglass can you provide screenshots of how this looks? Is the countdown displayed only in the home page?

@edan-bainglass
Copy link
Member Author

@edan-bainglass can you provide screenshots of how this looks? Is the countdown displayed only in the home page?

Updated description with images. And yes, only on the home page.

@edan-bainglass
Copy link
Member Author

@edan-bainglass can you provide screenshots of how this looks? Is the countdown displayed only in the home page?

Updated description with images. And yes, only on the home page.

Hi @danielhollas. Did you have a question or comment regarding this PR?

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

Successfully merging this pull request may close these issues.

3 participants