Skip to content

Commit

Permalink
Wrap maxInFlightPerWorkflow in ManualOverrideConsumableResource to al…
Browse files Browse the repository at this point in the history
…low manual override
  • Loading branch information
mlaszloffy committed May 23, 2024
1 parent 1df88da commit 3c781c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow manually overriding max inflight by workflow via posting Vidarr workflow run ids to consumable-resource/max-in-flight-by-workflow/allowed
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import ca.on.oicr.gsi.vidarr.core.BaseProcessor;
import ca.on.oicr.gsi.vidarr.core.ExtractInputVidarrIds;
import ca.on.oicr.gsi.vidarr.core.FileMetadata;
import ca.on.oicr.gsi.vidarr.core.ManualOverrideConsumableResource;
import ca.on.oicr.gsi.vidarr.core.OperationStatus;
import ca.on.oicr.gsi.vidarr.core.Phase;
import ca.on.oicr.gsi.vidarr.core.Target;
Expand Down Expand Up @@ -404,6 +405,9 @@ static void startServer(Main server) throws SQLException {
routes.addPrefixPath(
"/consumable-resource/" + consumableResource.getKey(), consumableResource.getValue());
}
routes.addPrefixPath(
"/consumable-resource/max-in-flight-by-workflow",
server.overridableMaxInFlightPerWorkflow.httpHandler().get());
final var undertow =
Undertow.builder()
.addHttpListener(server.port, "0.0.0.0")
Expand Down Expand Up @@ -446,6 +450,8 @@ private static HttpHandler monitor(HttpHandler handler) {
private final Map<String, InputProvisioner> inputProvisioners;
private final Semaphore loadCounter = new Semaphore(3);
private final MaxInFlightByWorkflow maxInFlightPerWorkflow = new MaxInFlightByWorkflow();
private final ManualOverrideConsumableResource overridableMaxInFlightPerWorkflow =
new ManualOverrideConsumableResource();
private final Map<String, String> otherServers;
private final Map<String, OutputProvisioner> outputProvisioners;
private final int port;
Expand Down Expand Up @@ -558,7 +564,7 @@ public void emit(SectionRenderer sectionRenderer)
new Pair<>(name, consumableResources.get(name))),
Stream.of(
new Pair<String, ConsumableResource>(
"", maxInFlightPerWorkflow)))
"", overridableMaxInFlightPerWorkflow)))
.collect(Collectors.toList());
private final WorkflowEngine engine =
workflowEngines.get(e.getValue().getWorkflowEngine());
Expand Down Expand Up @@ -717,7 +723,7 @@ protected Optional<Target> targetByName(String name) {
.from(WORKFLOW)
.forEach(record -> maxInFlightPerWorkflow.set(record.value1(), record.value2()));
}

overridableMaxInFlightPerWorkflow.setInner(maxInFlightPerWorkflow);
unloadDirectory = Path.of(configuration.getUnloadDirectory());
}

Expand Down

0 comments on commit 3c781c6

Please sign in to comment.