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

Bacpop 201 stream microreact #83

Merged
merged 26 commits into from
Nov 19, 2024
Merged

Conversation

absternator
Copy link
Contributor

This PR allows streaming of microreact jobs per cluster as they come in... The main changes are as below:

  • add new microreactClusters status which is a map of clusters and their status.. This is used to track whether a clusters microreact is ready or not.

Testing:

Best to test by running app with samples and seeing that microreact become available as they are finished...

This commit refactors the code in the MicroReactColumn.vue component and the projectStatus.ts utility file. It updates the condition for checking the microreact cluster status in the hasMicroreactClusterFailed function. Instead of using the microreactClusterStatuses object, it now uses the status object and the microreactClusters property. This change ensures that the correct status is checked when determining if the microreact cluster has failed.
…tils

- Updated the microreact cluster status check in ProjectPostRun.vue to include the isAnyMicroreactFinished function from projectStatus.ts.
- Added the isAnyMicroreactFinished function to projectStatus.ts to check if any microreact clusters have finished.
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.83%. Comparing base (d56ebbc) to head (d879a6f).
Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   98.78%   98.83%   +0.05%     
==========================================
  Files          34       34              
  Lines        1971     2060      +89     
  Branches      247      270      +23     
==========================================
+ Hits         1947     2036      +89     
  Misses         24       24              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Collaborator

@EmmaLRussell EmmaLRussell left a comment

Choose a reason for hiding this comment

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

Looks great!

I can run this with the newer sample strep samples you sent over a while ago, but failing with the old fasta examples. Is that expected?

@@ -13,7 +13,7 @@ test("can run project and view results", async ({ page }) => {
await page.getByLabel("Run Analysis").click();

await expect(page.getByText("Running Analysis...33%")).toBeVisible();
await expect(page.getByText("Running Analysis...67%")).toBeVisible();
await expect(page.getByText("Running Analysis...75%")).toBeVisible();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems a bit fishy, why does it go from 33% to 75%. This suggests it goes from thinking it's done 1 out of 3 jobs to thinking it's done 3 out of 4... Does it think there are 4 jobs rather than 3 once the initial cluster allocation has happened, because the microreactClusters key is added to the results?

(Yes, when I run it manually, and it's done the cluster assignment and network but no microreact results yet, it goes from 33% to 50%.)

I think the progress bar should include the progress of the individual microreact jobs but ignoring the top level task as separate entity e.g. if it's done assign clusters (33%) plus 1 out of 3 microreactClusters (0.33 * 33%) then it could show 44%...

Comment on lines 51 to 56
numOfStatus(): number {
return (
analysisStatusValues.length > 0 && analysisStatusValues.every((value) => COMPLETE_STATUS_TYPES.includes(value))
Object.keys(this.separatedStatuses.fullStatuses).length +
Object.keys(this.separatedStatuses.microreactClusters).length
);
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would this be a little cleaner?

  return statusValues.length;

Comment on lines 61 to 67
analysisProgressPercentage(): number {
return this.statusValues.length > 0
? Math.round(
(this.statusValues.filter((value) => COMPLETE_STATUS_TYPES.includes(value)).length / this.numOfStatus) * 100
)
: 0;
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think the reason the progress values look a little weird is because microreact is being counted twice, once with its value in "fullStatuses" but also via all the individual cluster values. I think it's confusing to include the former when it's not really a separate task from completing microreact for each cluster.

status: AnalysisStatus | undefined,
cluster: string | undefined
): boolean => {
// occurs when another sample has passed but this one fails
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mean when it's failed to assign a cluster, hence it being falsy?

Suggested change
// occurs when another sample has passed but this one fails
// occurs when this sample could not be assigned to a cluster but at least one other sample was assigned

Should we show the microreact job as "failed" in that case? It's more like we couldn't run it because a prerequisite failed. How about "cancelled"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup cancelled does make sense here.. ive made ticket as this will need a bit more changes https://mrc-ide.myjetbrains.com/youtrack/issue/bacpop-204/When-assign-fails-change-network-microreact-to-cancelled-not-failed

return status?.microreact || "waiting";
};

export const isAnyMicroreactQueued = (microreactClusterStatuses: Record<string, StatusTypes> | undefined): boolean => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Slightly misleading method name, since these could all be completed jobs, not currently queued.

Suggested change
export const isAnyMicroreactQueued = (microreactClusterStatuses: Record<string, StatusTypes> | undefined): boolean => {
export const haveAnyMicroreactBeenQueued = (microreactClusterStatuses: Record<string, StatusTypes> | undefined): boolean => {

Something like that?

@EmmaLRussell
Copy link
Collaborator

OK, this now seems to be running fine for me with the original fasta files. Maybe I just made a project with the wrong species before!

Copy link
Collaborator

@EmmaLRussell EmmaLRussell left a comment

Choose a reason for hiding this comment

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

Nice!

@absternator absternator merged commit a50f9bb into main Nov 19, 2024
11 checks passed
@absternator absternator deleted the bacpop-201-stream-microreact branch November 19, 2024 13:08
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.

2 participants