Skip to content

Commit

Permalink
fix(task-runner): changed volume-mount condition not to fail in case …
Browse files Browse the repository at this point in the history
…of no outputFiles + computeEnvironment was missing rendering
  • Loading branch information
brian-mulier-p committed Apr 26, 2024
1 parent f004b3b commit 1de592b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,14 @@ public RunnerResult run(RunContext runContext, TaskCommands taskCommands, List<S

String jobName = ScriptService.jobName(runContext);

String renderedComputeEnvironmentArn = runContext.render(this.computeEnvironmentArn);
ComputeEnvironmentDetail computeEnvironmentDetail = client.describeComputeEnvironments(
DescribeComputeEnvironmentsRequest.builder()
.computeEnvironments(computeEnvironmentArn)
.computeEnvironments(renderedComputeEnvironmentArn)
.build()
).computeEnvironments().stream()
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Compute environment not found: " + computeEnvironmentArn));
.orElseThrow(() -> new IllegalArgumentException("Compute environment not found: " + renderedComputeEnvironmentArn));

String kestraVolume = "kestra";
if (computeEnvironmentDetail.containerOrchestrationType() != OrchestrationType.ECS) {
Expand Down Expand Up @@ -406,11 +407,10 @@ public RunnerResult run(RunContext runContext, TaskCommands taskCommands, List<S
Float.parseFloat(resources.getRequest().getCpu()) - sideContainersCpuAllocations
);

if (needsOutputFilesContainer) {
if (hasFilesToUpload || needsOutputFilesContainer) {
mainContainerBuilder.dependsOn(TaskContainerDependency.builder().containerName(inputFilesContainerName).condition("SUCCESS").build());
mainContainerBuilder.mountPoints(volumeMount);
}

containers.add(mainContainerBuilder.build());

if (needsOutputFilesContainer) {
Expand Down Expand Up @@ -458,7 +458,7 @@ public RunnerResult run(RunContext runContext, TaskCommands taskCommands, List<S
.computeEnvironmentOrder(
ComputeEnvironmentOrder.builder()
.order(1)
.computeEnvironment(runContext.render(this.computeEnvironmentArn))
.computeEnvironment(renderedComputeEnvironmentArn)
.build()
)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ protected TaskRunner taskRunner() {
.secretKeyId(secretKeyId)
.bucket(s3Bucket)
.region("eu-west-3")
.computeEnvironmentArn("arn:aws:batch:eu-west-3:634784741179:compute-environment/FargateComputeEnvironment")
.executionRoleArn("arn:aws:iam::634784741179:role/AWS-Batch-Role-For-Fargate")
.taskRoleArn("arn:aws:iam::634784741179:role/S3-Within-AWS-Batch")
.computeEnvironmentArn("arn:aws:batch:eu-west-3:634784741179:compute-environment/kestraFargateEnvironment")
.executionRoleArn("arn:aws:iam::634784741179:role/kestraEcsTaskExecutionRole")
.taskRoleArn("arn:aws:iam::634784741179:role/ecsTaskRole")
.waitUntilCompletion(Duration.ofMinutes(30))
.jobQueueArn("arn:aws:batch:eu-west-3:634784741179:job-queue/queue")
.jobQueueArn("arn:aws:batch:eu-west-3:634784741179:job-queue/kestraJobQueue")
.build();
}

Expand Down

0 comments on commit 1de592b

Please sign in to comment.