-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow scripts to be cancelable #274
Conversation
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.
Couple comments/questions.
I've noted two issues in running locally. First, canceling during pyodide initialization--specifically while loading modules--doesn't always exit cleanly; my first time out the gate I wound up with something half-loaded leading to a broken import on subsequent runs that could only be fixed by refreshing the page.
Second, I'm not sure if it's related to present changes or not, but I'm seeing situations where the "Run Sampling" button goes to a disabled state and the compiled stan program never loads. I'm not seeing anything in console about it and I'm not sure I can reproduce it super consistently--just refreshed and it's still going on with the stock linear regression model while connected to the public compile server...
console.warn( | ||
"SharedArrayBuffer is not available, interrupting the Pyodide worker will not work", | ||
); |
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.
Seems like this message isn't quite right--as I understand you can still interrupt it, you're just killing the worker (and will have to reload pyodide in that 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.
Well, I guess you can no longer cancel the R scripts.
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.
Yes, though whether or not we even should provide this worker-killing fallback is an open question to me. What do you think?
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.
Eh, I don't mind it--if you're stuck in an infinite loop, or something just takes much longer than anticipated, it's nice to be able to terminate what's happening. Even if it means you have to start over next time.
I have experienced this a couple times. It occurs to me that after #257, the same model is always being served from a certain URL, which means the browser wants to cache it, but I think something weird happens when the server gets updated/restarts? Asking firefox to forget |
The easiest fix is just to restrict when the cancel is available to only during the "running" status. For the kill-the-worker version of |
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 think this is in good shape. Feel free to merge.
Closes #224.
This requires certain CORS settings. I've set it up so that the site should gracefully degrade when they are not set, this can be tested by commenting out the changes to the vite config during a vite dev run (might need to clear cache between changes)