Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates Service Registry dispatch interval property name and time unit #1120

Merged
merged 8 commits into from Oct 13, 2019
2 changes: 1 addition & 1 deletion docs/guides/admin/docs/installation/multiple-servers.md
Expand Up @@ -195,4 +195,4 @@ set all servers to use the same URL (e.g. URL of the admin node).

To ensure that jobs are not dispatched by non-admin nodes, on these you should also set:

dispatchinterval=0
dispatch.interval=0
Expand Up @@ -7,7 +7,7 @@ max.attempts=1
# a mimimum value of 1s is enforced due to performance reasons. Set to 0 to disable dispatching from this service
# registry.
#Service registry dispatching should be set to 0 on everything but admin or allinone
#dispatchinterval=5000
#dispatch.interval=5
lkiesow marked this conversation as resolved.
Show resolved Hide resolved

# The interval in seconds between checking if the hosts in the service registry hosts are still alive. The default value
# is 60 seconds. Set to 0 to disable checking if hosts are still alive and able to be dispatched to.
Expand Down
Expand Up @@ -169,10 +169,10 @@ public class ServiceRegistryJpaImpl implements ServiceRegistry, ManagedService {
/** Configuration key for the maximum load */
protected static final String OPT_MAXLOAD = "org.opencastproject.server.maxload";

/** Configuration key for the dispatch interval in milliseconds */
protected static final String OPT_DISPATCHINTERVAL = "dispatchinterval";
/** Configuration key for the dispatch interval, in seconds */
protected static final String OPT_DISPATCHINTERVAL = "dispatch.interval";

/** Configuration key for the interval to check whether the hosts in the service registry are still alive [sec] * */
/** Configuration key for the interval to check whether the hosts in the service registry are still alive, in seconds */
protected static final String OPT_HEARTBEATINTERVAL = "heartbeat.interval";

/** Configuration key for the collection of job statistics */
Expand All @@ -184,14 +184,14 @@ public class ServiceRegistryJpaImpl implements ServiceRegistry, ManagedService {
/** The http client to use when connecting to remote servers */
protected TrustedHttpClient client = null;

/** Minimum delay between job dispatching attempts, in milliseconds */
static final long MIN_DISPATCH_INTERVAL = 1000;
/** Minimum delay between job dispatching attempts, in seconds */
static final long MIN_DISPATCH_INTERVAL = 1;

/** Default delay between job dispatching attempts, in milliseconds */
static final long DEFAULT_DISPATCH_INTERVAL = 5000;
/** Default delay between job dispatching attempts, in seconds */
static final long DEFAULT_DISPATCH_INTERVAL = 5;

/** Default delay before starting job dispatching, in milliseconds */
static final long DEFAULT_DISPATCH_START_DELAY = 60000;
/** Default delay before starting job dispatching, in seconds */
static final long DEFAULT_DISPATCH_START_DELAY = 60;

/** Default jobs limit during dispatching
* (larger value will fetch more entries from the database at the same time and increase RAM usage) */
Expand Down Expand Up @@ -839,9 +839,9 @@ public void updated(Dictionary properties) throws ConfigurationException {

// Schedule the job dispatching.
if (dispatchInterval > 0) {
logger.debug("Starting job dispatching at a custom interval of {}s", dispatchInterval / 1000);
logger.debug("Starting job dispatching at a custom interval of {}s", dispatchInterval);
scheduledExecutor.scheduleWithFixedDelay(new JobDispatcher(), dispatchDelay, dispatchInterval,
TimeUnit.MILLISECONDS);
TimeUnit.SECONDS);
}
}

Expand Down
Expand Up @@ -259,7 +259,7 @@ public void testHostAddedToPriorityList() throws Exception {
serviceRegistryJpaImpl.scheduledExecutor = Executors.newScheduledThreadPool(1);
serviceRegistryJpaImpl.activate(null);
Hashtable<String, String> properties = new Hashtable<>();
properties.put("dispatchinterval", "1000");
properties.put("dispatch.interval", "1");
serviceRegistryJpaImpl.updated(properties);
registerTestHostAndService();
Job testJob = serviceRegistryJpaImpl.createJob(TEST_HOST, TEST_SERVICE, TEST_OPERATION, null, null, true, null);
Expand All @@ -279,7 +279,7 @@ public void testHostAddedToPriorityListExceptWorkflowType() throws Exception {
serviceRegistryJpaImpl.scheduledExecutor = Executors.newScheduledThreadPool(1);
serviceRegistryJpaImpl.activate(null);
Hashtable<String, String> properties = new Hashtable<>();
properties.put("dispatchinterval", "1000");
properties.put("dispatch.interval", "1");
serviceRegistryJpaImpl.updated(properties);
registerTestHostAndService();
serviceRegistryJpaImpl.registerService(TEST_SERVICE_3, TEST_HOST, TEST_PATH_3);
Expand All @@ -301,7 +301,7 @@ public void testHostsBeingRemovedFromPriorityList() throws Exception {
serviceRegistryJpaImpl.scheduledExecutor = Executors.newScheduledThreadPool(1);
serviceRegistryJpaImpl.activate(null);
Hashtable<String, String> properties = new Hashtable<>();
properties.put("dispatchinterval", "1000");
properties.put("dispatch.interval", "1");
serviceRegistryJpaImpl.updated(properties);
registerTestHostAndService();
serviceRegistryJpaImpl.dispatchPriorityList.put(0L, TEST_HOST);
Expand All @@ -323,7 +323,7 @@ public void testIgnoreHostsInPriorityList() throws Exception {
serviceRegistryJpaImpl.scheduledExecutor = Executors.newScheduledThreadPool(1);
serviceRegistryJpaImpl.activate(null);
Hashtable<String, String> properties = new Hashtable<>();
properties.put("dispatchinterval", "1000");
properties.put("dispatch.interval", "1");
serviceRegistryJpaImpl.updated(properties);
registerTestHostAndService();
Job testJob = serviceRegistryJpaImpl.createJob(TEST_HOST, TEST_SERVICE_2, TEST_OPERATION, null, null, true, null);
Expand Down Expand Up @@ -376,7 +376,7 @@ public void testJobDispatchingFairness() throws Exception {
serviceRegistryJpaImpl.scheduledExecutor = Executors.newScheduledThreadPool(1);
serviceRegistryJpaImpl.activate(null);
Hashtable<String, String> properties = new Hashtable<>();
properties.put("dispatchinterval", "1000");
properties.put("dispatch.interval", "1");
serviceRegistryJpaImpl.updated(properties);
registerTestHostAndService();

Expand Down Expand Up @@ -405,7 +405,7 @@ public void testDispatchingJobsHigherMaxLoad() throws Exception {
serviceRegistryJpaImpl.scheduledExecutor = Executors.newScheduledThreadPool(1);
serviceRegistryJpaImpl.activate(null);
Hashtable<String, String> properties = new Hashtable<>();
properties.put("dispatchinterval", "1000");
properties.put("dispatch.interval", "1");
serviceRegistryJpaImpl.updated(properties);
registerTestHostAndService();
Job testJob = serviceRegistryJpaImpl.createJob(TEST_HOST, TEST_SERVICE_FAIRNESS, TEST_OPERATION, null, null, true, null,
Expand Down