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 manifest.json file tracking for automatic updates #46

Merged
merged 7 commits into from
Mar 26, 2024

Conversation

AlyssaCote
Copy link
Collaborator

In this PR I added an if check within the update loop that checks to see if there have been changes to the manifest file. If there have been changes, the app reruns.

We wanted to add this because new runs can be added to the manifest as the SmartSim experiment progresses, and the new changes to the manifest file were not being displayed in the dashboard without the user refreshing the page or interacting with widgets.

Copy link
Member

@MattToast MattToast left a comment

Choose a reason for hiding this comment

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

A couple of small nit picks, lmk what you think!

Comment on lines +69 to +70
if manifest_reader.has_changed:
st.rerun()
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that I love the idea of restarting streamlit when we detect a change in the manifest. Is there some way we can move the reload of the manifest into the loop rather than just restarting the runtime?

Copy link
Member

Choose a reason for hiding this comment

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

It looks like we already have a dependency on watchdog. Maybe we can set up a file listener to fire a callback on the event the manifest file is touched? Otherwise, can we just move the logic to rebuild the manifest into the while True: loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Chris and I tried to get watchdog to work to monitor the user files and streamlit does not play nice with that at all. I'll check about rebuilding the manifest into the while True: loop, but I'm 99% sure the app still needs to rerun in order to have the manifest changes show up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Update: streamlit does need to rerun the app. We were trying to use watchdog to trigger a rerun of build_app, but streamlit behaves really strange when using watchdog for user files rather than their own files.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm... well that's unfortunate... I may halfheartedly look into it a bit myself when I get some time, but since since this refresh shouldn't be happening too often, I don't think its worth holding up approval over!!

smartdashboard/utils/ManifestReader.py Outdated Show resolved Hide resolved
Copy link
Member

@MattToast MattToast left a comment

Choose a reason for hiding this comment

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

A couple of last minute comments, but nothing worth holding up approval over. LGTM!!

Comment on lines +69 to +70
if manifest_reader.has_changed:
st.rerun()
Copy link
Member

Choose a reason for hiding this comment

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

Hmm... well that's unfortunate... I may halfheartedly look into it a bit myself when I get some time, but since since this refresh shouldn't be happening too often, I don't think its worth holding up approval over!!

@@ -64,9 +67,10 @@ def build_app(manifest_path: str) -> None:
)

while True:
if manifest_reader.has_changed:
st.rerun()
for v in to_update:
v.update()
Copy link

Choose a reason for hiding this comment

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

I was thinking about what might happen if the manifest changes a few times (app re-runs immediately with no sleep, which might be undesirable) and noticed that v.update is called for all views, regardless of visibility.

Considering the way streamlit re-runs when we navigate around, could we get a performance boost by avoiding extraneous updates? I wonder if we should add a ticket for adding a similar concept to the views

for example: for v in [x for x in to_update if x.visible]: v.update()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Love it! I'll work on a ticket for it

Copy link

@ankona ankona left a comment

Choose a reason for hiding this comment

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

Other than 100% subjective nitpicks about tests, this looks good to me.

@AlyssaCote AlyssaCote merged commit 2c2afb6 into CrayLabs:develop Mar 26, 2024
6 checks passed
@amandarichardsonn amandarichardsonn added type: feature Issues that include feature request or feature idea area: telemetry Issues related to dashboard telemetry repo: smartdashboard labels Apr 26, 2024
@AlyssaCote AlyssaCote changed the title Manifest file tracking Add manifest.json file tracking for automatic updates Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: telemetry Issues related to dashboard telemetry repo: smartdashboard type: feature Issues that include feature request or feature idea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants