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

warn annotation loss with resolution change #977

Merged
merged 7 commits into from
Feb 13, 2024

Conversation

alexvpickering
Copy link
Contributor

@alexvpickering alexvpickering commented Jan 31, 2024

Description

Makes it so that resolution changes also require confirmation before they are run. Also adds a warning that re-running QC will cause loss of annotations.

staging:

https://ui-alex-ui977.staging.single-cell-platform.net/

Details

URL to issue

hms-dbmi-cellenics/issues#7

Link to staging deployment URL (or set N/A)

N/A

Links to any PRs or resources related to this PR

Integration test branch

master

Merge checklist

Your changes will be ready for merging after all of the steps below have been completed.

Code updates

Have best practices and ongoing refactors being observed in this PR

  • Migrated any selector / reducer used to the new format.
  • All new dependency licenses have been checked for compatibility.

Manual/unit testing

  • Tested changes using InfraMock locally or no tests required for change, e.g. Kubernetes chart updates.
  • Validated that current unit tests for code work as expected and are sufficient for code coverage or no unit tests required for change, e.g. documentation update.
  • Unit tests written or no unit tests required for change, e.g. documentation update.

Integration testing

You must check the box below to run integration tests on the latest commit on your PR branch.
Integration tests have to pass before the PR can be merged. Without checking the box, your PR
will not pass the required status checks for merging.

  • Started end-to-end tests on the latest commit.

Documentation updates

  • Relevant Github READMEs updated or no GitHub README updates required.
  • Relevant Wiki pages created/updated or no Wiki updates required.

Optional

  • Staging environment is unstaged before merging.
  • Photo of a cute animal attached to this PR.

@alexvpickering alexvpickering added the safe to run Sensitive jobs are safe to be run label Jan 31, 2024
Copy link
Contributor

📦 Next.js Bundle Analysis for ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/experiments/[experimentId]/data-processing 537.28 KB (🟡 +9 B) 1.08 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Signed-off-by: Alex Pickering <[email protected]>
Signed-off-by: Alex Pickering <[email protected]>
Copy link
Contributor

