Skip to content

Commit

Permalink
Merge branch 'master' into improve-seurat
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvpickering authored Aug 31, 2023
2 parents 943b6ca + e80c1dc commit 56e35e0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/components/GEM2SLoadingScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
import { useDispatch } from 'react-redux';
import Link from 'next/link';
import PropTypes from 'prop-types';
import runGem2s from 'redux/actions/pipeline/runGem2s';
import runSeurat from 'redux/actions/pipeline/runSeurat';
import { retry } from 'redux/actions/pipeline';
import NotifyByEmail from './NotifyByEmail';

const { Title, Text } = Typography;
Expand All @@ -28,24 +27,22 @@ const pipelineStepsInfoByType = {
],
};

const runnerByType = {
gem2s: runGem2s,
seurat: runSeurat,
};

const GEM2SLoadingScreen = (props) => {
const {
pipelineStatus, completedSteps, experimentId, experimentName, pipelineType, pipelineErrorMessage,
pipelineStatus,
completedSteps,
experimentId,
experimentName,
pipelineType,
pipelineErrorMessage,
} = props;

const pipelineStepsInfo = pipelineStepsInfoByType[pipelineType];
const runner = runnerByType[pipelineType];

const dispatch = useDispatch();

const dataManagementPath = '/data-management';
const relaunchExperiment = async () => {
await dispatch(runner(experimentId));
await dispatch(retry(experimentId));
};

const texts = {
Expand Down
2 changes: 2 additions & 0 deletions src/redux/actions/pipeline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import runQC from './runQC';
import runGem2s from './runGem2s';
import runSubsetExperiment from './runSubsetExperiment';
import runSeurat from './runSeurat';
import retry from './retry';

export {
runQC,
runGem2s,
runSubsetExperiment,
runSeurat,
retry,
};
32 changes: 32 additions & 0 deletions src/redux/actions/pipeline/retry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import fetchAPI from 'utils/http/fetchAPI';
import handleError from 'utils/http/handleError';
import endUserMessages from 'utils/endUserMessages';
import loadBackendStatus from 'redux/actions/backendStatus/loadBackendStatus';

const retry = (experimentId) => async (dispatch) => {
try {
await fetchAPI(
`/v2/experiments/${experimentId}/retry`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
},
);

await dispatch(loadBackendStatus(experimentId));

return true;
} catch (e) {
const errorMessage = handleError(e, endUserMessages.ERROR_STARTING_PIPLELINE);

if (errorMessage !== endUserMessages.ERROR_NO_PERMISSIONS) {
await dispatch(loadBackendStatus(experimentId));
}

return false;
}
};

export default retry;

0 comments on commit 56e35e0

Please sign in to comment.