Skip to content

Commit

Permalink
Feature flagging batch scheduling (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
fdc-ntflx authored Nov 28, 2023
1 parent b244630 commit b577468
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ class WorkerManager implements IWorkerManager {
.expireAfterWrite(1, TimeUnit.HOURS)
.build();
private volatile boolean stageAssignmentPotentiallyChanged;
private final boolean batchSchedulingEnabled = ConfigurationProvider.getConfig().isBatchSchedulingEnabled();

/**
* Creates an instance of this class.
Expand Down Expand Up @@ -1361,7 +1362,7 @@ private void initializeRunningWorkers() {

// If the job is in accepted state, queue all its pending workers at once in a batch request.
// This is important when before master failover there were pending batch requests
if (JobState.isAcceptedState(mantisJobMetaData.getState())) {
if (batchSchedulingEnabled && JobState.isAcceptedState(mantisJobMetaData.getState())) {
workersToSubmit.add(wm);
} else {
queueTask(wm);
Expand Down Expand Up @@ -1495,7 +1496,11 @@ private void submitInitialWorkers() throws Exception {

if (!workers.isEmpty()) {
// queue to scheduler
queueTasks(workers, empty());
if (batchSchedulingEnabled) {
workers.forEach(this::queueTask);
} else {
queueTasks(workers, empty());
}
}
} catch (Exception e) {
LOGGER.error("Error {} storing workers of job {}", e.getMessage(), jobId.getId(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ default Duration getSchedulerIntervalBetweenRetries() {
@Default("5000")
int getResourceClusterActionsPermitsPerSecond();

@Config("mantis.batchScheduling.enabled")
@Default("false")
boolean isBatchSchedulingEnabled();

default Duration getHeartbeatInterval() {
return Duration.ofMillis(getHeartbeatIntervalInMs());
}
Expand Down

0 comments on commit b577468

Please sign in to comment.