Skip to content

Commit

Permalink
deal with mapreduce_id encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
eschultink committed Jul 18, 2024
1 parent 8c25e69 commit e560a5d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ void handleCommand(
if (command.equals(LIST_JOBS_PATH) && !isPost) {
retValue = handleListJobs(request);
} else if (command.equals(CLEANUP_JOB_PATH) && isPost) {
retValue = handleCleanupJob(pipelineOrchestrator, request.getParameter("mapreduce_id"));
retValue = handleCleanupJob(pipelineOrchestrator, requestUtils.getMapReduceId(request));
} else if (command.equals(ABORT_JOB_PATH) && isPost) {
retValue = handleAbortJob(pipelineOrchestrator, request.getParameter("mapreduce_id"));
retValue = handleAbortJob(pipelineOrchestrator, requestUtils.getMapReduceId(request));
} else if (command.equals(GET_JOB_DETAIL_PATH) && !isPost) {
retValue = handleGetJobDetail(pipelineRunner, request.getParameter("mapreduce_id"));
retValue = handleGetJobDetail(pipelineRunner, requestUtils.getMapReduceId(request));
}
} catch (Exception t) {
log.log(Level.SEVERE, "Got exception while running command", t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public static class Params {

//originally defined per-handler in the gae pipelines project
public static final String ROOT_PIPELINE_ID = "root_pipeline_id";

//hard-coded in many places, JS / etc
public static final String MAPREDUCE_ID = "mapreduce_id";
}

public PipelineBackEnd buildBackendFromRequest(HttpServletRequest request) {
Expand Down Expand Up @@ -74,4 +77,15 @@ public String getRootPipelineId(HttpServletRequest request) throws ServletExcept
return getJobId(request, Params.ROOT_PIPELINE_ID)
.orElseThrow(() -> new ServletException(Params.ROOT_PIPELINE_ID + " parameter not found."));
}

/**
* gets 'map_reduce_id', undo'ing serlvet fws decoding of URL-encoded param value
* @param request
* @return
* @throws ServletException
*/
public String getMapReduceId(HttpServletRequest request) throws ServletException {
return getJobId(request, Params.MAPREDUCE_ID)
.orElseThrow(() -> new ServletException(Params.MAPREDUCE_ID + " parameter not found."));
}
}

0 comments on commit e560a5d

Please sign in to comment.