📦 Next.js Bundle Analysis for ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 569.13 KB (🟡 +64 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/experiments/[experimentId]/data-processing 537.24 KB (-40 B) 1.08 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Signed-off-by: Alex Pickering <[email protected]>
Copy link
Contributor

📦 Next.js Bundle Analysis for ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 569.13 KB (🟡 +64 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/experiments/[experimentId]/data-processing 537.24 KB (-40 B) 1.08 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (a4c16b5) 85.09% compared to head (69f0bcb) 85.20%.

Files Patch % Lines
...rocessing/ConfigureEmbedding/CalculationConfig.jsx 75.00% 1 Missing ⚠️
...periments/[experimentId]/data-processing/index.jsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #977      +/-   ##
==========================================
+ Coverage   85.09%   85.20%   +0.10%     
==========================================
  Files         548      548              
  Lines       10092    10083       -9     
  Branches     2131     2174      +43     
==========================================
+ Hits         8588     8591       +3     
+ Misses       1445     1432      -13     
- Partials       59       60       +1     

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

@alexvpickering alexvpickering requested a review from cosa65 February 6, 2024 00:33
Comment on lines 59 to 65
const embeddingChanged = changedQCFilters.has('embeddingSettings');
const clusteringChanged = changedQCFilters.has('clusteringSettings');
const otherChanged = [...changedQCFilters].some((value) => value !== 'embeddingSettings' && value !== 'clusteringSettings');

// if only embedding or clustering changed
if (!otherChanged) {
await dispatch(saveProcessingSettings(experimentId, 'configureEmbedding'));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const embeddingChanged = changedQCFilters.has('embeddingSettings');
const clusteringChanged = changedQCFilters.has('clusteringSettings');
const otherChanged = [...changedQCFilters].some((value) => value !== 'embeddingSettings' && value !== 'clusteringSettings');
// if only embedding or clustering changed
if (!otherChanged) {
await dispatch(saveProcessingSettings(experimentId, 'configureEmbedding'));
const embeddingChanged = changedQCFilters.has('embeddingSettings');
const clusteringChanged = changedQCFilters.has('clusteringSettings');
if (embeddingChanged || clusteringChanged) {
await dispatch(saveProcessingSettings(experimentId, 'configureEmbedding'));

Copy link
Member

Choose a reason for hiding this comment

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

Also if you move back the await dispatch(saveProcessingSettings(experimentId, 'configureEmbedding')); line to the runOnlyClustering and runOnlyConfigureEmbedding functions, this whole block can be only:

  const embeddingChanged = changedQCFilters.has('embeddingSettings');
  const clusteringChanged = changedQCFilters.has('clusteringSettings');

    if (embeddingChanged) {
      runOnlyConfigureEmbedding(
        experimentId,
        processing.configureEmbedding.embeddingSettings.method,
        dispatch,
      );
    }
    if (clusteringChanged) {
      runOnlyClustering(
        experimentId,
        processing.configureEmbedding.clusteringSettings.methodSettings.louvain.resolution,
        dispatch,
      );
    }

Copy link
Contributor Author

@alexvpickering alexvpickering Feb 13, 2024

Choose a reason for hiding this comment

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

So now that means that if there's more than one changed filter, running it with changed embedding or clustering in the last step will discard them all and run only embedding / clustering?

The problem with this is that it will run the conditional block if there are other changes to Data Processing in addition to an embedding or clustering change. I want the condition to run if there is only an embedding or clustering change (or both but nothing else). Embedding and clustering will be run after the pipeline finishes if there are any other changes so I don't want to call embedding/clustering in those cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also if you move back the await dispatch(saveProcessingSettings(experimentId, 'configureEmbedding')); line to the runOnlyClustering and runOnlyConfigureEmbedding functions, this whole block can be only:

  const embeddingChanged = changedQCFilters.has('embeddingSettings');
  const clusteringChanged = changedQCFilters.has('clusteringSettings');

    if (embeddingChanged) {
      runOnlyConfigureEmbedding(
        experimentId,
        processing.configureEmbedding.embeddingSettings.method,
        dispatch,
      );
    }
    if (clusteringChanged) {
      runOnlyClustering(
        experimentId,
        processing.configureEmbedding.clusteringSettings.methodSettings.louvain.resolution,
        dispatch,
      );
    }

happy to move the line back if you have a preference. I moved it out so that it wasn't duplicated between the two functions

Copy link
Member

Choose a reason for hiding this comment

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

I was only thinking in case we want to use the runOnlyClustering and runOnlyConfigureEmbedding functions somewhere else in the code, someone might expect them to do a save and forget to dispatch(save before running them.

}
// updates to configure embedding run on worker if they are the only changes
// need to know if change was to embedding or clustering settings
const settingType = Object.keys(diff)[0];
Copy link
Member

Choose a reason for hiding this comment

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

Why only the first changed from the diff and not the whole Object.keys(diff)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each of the diffs is a single object where the top level key is either going to be embeddingSettings or clusteringSettings. This just extracts that key.

@@ -42,12 +56,27 @@ const runQC = (experimentId) => async (dispatch, getState) => {
const { processing } = getState().experimentSettings;
const { changedQCFilters } = processing.meta;

if (changedQCFilters.size === 1 && changedQCFilters.has('configureEmbedding')) {
Copy link
Member

Choose a reason for hiding this comment

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

With changedQCFilters.size === 1 removed, now that means that if there's more than one changed filter, running it with changed embedding or clustering in the last step will discard them all and run only embedding / clustering?

Copy link
Contributor Author

@alexvpickering alexvpickering Feb 13, 2024

Choose a reason for hiding this comment

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

changedQCFilters.size === 1 is removed because we will now be looking for either exactly embeddingSettings , clusteringSettings, or both. If both are changed but nothing else we also need to run this conditional block (so size is no longer a good way to distinguish).

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I cant test in staging because i dont have an hms account but what i see is that now this will be run even if there are other changedQCFilters from previous steps. There is a return on line 81, so that means qc wont be triggered.
What will happen if i change for example the mitochondrial content filter and then go to configure embedding and change clustering / embedding there? I think mitochondrial filter changes will be discarded and clustering / embedding will be ran right?

Copy link
Contributor Author

@alexvpickering alexvpickering Feb 13, 2024

Choose a reason for hiding this comment

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

If you send me an email I'll create an account for you to test. Here is why it doesn't run if there are other steps changed:

const otherChanged = [...changedQCFilters].some((value) => value !== 'embeddingSettings' && value !== 'clusteringSettings');

This checks to see if there are other settings changed. If there are not, then the below conditional block runs. See added comments to hopefully clarify:

if (!otherChanged) {

// this runs because exactly embedding or clustering or both has changed (but nothing else)
await dispatch(saveProcessingSettings(experimentId, 'configureEmbedding'));

if (embeddingChanged) {
      runOnlyConfigureEmbedding(
        experimentId,
        processing.configureEmbedding.embeddingSettings.method,
        dispatch,
      );
    }
    if (clusteringChanged) {
      runOnlyClustering(
        experimentId,
        processing.configureEmbedding.clusteringSettings.methodSettings.louvain.resolution,
        dispatch,
      );
    }
    // we return because we are in the !otherChanged block so nothing else changed and we don't re-run QC
    return;
}

Copy link
Member

Choose a reason for hiding this comment

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

oh alright sorry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not at all -- thank you -- always good to have a careful review :)

Signed-off-by: Alex Pickering <[email protected]>
Copy link
Contributor

📦 Next.js Bundle Analysis for ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 569.14 KB (🟡 +70 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/experiments/[experimentId]/data-processing 537.24 KB (-27 B) 1.08 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link
Contributor

📦 Next.js Bundle Analysis for ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 569.14 KB (🟡 +69 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/experiments/[experimentId]/data-processing 537.25 KB (-14 B) 1.08 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@alexvpickering alexvpickering merged commit 7e674c3 into master Feb 13, 2024
14 checks passed
@alexvpickering alexvpickering deleted the warn-annotation-loss branch February 13, 2024 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to run Sensitive jobs are safe to be run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants