Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Set overrides in DSS as a single property, refactor code for submitting runs #654

Merged
merged 6 commits into from
Oct 7, 2024
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Split overrides on newlines
Signed-off-by: Eamonn Mansour <[email protected]>
eamansour committed Oct 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit e115ed4b59328c69b4a332c1fcf80e706f3c2bb9
Original file line number Diff line number Diff line change
@@ -169,11 +169,13 @@ private void loadOverrideProperties(Properties overrideProperties,
String runOverridesProp = "run." + run.getName() + ".overrides";
String runOverrides = dss.get(runOverridesProp);
if (runOverrides != null && !runOverrides.isBlank()) {
for (String override : runOverrides.split(",")) {
for (String override : runOverrides.split("\n")) {
String[] overrideParts = override.split("=");
String key = overrideParts[0];
String value = overrideParts[1];
overrideProperties.put(key, value);
if (overrideParts.length == 2) {
String key = overrideParts[0];
String value = overrideParts[1];
overrideProperties.put(key, value);
}
}
}
} catch(Exception e) {
Original file line number Diff line number Diff line change
@@ -143,19 +143,22 @@ public FrameworkInitialisation(
// *** If this is a test run, add the overrides from the run dss properties to
// these overrides
if (testrun) {
// The overrides DSS property contains a map of overrides, separated by newline characters in the form:
// dss.framework.run.<run-name>.overrides=override1=value1\noverride2=value2
String runOverridesProp = "run." + framework.getTestRunName() + ".overrides";
String runOverrides = this.dssFramework.get(runOverridesProp);
if (runOverrides != null && !runOverrides.isBlank()) {
for (String override : runOverrides.split("\n")) {
// Each override is of the form "key=value"
String[] overrideParts = override.split("=");
String key = overrideParts[0];
String value = overrideParts[1];

if (logger.isTraceEnabled()) {
logger.trace("Setting run override " + key + "=" + value);
if (overrideParts.length == 2) {
String key = overrideParts[0];
String value = overrideParts[1];

if (logger.isTraceEnabled()) {
logger.trace("Setting run override " + key + "=" + value);
}
overrideProperties.put(key, value);
}
overrideProperties.put(key, value);
}
}
}
Original file line number Diff line number Diff line change
@@ -251,7 +251,7 @@ private boolean storeRun(String runName, SubmitRunRequest runRequest) throws Dyn

otherRunProperties.put(RUN_PREFIX + runName + ".overrides", overridesStr);
}

// *** See if we can setup the runnumber properties (clashes possible if low max
// number or sharing prefix
return this.dss.putSwap(RUN_PREFIX + runName + ".test", null, bundleTest, otherRunProperties);
@@ -302,7 +302,7 @@ public IRun getRun(String runname) throws DynamicStatusStoreException {

/**
* Get the prefix of a given run type
*/
*/
private String getRunTypePrefix(String runType) throws ConfigurationPropertyStoreException {
String typePrefix = AbstractManager.nulled(this.cps.getProperty("request.type." + runType, "prefix"));
if (typePrefix == null) {
@@ -416,7 +416,7 @@ private void setRunRequestDefaultsIfNotSet(SubmitRunRequest runRequest) throws F
if (AbstractManager.nulled(runRequest.getGroupName()) == null) {
runRequest.setGroupName(NO_GROUP);
}

String runType = AbstractManager.nulled(runRequest.getRunType());
if (runType == null) {
runType = NO_RUNTYPE;
@@ -468,11 +468,11 @@ private void formatSharedEnvironmentRunName(SubmitRunRequest runRequest) throws
SharedEnvironmentPhase sharedEnvironmentPhase = runRequest.getSharedEnvironmentPhase();
if (sharedEnvironmentPhase != null) {
String sharedEnvironmentRunName = runRequest.getSharedEnvironmentRunName();

if (sharedEnvironmentRunName == null || sharedEnvironmentRunName.trim().isEmpty()) {
throw new FrameworkException("Missing run name for shared environment");
}

runRequest.setSharedEnvironmentRunName(sharedEnvironmentRunName.trim().toUpperCase());
}
}