Skip to content

Commit

Permalink
Fix feature flag condition (#593)
Browse files Browse the repository at this point in the history
* Fix feature flag condition

* Fix tests
  • Loading branch information
fdc-ntflx authored Nov 28, 2023
1 parent b577468 commit fe6604d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void initialize(boolean isSubmit) throws Exception {
LOGGER.info("Stored mantis job");

this.workerManager = new WorkerManager(this, jobClusterDefinition.getWorkerMigrationConfig(),
this.mantisScheduler, isSubmit);
this.mantisScheduler, isSubmit, ConfigurationProvider.getConfig().isBatchSchedulingEnabled());

long checkAgainInSeconds = getWorkerTimeoutSecs();
long refreshStageAssignementsDurationMs = ConfigurationProvider.getConfig()
Expand Down Expand Up @@ -1259,7 +1259,7 @@ class WorkerManager implements IWorkerManager {
.expireAfterWrite(1, TimeUnit.HOURS)
.build();
private volatile boolean stageAssignmentPotentiallyChanged;
private final boolean batchSchedulingEnabled = ConfigurationProvider.getConfig().isBatchSchedulingEnabled();
private final boolean batchSchedulingEnabled;

/**
* Creates an instance of this class.
Expand All @@ -1272,12 +1272,13 @@ class WorkerManager implements IWorkerManager {
*/
WorkerManager(
IMantisJobManager jobMgr, WorkerMigrationConfig migrationConfig, MantisScheduler scheduler,
boolean isSubmit) throws Exception {
boolean isSubmit, boolean batchSchedulingEnabled) throws Exception {

workerNumberGenerator = new WorkerNumberGenerator((isSubmit) ? 0
: jobMgr.getJobDetails().getNextWorkerNumberToUse(), WorkerNumberGenerator.DEFAULT_INCREMENT_STEP);
this.scheduler = scheduler;
this.jobMgr = jobMgr;
this.batchSchedulingEnabled = batchSchedulingEnabled;
migrationStrategy = MigrationStrategyFactory.getStrategy(jobId.getId(), migrationConfig);
int noOfStages = mantisJobMetaData.getStageMetadata().size();
if (noOfStages == 1) {
Expand Down Expand Up @@ -1497,9 +1498,9 @@ private void submitInitialWorkers() throws Exception {
if (!workers.isEmpty()) {
// queue to scheduler
if (batchSchedulingEnabled) {
workers.forEach(this::queueTask);
} else {
queueTasks(workers, empty());
} else {
workers.forEach(this::queueTask);
}
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ default Duration getSchedulerIntervalBetweenRetries() {
@Default("5000")
int getResourceClusterActionsPermitsPerSecond();

@Config("mantis.batchScheduling.enabled")
@Config("mantis.scheduler.enable-batch")
@Default("false")
boolean isBatchSchedulingEnabled();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public static void setupMasterConfig() {
props.setProperty("mesos.lease.offer.expiry.secs", "1");
props.setProperty("mantis.master.stage.assignment.refresh.interval.ms","-1");
props.setProperty("mantis.master.api.cache.ttl.milliseconds","0");
props.setProperty("mantis.scheduler.enable-batch","true");

ConfigurationProvider.initialize(new StaticPropertiesConfigurationFactory(props));
}
Expand Down

0 comments on commit fe6604d

Please sign in to comment.