Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
acebe91
4472 - Adding first attempt to reduce duplication code for compaction…
ab295382 Jul 24, 2025
3e60d3e
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Jul 24, 2025
133bcd2
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Jul 24, 2025
120be71
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Jul 25, 2025
1aed375
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Jul 28, 2025
7cead62
4472 - Refactor to remove static methods
ab295382 Jul 28, 2025
dfb9fb7
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Jul 28, 2025
2a2a0a4
4472 - Renamed RunCompactionTask to RunDataProcessingTask
ab295382 Jul 30, 2025
fa10d2b
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Jul 30, 2025
3f58ea8
4472 - Refactor RunDataProcessingTask to include creation static methods
ab295382 Aug 1, 2025
24b6723
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 1, 2025
2a6d0a8
4472 - Removing enum no longer used
ab295382 Aug 1, 2025
017e623
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 4, 2025
b20a5fd
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 6, 2025
8cbc078
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 6, 2025
0e80ced
4472 - Adding static properties that are set at creation of RunDataPr…
ab295382 Aug 6, 2025
918dbbe
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 6, 2025
06d4e4e
4472 - Fixing compile error
ab295382 Aug 6, 2025
4440974
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Aug 7, 2025
f89f193
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 11, 2025
55f3cda
4472 - PR typo comments
ab295382 Aug 11, 2025
1073d3c
4472 - Fixing code so it compiles
ab295382 Aug 11, 2025
511807e
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 18, 2025
be09301
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 27, 2025
b9fad73
4472 - Added TaskHostScaler interface fo compactions and bulk export
ab295382 Aug 27, 2025
9c5ef7c
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Aug 27, 2025
9e64de7
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Aug 28, 2025
add94bd
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Aug 28, 2025
8411a6b
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Aug 28, 2025
cde2141
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Aug 29, 2025
21c3d8d
Merge branch 'develop' of github.com:gchq/sleeper into 4472-reduce-du…
ab295382 Sep 1, 2025
019cb6b
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Sep 2, 2025
4d5e201
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Sep 2, 2025
0ab42fd
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Sep 3, 2025
f66585f
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Sep 3, 2025
dac8d53
Merge branch 'develop' into 4472-reduce-duplication-between-starting-…
ab295382 Sep 4, 2025
a783332
4472: Refactor to remove duplicate boolean checks
ca61688 Sep 8, 2025
a1726f0
4472: Remove static variables
ca61688 Sep 8, 2025
e919608
4472: Split into Compaction and Bulk Export from a users perspective
ca61688 Sep 10, 2025
6912c4b
4472: Fix build issue
ca61688 Sep 10, 2025
70067f8
4472: Fix build issue
ca61688 Sep 10, 2025
7355b83
4472: Split launch methods out into compaction and bulk export
ca61688 Sep 10, 2025
be32680
4472: Move compaction and bulk export specific code out of run data p…
ca61688 Sep 16, 2025
bd64bbb
4472: Clear up purpose of args
ca61688 Sep 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import software.amazon.awssdk.services.sqs.SqsClient;

import sleeper.common.task.QueueMessageCount;
import sleeper.common.task.RunDataProcessingTasks;
import sleeper.configuration.properties.S3InstanceProperties;
import sleeper.core.properties.instance.InstanceProperties;

Expand All @@ -38,16 +39,17 @@ public class SqsTriggeredBulkExportTaskRunnerLambda {
private static final Logger LOGGER = LoggerFactory.getLogger(SqsTriggeredBulkExportTaskRunnerLambda.class);

private final QueueMessageCount.Client queueMessageCount;
private final RunLeafPartitionBulkExportTasks runLeafPartitionBulkExportTasks;
private final RunDataProcessingTasks runTasks;

public SqsTriggeredBulkExportTaskRunnerLambda() {
String s3Bucket = validateParameter(CONFIG_BUCKET.toEnvironmentVariable());
SqsClient sqsClient = SqsClient.create();
S3Client s3Client = S3Client.create();
EcsClient ecsClient = EcsClient.create();
InstanceProperties instanceProperties = S3InstanceProperties.loadFromBucket(s3Client, s3Bucket);
runLeafPartitionBulkExportTasks = new RunLeafPartitionBulkExportTasks(instanceProperties, ecsClient);
queueMessageCount = QueueMessageCount.withSqsClient(sqsClient);

this.runTasks = RunDataProcessingTasks.createForBulkExport(instanceProperties, ecsClient);
this.queueMessageCount = QueueMessageCount.withSqsClient(sqsClient);
}

/**
Expand All @@ -58,7 +60,7 @@ public SqsTriggeredBulkExportTaskRunnerLambda() {
* @param context the lambda context
*/
public void handleRequest(SQSEvent input, Context context) {
runLeafPartitionBulkExportTasks.run(queueMessageCount);
runTasks.run(queueMessageCount);
}

private static String validateParameter(String parameterName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2022-2025 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sleeper.common.task;

public class BulkExportTaskHostScaler implements TaskHostScaler {

@Override
public void scaleTo(int numberOfTasks) {
// Bulk Export doesn't currently scale so do nothing
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* Autoscaler to scale EC2 instances for the desired number of compaction tasks. This makes decisions on how many
* instances to start and stop based on the amount of work there is to do.
*/
public class CompactionTaskHostScaler {
public class CompactionTaskHostScaler implements TaskHostScaler {

private final InstanceProperties instanceProperties;
private final CheckAutoScalingGroup asgQuery;
Expand All @@ -63,6 +63,7 @@ public CompactionTaskHostScaler(
*
* @param numberOfTasks total number of tasks to provide capacity for
*/
@Override
public void scaleTo(int numberOfTasks) {
String launchType = instanceProperties.get(COMPACTION_ECS_LAUNCHTYPE);
// Only need scaler for EC2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2022-2025 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sleeper.common.task;

import software.amazon.awssdk.services.ecs.EcsClient;
import software.amazon.awssdk.services.s3.S3Client;

import sleeper.configuration.properties.S3InstanceProperties;
import sleeper.core.properties.instance.InstanceProperties;

/**
* Finds the number of messages on a queue, and starts up one EC2 or Fargate task for each, up to a
* configurable maximum.
*/
public class RunBulkExportTasks {

public static void main(String[] args) {
if (args.length != 2) {
System.out.println("Usage: <instance-id> <number-of-tasks>");
return;
}

try (S3Client s3Client = S3Client.create();
EcsClient ecsClient = EcsClient.create()) {
String instanceId = args[0];
int numberOfTasks = Integer.parseInt(args[1]);

InstanceProperties instanceProperties = S3InstanceProperties.loadGivenInstanceId(s3Client, instanceId);

RunDataProcessingTasks.createForBulkExport(instanceProperties, ecsClient)
.runToMeetTargetTasks(numberOfTasks);
}
}

private RunBulkExportTasks() {
}
}
Loading