Skip to content

Commit 2d5a4e2

Browse files
committed
add config setting for execution schedule timeout
remove constant for timeout threshold
1 parent 18c4a0e commit 2d5a4e2

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

conf/st2.conf.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ pool_size = 10
279279
retry_wait_msec = 3000
280280
# How often (in seconds) to look for zombie execution requests before rescheduling them.
281281
gc_interval = 10
282+
# Number of minutes after which a execution schedule will be rescheduled
283+
execution_scheduling_timeout_threshold_min = 10
282284

283285
[schema]
284286
# Version of JSON schema to use.

st2actions/st2actions/scheduler/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ def _register_service_opts():
5050
default='/etc/st2/logging.scheduler.conf',
5151
help='Location of the logging configuration file.'
5252
),
53+
cfg.FloatOpt(
54+
'execution_scheduling_timeout_threshold_min', default=5,
55+
help='How long GC to search back in minutes for orphaned scheduled actions'),
5356
cfg.IntOpt(
5457
'pool_size', default=10,
5558
help='The size of the pool used by the scheduler for scheduling executions.'),

st2actions/st2actions/scheduler/handler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
# (< 5 seconds). If an item is still being marked as processing it likely indicates that the
5151
# scheduler process which was processing that item crashed or similar so we need to mark it as
5252
# "handling=False" so some other scheduler process can pick it up.
53-
EXECUTION_SCHEDUELING_TIMEOUT_THRESHOLD_MS = (60 * 1000)
5453

5554
# When a policy delayed execution is detected it will be try to be rescheduled by the scheduler
5655
# again in this amount of milliseconds.
@@ -62,6 +61,9 @@ def __init__(self):
6261
self.message_type = LiveActionDB
6362
self._shutdown = False
6463
self._pool = eventlet.GreenPool(size=cfg.CONF.scheduler.pool_size)
64+
self._execution_scheduling_timeout_threshold_min = \
65+
cfg.CONF.scheduler.execution_scheduling_timeout_threshold_min \
66+
* 60 * 1000
6567
self._coordinator = coordination_service.get_coordinator(start_heart=True)
6668
self._main_thread = None
6769
self._cleanup_thread = None
@@ -100,7 +102,7 @@ def _reset_handling_flag(self):
100102
query = {
101103
'scheduled_start_timestamp__lte': date.append_milliseconds_to_time(
102104
date.get_datetime_utc_now(),
103-
-EXECUTION_SCHEDUELING_TIMEOUT_THRESHOLD_MS
105+
-self._execution_scheduling_timeout_threshold_min
104106
),
105107
'handling': True
106108
}

st2tests/st2tests/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ def _register_ssh_runner_opts():
283283

284284
def _register_scheduler_opts():
285285
scheduler_opts = [
286+
cfg.FloatOpt(
287+
'execution_scheduling_timeout_threshold_min', default=5,
288+
help='How long GC to search back in minutes for orphaned scheduled actions'),
286289
cfg.IntOpt(
287290
'pool_size', default=10,
288291
help='The size of the pool used by the scheduler for scheduling executions.'),

0 commit comments

Comments
 (0)