Skip to content

Commit

Permalink
Updates Service Registry dispatch interval property name and time unit (
Browse files Browse the repository at this point in the history
#1120)

* Updates Service Registry dispatch interval property name and time unit

To be consistent with heartbeat interval ones

Fixes #1117
  • Loading branch information
cartucciam authored and lkiesow committed Oct 13, 2019
1 parent e4ab19e commit ad21dfb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
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
6 changes: 6 additions & 0 deletions docs/guides/admin/docs/upgrade.md
Expand Up @@ -4,6 +4,12 @@ Upgrading Opencast from 8.x to 9.x
This guide describes how to upgrade Opencast 8.x to 9.x. In case you need information about how to upgrade older
versions of Opencast, please refer to [older release notes](https://docs.opencast.org).

Configuration Changes
---------------------

1. The dispatch interval property is now called `dispatch.interval` and expects seconds instead of milliseconds
`etc/org.opencastproject.serviceregistry.impl.ServiceRegistryJpaImpl.cfg`.

How to Upgrade
--------------

Expand Down
Expand Up @@ -3,11 +3,11 @@
# Number of failed jobs on a service before to set it in error state
max.attempts=1

# The interval in milliseconds between two rounds of dispatching in the service registry. The default value is 5s, and
# The interval in seconds between two rounds of dispatching in the service registry. The default value is 5s, and
# 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

# 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

0 comments on commit ad21dfb

Please sign in to comment.