Skip to content

Commit

Permalink
refactor(seekWorkResponse): finished getExtraDependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Pol Alvarez <[email protected]>
  • Loading branch information
kafkasl committed Oct 25, 2023
1 parent 9f0ff2a commit 2d2444e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
18 changes: 4 additions & 14 deletions src/api.v2/helpers/worker/generateEtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ const generateETag = async (

const { workerVersion } = config;

const extraDependencies = await getExtraDependencies(experimentId, body.name, body);
// TODO need to add the new mechanism to avoid extraDependencies
const taskName = body.name;
const extraDependencies = await getExtraDependencies(experimentId, taskName);

const ETagBody = {
experimentId,
body,
Expand All @@ -32,18 +33,7 @@ const generateETag = async (
extraDependencies,
};

// They `body` key to create ETAg for gene expression is different
// from the others, causing the generated ETag to be different
// TODO remove this
console.log('ETagBody', ETagBody);
// experimentId: '7da5be3a-ecf5-429b-b6d2-a92df2a719eb',
// qcPipelineStartDate: '2023-10-25T14:10:44.904Z',
// extras: undefined,
// cacheUniquenessKey: null,
// workerVersion: 4,
// extraDependencies: [],
// body: { name: 'GetNGenes' }
// }

console.log('ETagBody', ETagBody);

return createObjectHash(ETagBody);
Expand Down
16 changes: 6 additions & 10 deletions src/api.v2/helpers/worker/workSubmit/getExtraDependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ const getS3Object = require('../../s3/getObject');
const bucketNames = require('../../../../config/bucketNames');


const getClusteringSettings = async (experimentId, body) => {
const getClusteringSettings = async (experimentId) => {
const {
processingConfig,
} = await new Experiment().findById(experimentId).first();

console.log('processingConfig', processingConfig);
console.log('body', body);

const { configureEmbedding: { clusteringSettings } } = processingConfig;

console.log('clusteringSettings', clusteringSettings);
Expand All @@ -27,6 +24,7 @@ const getCellSets = async (experimentId) => {
return cellSets;
};


const dependencyGetters = {
ClusterCells: [],
ScTypeAnnotate: [],
Expand All @@ -42,20 +40,18 @@ const dependencyGetters = {
GetMitochondrialContent: [],
GetNGenes: [],
GetNUmis: [],
MarkerHeatmap: [getClusteringSettings], // TODO getSelectedCellSet needs to be
// replaced by adding the actuall cells in the work request instead of only the cellset key
// MarkerHeatmap: [getClusteringSettings, getSelectedCellSet],
MarkerHeatmap: [getClusteringSettings],
GetTrajectoryAnalysisStartingNodes: [getClusteringSettings],
GetTrajectoryAnalysisPseudoTime: [getClusteringSettings],
GetNormalizedExpression: [getClusteringSettings],
DownloadAnnotSeuratObject: [getClusteringSettings, getCellSets],
};

const getExtraDependencies = async (experimentId, taskName, body) => {
console.log('getExtraDependencies', taskName, body);
const getExtraDependencies = async (experimentId, taskName) => {
console.log('getExtraDependencies', taskName);
const dependencies = await Promise.all(
dependencyGetters[taskName].map(
(dependencyGetter) => dependencyGetter(experimentId, body),
(dependencyGetter) => dependencyGetter(experimentId),
),
);

Expand Down

0 comments on commit 2d2444e

Please sign in to comment.