Skip to content

Commit

Permalink
Rename method and change signature
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorgerhardt committed Nov 3, 2023
1 parent 4a89ac0 commit 424181e
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.conveyal.r5.analyst.PointSet;
import com.conveyal.r5.analyst.PointSetCache;
import com.conveyal.r5.analyst.cluster.RegionalTask;
import com.conveyal.r5.analyst.scenario.Scenario;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.primitives.Ints;
import com.mongodb.QueryBuilder;
Expand Down Expand Up @@ -518,7 +517,7 @@ private RegionalAnalysis createRegionalAnalysis (Request req, Response res) thro
var assembler = new MultiOriginAssembler(regionalJob, regionalAnalysis.createResultWriters(task));

// Stored scenario is needed by workers. Must be done ahead of enqueueing the job.
storeScenarioJson(task.graphId, task.scenario);
storeRegionalAnalysisScenarioJson(task);

// Register the regional job with the broker, which will distribute individual tasks to workers and track progress.
broker.enqueueTasksForRegionalJob(regionalJob, assembler);
Expand All @@ -534,11 +533,11 @@ private RegionalAnalysis createRegionalAnalysis (Request req, Response res) thro
/**
* Store the regional analysis scenario as JSON for retrieval by the workers.
*/
private void storeScenarioJson(String graphId, Scenario scenario) throws IOException {
String fileName = getScenarioFilename(graphId, scenario.id);
private void storeRegionalAnalysisScenarioJson(RegionalTask task) throws IOException {
String fileName = getScenarioFilename(task.graphId, task.scenario.id);
FileStorageKey fileStorageKey = new FileStorageKey(BUNDLES, fileName);
File localScenario = FileUtils.createScratchFile("json");
JsonUtil.objectMapper.writeValue(localScenario, scenario);
JsonUtil.objectMapper.writeValue(localScenario, task.scenario);
fileStorage.moveIntoStorage(fileStorageKey, localScenario);
}

Expand Down

0 comments on commit 424181e

Please sign in to comment.