Skip to content

Commit

Permalink
Block UI based on pipeline state (#62)
Browse files Browse the repository at this point in the history
* Add pipeline status to pipeline updates to avoid having to call GET pipeline on the ui every time we need to know its status

* Fix tests

* WIP

* Remove console log

Co-authored-by: Martin Fosco <[email protected]>
  • Loading branch information
cosa65 and Martin Fosco authored Mar 15, 2021
1 parent d205e4a commit cab3d09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/api/route-services/pipeline-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const logger = require('../../utils/logging');

const ExperimentService = require('./experiment');
const PlotsTablesService = require('./plots-tables');
const pipelineStatus = require('../general-services/pipeline-status');

const experimentService = new ExperimentService();
const plotsTableService = new PlotsTablesService();
Expand Down Expand Up @@ -85,10 +86,13 @@ const pipelineResponse = async (io, message) => {

experimentService.updateProcessingConfig(experimentId, [{ name: taskName, body: output.config }]);

const statusRes = await pipelineStatus(experimentId);

// Concatenate into a proper response.
const response = {
...message,
output,
status: statusRes,
};

logger.log('Sending to all clients subscribed to experiment', experimentId);
Expand Down
4 changes: 4 additions & 0 deletions tests/api/route-services/pipeline-response.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const ioServer = require('socket.io')({
const AWS = require('../../../src/utils/requireAWS');
const pipelineResponse = require('../../../src/api/route-services/pipeline-response');

jest.mock('../../../src/api/general-services/pipeline-status', () => jest.fn().mockImplementation(() => ({
pipelineStatus: () => ({}),
})));

describe('Test Pipeline Response Service', () => {
let io;
let client;
Expand Down

0 comments on commit cab3d09

Please sign in to comment.