-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: main
Are you sure you want to change the base?
Conversation
@superstar54 @mikibonacci can I get a review please? 🙏 Pinging @danielhollas also if he has time 🙂 |
There was a problem hiding this 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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
if len(elapsed_str) < 6: | ||
elapsed_str = f"00:{elapsed_str}" | ||
elapsed_time = datetime.strptime(elapsed_str, "%H:%M:%S") |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@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? |
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
withduration: "##:##:##"
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