From ca02b61573380b9d0cfde075290acb5c4ee310d5 Mon Sep 17 00:00:00 2001 From: rakow Date: Wed, 18 Dec 2024 15:51:29 +0100 Subject: [PATCH] fix dependency graph for command execution --- .../main/java/org/matsim/application/CommandRunner.java | 8 ++++++-- .../application/analysis/impact/ImpactAnalysis.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/contribs/application/src/main/java/org/matsim/application/CommandRunner.java b/contribs/application/src/main/java/org/matsim/application/CommandRunner.java index cae68d22101..31f587d5564 100644 --- a/contribs/application/src/main/java/org/matsim/application/CommandRunner.java +++ b/contribs/application/src/main/java/org/matsim/application/CommandRunner.java @@ -76,13 +76,17 @@ public void run(Path input) { Class clazz = e.getKey(); graph.addVertex(clazz); Dependency[] depends = ApplicationUtils.getSpec(clazz).dependsOn(); + + boolean hasDependencies = false; for (Dependency d : depends) { - if (d.required()) { + // Add dependency graph if the dependency is executed as well + if (args.containsKey(d.value())) { graph.addVertex(d.value()); graph.addEdge(d.value(), clazz); + hasDependencies = true; } } - if (depends.length == 0) + if (!hasDependencies) start.add(clazz); } diff --git a/contribs/application/src/main/java/org/matsim/application/analysis/impact/ImpactAnalysis.java b/contribs/application/src/main/java/org/matsim/application/analysis/impact/ImpactAnalysis.java index 95abf018e95..d2d94d416c8 100644 --- a/contribs/application/src/main/java/org/matsim/application/analysis/impact/ImpactAnalysis.java +++ b/contribs/application/src/main/java/org/matsim/application/analysis/impact/ImpactAnalysis.java @@ -57,7 +57,7 @@ public Integer call() throws Exception { } - String tripStatsPath = input.getPath("trip_stats.csv"); + String tripStatsPath = input.getPath(TripAnalysis.class,"trip_stats.csv"); System.out.println("Path: " + tripStatsPath);