diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/BasicAuthCredentials.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/BasicAuthCredentials.java index db80f53456468c618d044bb166881b38b24c2a49..0fd30e7beda75d91389358dc6b633082563a4adf 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/BasicAuthCredentials.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/BasicAuthCredentials.java @@ -23,11 +23,11 @@ package ch.ethz.sis.openbis.generic.server.dss.plugins.sync.harvester.config; */ public class BasicAuthCredentials { - private String realm; + private final String realm; - private String user; + private final String user; - private String password; + private final String password; public BasicAuthCredentials(String realm, String user, String pass) { @@ -41,28 +41,13 @@ public class BasicAuthCredentials return realm; } - public void setRealm(String realm) - { - this.realm = realm; - } - public String getUser() { return user; } - public void setUser(String user) - { - this.user = user; - } - public String getPassword() { return password; } - - public void setPassword(String pass) - { - this.password = pass; - } } diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/ParallelizedExecutionPreferences.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/ParallelizedExecutionPreferences.java new file mode 100644 index 0000000000000000000000000000000000000000..5982b517731e46255857bc5704c6cdbc1d73d64d --- /dev/null +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/ParallelizedExecutionPreferences.java @@ -0,0 +1,61 @@ +/* + * Copyright 2017 ETH Zuerich, SIS + * + * 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 ch.ethz.sis.openbis.generic.server.dss.plugins.sync.harvester.config; + +/** + * + * + * @author Ganime Betul Akin + */ +public class ParallelizedExecutionPreferences +{ + private final Double machineLoad; + + private final Integer maxThreads; + + private final Integer retriesOnFail; + + private final Boolean stopOnFailure; + + public double getMachineLoad() + { + return machineLoad; + } + + public int getMaxThreads() + { + return maxThreads; + } + + public int getRetriesOnFail() + { + return retriesOnFail; + } + + public boolean isStopOnFailure() + { + return stopOnFailure; + } + + public ParallelizedExecutionPreferences(Double machineLoad, Integer maxThreads, Integer retriesOnFail, Boolean stopOnFailure) + { + this.machineLoad = machineLoad; + this.maxThreads = maxThreads; + this.retriesOnFail = retriesOnFail; + this.stopOnFailure = stopOnFailure; + } +} diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/SyncConfig.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/SyncConfig.java index 0acaabd6d1abda80dd90faacedd73d07ec3be188..6811f614b8e93314e8e707f57e14e93982b1cb3e 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/SyncConfig.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/SyncConfig.java @@ -183,6 +183,9 @@ public class SyncConfig // the data source openbis private BasicAuthCredentials authCredentials; + // Data sets and attachment downloads are parallelized + private ParallelizedExecutionPreferences parallelizedExecutionPrefs; + // the username/password pair to be used on the harvester side // to get the session token private String harvesterUser; @@ -320,4 +323,9 @@ public class SyncConfig { this.verbose = verbose; } + + public void setParallelizedExecutionPrefs(double machineLoad, int maxThreads, int retriesOnFailure, boolean stopOnFailure) + { + this.parallelizedExecutionPrefs = new ParallelizedExecutionPreferences(machineLoad, maxThreads, retriesOnFailure, stopOnFailure); + } } diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/SynchronizationConfigReader.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/SynchronizationConfigReader.java index 4cdfb46bc5ae063b1bdc5ccdbe6a922e17b7c572..32a26fab19c9349cdaaf655321b1d76b16c23cd0 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/SynchronizationConfigReader.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/config/SynchronizationConfigReader.java @@ -80,6 +80,14 @@ public class SynchronizationConfigReader private static final String VERBOSE_PROPERTY_NAME = "verbose"; + private static final String PARALLELIZED_EXECUTION_PREFS_MACHINE_LOAD_PROPERTY_NAME = "machine-load"; + + private static final String PARALLELIZED_EXECUTION_PREFS_MACHINE_MAX_THREADS_PROPERTY_NAME = "max-threads"; + + private static final String PARALLELIZED_EXECUTION_PREFS_RETRIES_ON_FAILURE_PROPERTY_NAME = "retries-on-failure"; + + private static final String PARALLELIZED_EXECUTION_PREFS_STOP_ON_FIRST_FAILURE_PROPERTY_NAME = "stop-on-first-failure"; + private Integer defaultFullSyncIntervalInDays = 14; private String defaultLogFileName = "synchronization_{alias}.log"; @@ -88,6 +96,14 @@ public class SynchronizationConfigReader private String defaultNotSyncedEntitiesFileName = "not-synced-entities_{alias}.txt"; + private Double defaultMachineLoad = 0.5; + + private Integer defaultMaxThreads = 10; + + private Integer defaultRetriesOnFailure = 0; + + private Boolean defaultStopOnFirstFailure = false; + private static final String LOG_FILE_PROPERTY_NAME = "log-file"; List<SyncConfig> configs = new ArrayList<>(); @@ -160,6 +176,16 @@ public class SynchronizationConfigReader { config.setVerbose(true); } + + Double machineLoad = reader.getDouble(section, PARALLELIZED_EXECUTION_PREFS_MACHINE_LOAD_PROPERTY_NAME, defaultMachineLoad, false); + Integer maxThreads = + reader.getInt(section, PARALLELIZED_EXECUTION_PREFS_MACHINE_MAX_THREADS_PROPERTY_NAME, defaultMaxThreads, false); + Integer retriesOnFailure = + reader.getInt(section, PARALLELIZED_EXECUTION_PREFS_RETRIES_ON_FAILURE_PROPERTY_NAME, defaultRetriesOnFailure, false); + Boolean stopOnFailure = + reader.getBoolean(section, PARALLELIZED_EXECUTION_PREFS_STOP_ON_FIRST_FAILURE_PROPERTY_NAME, defaultStopOnFirstFailure); + config.setParallelizedExecutionPrefs(machineLoad, maxThreads, retriesOnFailure, stopOnFailure); + } return configs; }