Skip to content

Commit

Permalink
added debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kafkasl committed Apr 21, 2022
1 parent 3f0090c commit 39cc9d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/api/route-services/gem2s.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const logger = getLogger();

const pipelineHook = new PipelineHook();

// TODO here we are reusing the jwt so if gem2s was longer than 1 hour it will fail.
pipelineHook.register('uploadToAWS', [saveProcessingConfigFromGem2s, runQCPipeline]);
pipelineHook.registerAll([sendNotification]);

Expand Down
10 changes: 10 additions & 0 deletions src/api/route-services/pipeline-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,33 @@ class PipelineService {
}

static async qcResponse(io, message) {
console.log('starting qc response', message);
AWSXRay.getSegment().addMetadata('message', message);
console.log('validating request');
await validateRequest(message, 'PipelineResponse.v1.yaml');

console.log('running hooks');
await pipelineHook.run(message);

const { experimentId } = message;
const { error = false } = message.response || {};

let output = null;
// if there aren't errors proceed with the updates
console.log('and the rest is silence');
if (!error && 'output' in message) {
const { input: { sampleUuid, taskName } } = message;

console.log('getS3Output');
output = await this.getS3Output(message);
console.log('updatePlotData');
await this.updatePlotData(taskName, experimentId, output);
console.log('updateProcessingConfig');
await this.updateProcessingConfig(taskName, experimentId, output, sampleUuid);
}

console.log('and the rest is not silence');

// we want to send the update to the subscribed both in successful and error case
await this.sendUpdateToSubscribed(experimentId, message, output, error, io);
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils/authMiddlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const checkAuthExpiredMiddleware = (req, res, next) => {
return next(new UnauthenticatedError('token has expired'));
}

console.log(`lcs checking ignore [${req.url}] [${req.method.toLowerCase()}]`);
// check if we should ignore expired jwt token for this path and request type
const longTimeoutEndpoints = [{ urlMatcher: /^\/v1\/experiments\/.{32}\/cellSets$/, method: 'PATCH' }];
const isEndpointIgnored = longTimeoutEndpoints.some(
Expand All @@ -133,6 +134,7 @@ const checkAuthExpiredMiddleware = (req, res, next) => {
),
);

console.log('isEndpointIgnored: ', isEndpointIgnored);
// if endpoint is not in ignore list, the JWT is too old, send an error accordingly
if (!isEndpointIgnored) {
return next(new UnauthenticatedError('token has expired'));
Expand Down

0 comments on commit 39cc9d3

Please sign in to comment.