Skip to content

Commit

Permalink
fix: workflow submission
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Sep 1, 2023
1 parent eb1b3e2 commit bc4e1c6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
4 changes: 1 addition & 3 deletions src/components/manager/ManagerAnalysisContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ AnalysisConfirmDisplay.propTypes = {
const ManagerAnalysisContent = () => {
const dispatch = useDispatch();
const history = useHistory();
const servicesByID = useSelector(state => state.services.itemsByID);

return <RunSetupWizard
workflowSelection={({handleWorkflowClick}) => (
Expand All @@ -84,9 +83,8 @@ const ManagerAnalysisContent = () => {
// TODO: GUI error message
return;
}
const serviceInfo = servicesByID[selectedWorkflow.serviceID];
dispatch(submitAnalysisWorkflowRun(
serviceInfo,
selectedWorkflow.service_base_url,
selectedWorkflow,
inputs,
"/admin/data/manager/runs",
Expand Down
5 changes: 1 addition & 4 deletions src/components/manager/ManagerIngestionContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ IngestConfirmDisplay.propTypes = {
const ManagerIngestionContent = () => {
const dispatch = useDispatch();
const history = useHistory();
const servicesByID = useSelector(state => state.services.itemsByID);

return <RunSetupWizard
workflowSelection={({workflowSelectionValues, setWorkflowSelectionValues, handleWorkflowClick}) => (
Expand Down Expand Up @@ -169,10 +168,8 @@ const ManagerIngestionContent = () => {
return;
}

const serviceInfo = servicesByID[selectedWorkflow.serviceID];

dispatch(submitIngestionWorkflowRun(
serviceInfo,
selectedWorkflow.service_base_url,
selectedProject,
selectedDataset,
selectedDataType,
Expand Down
16 changes: 9 additions & 7 deletions src/modules/wes/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ export const fetchRunLogStreamsIfPossibleAndNeeded = runID => (dispatch, getStat


export const submitWorkflowRun = networkAction(
(types, serviceInfo, workflow, params, inputs, tags, onSuccess, errorMessage) => (dispatch, getState) => {
(types, serviceBaseUrl, workflow, params, inputs, tags, onSuccess, errorMessage) => (dispatch, getState) => {
const serviceUrlRStrip = serviceBaseUrl.replace(/\/$/, "");

const runRequest = {
workflow_params: Object.fromEntries(Object.entries(inputs)
.map(([k, v]) => [`${workflow.id}.${k}`, v])),
workflow_type: "WDL", // TODO: Should eventually not be hard-coded
workflow_type_version: "1.0", // TODO: "
workflow_engine_parameters: {}, // TODO: Currently unused
workflow_url: `${serviceInfo.url}/workflows/${workflow.id}.wdl`,
workflow_url: `${serviceUrlRStrip}/workflows/${workflow.id}.wdl`,
tags: {
workflow_id: workflow.id,
workflow_metadata: workflow,
Expand All @@ -116,7 +118,7 @@ export const submitWorkflowRun = networkAction(

return {
types,
params: {serviceInfo, request: runRequest, ...params},
params: {request: runRequest, ...params},
url: `${getState().services.wesService.url}/runs`,
req: {
method: "POST",
Expand All @@ -129,11 +131,11 @@ export const submitWorkflowRun = networkAction(


export const submitIngestionWorkflowRun =
(serviceInfo, projectID, datasetID, dataType, workflow, inputs, redirect, hist) =>
(serviceBaseUrl, projectID, datasetID, dataType, workflow, inputs, redirect, hist) =>
(dispatch) =>
dispatch(submitWorkflowRun(
SUBMIT_INGESTION_RUN,
serviceInfo,
serviceBaseUrl,
workflow,
{projectID, datasetID, dataType}, // params
inputs,
Expand All @@ -150,10 +152,10 @@ export const submitIngestionWorkflowRun =
));


export const submitAnalysisWorkflowRun = (serviceInfo, workflow, inputs, redirect, hist) => (dispatch) =>
export const submitAnalysisWorkflowRun = (serviceBaseUrl, workflow, inputs, redirect, hist) => (dispatch) =>
dispatch(submitWorkflowRun(
SUBMIT_ANALYSIS_RUN,
serviceInfo,
serviceBaseUrl,
workflow,
{}, // params
inputs,
Expand Down
2 changes: 1 addition & 1 deletion src/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const workflowsStateToPropsMixin = state => {
// Prop types object shape for a single workflow object.
export const workflowPropTypesShape = PropTypes.shape({
id: PropTypes.string,
serviceID: PropTypes.string,
service_base_url: PropTypes.string,

// "Real" properties
name: PropTypes.string,
Expand Down

0 comments on commit bc4e1c6

Please sign in to comment.