From 2d2444e0fa1944f3ebcde1d158708a1654526d9a Mon Sep 17 00:00:00 2001 From: Pol Alvarez Date: Wed, 25 Oct 2023 22:39:22 +0200 Subject: [PATCH] refactor(seekWorkResponse): finished getExtraDependencies Signed-off-by: Pol Alvarez --- src/api.v2/helpers/worker/generateEtag.js | 18 ++++-------------- .../worker/workSubmit/getExtraDependencies.js | 16 ++++++---------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/api.v2/helpers/worker/generateEtag.js b/src/api.v2/helpers/worker/generateEtag.js index dc07da1ca..9d0259b04 100644 --- a/src/api.v2/helpers/worker/generateEtag.js +++ b/src/api.v2/helpers/worker/generateEtag.js @@ -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, @@ -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); diff --git a/src/api.v2/helpers/worker/workSubmit/getExtraDependencies.js b/src/api.v2/helpers/worker/workSubmit/getExtraDependencies.js index 7c1e36248..82456f734 100644 --- a/src/api.v2/helpers/worker/workSubmit/getExtraDependencies.js +++ b/src/api.v2/helpers/worker/workSubmit/getExtraDependencies.js @@ -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); @@ -27,6 +24,7 @@ const getCellSets = async (experimentId) => { return cellSets; }; + const dependencyGetters = { ClusterCells: [], ScTypeAnnotate: [], @@ -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), ), );