flatironinstitute / mcmc-monitor

Monitor MCMC runs in the browser
Other
35 stars 0 forks source link

support loading of stan playground runs #85

Closed magland closed 1 year ago

magland commented 1 year ago

For example:

http://localhost:5173/mcmc-monitor?s=spa#/spa/vzundlxu/main.spa.out when merged and deployed this will become https://flatironinstitute.github.io/mcmc-monitor?s=spa#/spa/vzundlxu/main.spa.out

Here s=spa means that we are not connecting to a service, but rather we are going to retrieve the data from the stan playground database (spa stands for stan playground analysis)

The /spa/vzundlxu/main.spa.out path is referring to a particular project ID and output file name.

I tried to interfere as little as possible with the existing flow. The main new stuff is in the src/spaInterface folder. That has logic to query the serverless API of stan playground (on vercel).

Internally, the runId takes the form spa|{projectId}|{fileName} and then in a couple of places we detect that format and then retrieve data using the alternative mechanism. The state management (dispatch, etc) is not changed.

codecov-commenter commented 1 year ago

Codecov Report

Merging #85 (eca75d0) into main (0f79b0b) will increase coverage by 0.53%. The diff coverage is 32.01%.

@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
+ Coverage   15.72%   16.26%   +0.53%     
==========================================
  Files          75       80       +5     
  Lines        5641     5854     +213     
  Branches      130      138       +8     
==========================================
+ Hits          887      952      +65     
- Misses       4754     4902     +148     
Flag Coverage Δ
gui_units 20.86% <32.01%> (+0.49%) :arrow_up:
svc_units 2.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pages/MainWindow.tsx 0.00% <0.00%> (ø)
src/pages/RunPage.tsx 0.00% <0.00%> (ø)
src/MCMCMonitorDataManager/useMCMCMonitor.ts 60.00% <12.50%> (-6.06%) :arrow_down:
src/spaInterface/getSpaChainsForRun.ts 22.22% <22.22%> (ø)
src/spaInterface/getSpaSequenceUpdates.ts 22.22% <22.22%> (ø)
src/util/useRoute.ts 79.36% <23.52%> (-20.64%) :arrow_down:
src/spaInterface/postStanPlaygroundRequest.ts 25.00% <25.00%> (ø)
src/networking/postApiRequest.ts 93.54% <33.33%> (-6.46%) :arrow_down:
src/spaInterface/spaOutputsForRunIds.ts 33.87% <33.87%> (ø)
src/spaInterface/util.ts 36.84% <36.84%> (ø)
... and 2 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

magland commented 1 year ago

@jsoules I pushed a commit addressing all of your points. The only one I didn't fully address is avoiding the branching code between spa and non-spa cases. I did however reduce the duplicated line of code to one line for those code blocks.

magland commented 1 year ago

@jsoules not sure where the 'window is not defined' errors are coming from in the automated tests...

magland commented 1 year ago

I resolved the 'window not found' test error by setting test.environment to 'jsdom' in vite.config.ts as suggested here:

https://github.com/vitest-dev/vitest/issues/1293#issuecomment-1375580443

magland commented 1 year ago

Here's a link to the dev folder: https://flatironinstitute.github.io/mcmc-monitor/dev/?s=spa#/spa/ffzkztff/main.spa.out

If it looks good, then please merge and deploy.

jsoules commented 1 year ago

Merged and published. Thanks!