Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
321 additions
and
146 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/repairnator-core/src/main/java/fr/inria/spirals/repairnator/config/SequencerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package fr.inria.spirals.repairnator.config; | ||
|
||
/** | ||
* Configuration manager for Sequencer repair step: | ||
* Config values are read directly as environment variables, | ||
* so that we avoid adding more options through the launcher's | ||
* command line args. | ||
*/ | ||
public final class SequencerConfig { | ||
|
||
public final String dockerTag; | ||
public final int threads; | ||
public final int beam_size; | ||
public final int timeout; | ||
|
||
private static SequencerConfig instance; | ||
|
||
private SequencerConfig(){ | ||
this.dockerTag = getEnvOrDefault("SEQUENCER_DOCKER_TAG", "repairnator/sequencer:2.0"); | ||
this.threads = Integer.parseInt(getEnvOrDefault("SEQUENCER_THREADS", "4")); | ||
this.beam_size = Integer.parseInt(getEnvOrDefault("SEQUENCER_BEAM_SIZE", "50")); | ||
this.timeout = Integer.parseInt(getEnvOrDefault("SEQUENCER_TIMEOUT", "120")); | ||
} | ||
|
||
private String getEnvOrDefault(String name, String dfault){ | ||
|
||
String env = System.getenv(name); | ||
if(env == null || env.equals("")) | ||
return dfault; | ||
|
||
return env; | ||
} | ||
|
||
public static SequencerConfig getInstance(){ | ||
if (instance == null) | ||
instance = new SequencerConfig(); | ||
|
||
return instance; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.