Skip to content

Commit

Permalink
add config setting for execution schedule timeout
Browse files Browse the repository at this point in the history
remove constant for timeout threshold
  • Loading branch information
guzzijones committed Apr 8, 2020
1 parent 18c4a0e commit 2d5a4e2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions conf/st2.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ pool_size = 10
retry_wait_msec = 3000
# How often (in seconds) to look for zombie execution requests before rescheduling them.
gc_interval = 10
# Number of minutes after which a execution schedule will be rescheduled
execution_scheduling_timeout_threshold_min = 10

[schema]
# Version of JSON schema to use.
Expand Down
3 changes: 3 additions & 0 deletions st2actions/st2actions/scheduler/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def _register_service_opts():
default='/etc/st2/logging.scheduler.conf',
help='Location of the logging configuration file.'
),
cfg.FloatOpt(
'execution_scheduling_timeout_threshold_min', default=5,
help='How long GC to search back in minutes for orphaned scheduled actions'),
cfg.IntOpt(
'pool_size', default=10,
help='The size of the pool used by the scheduler for scheduling executions.'),
Expand Down
6 changes: 4 additions & 2 deletions st2actions/st2actions/scheduler/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
# (< 5 seconds). If an item is still being marked as processing it likely indicates that the
# scheduler process which was processing that item crashed or similar so we need to mark it as
# "handling=False" so some other scheduler process can pick it up.
EXECUTION_SCHEDUELING_TIMEOUT_THRESHOLD_MS = (60 * 1000)

# When a policy delayed execution is detected it will be try to be rescheduled by the scheduler
# again in this amount of milliseconds.
Expand All @@ -62,6 +61,9 @@ def __init__(self):
self.message_type = LiveActionDB
self._shutdown = False
self._pool = eventlet.GreenPool(size=cfg.CONF.scheduler.pool_size)
self._execution_scheduling_timeout_threshold_min = \
cfg.CONF.scheduler.execution_scheduling_timeout_threshold_min \
* 60 * 1000
self._coordinator = coordination_service.get_coordinator(start_heart=True)
self._main_thread = None
self._cleanup_thread = None
Expand Down Expand Up @@ -100,7 +102,7 @@ def _reset_handling_flag(self):
query = {
'scheduled_start_timestamp__lte': date.append_milliseconds_to_time(
date.get_datetime_utc_now(),
-EXECUTION_SCHEDUELING_TIMEOUT_THRESHOLD_MS
-self._execution_scheduling_timeout_threshold_min
),
'handling': True
}
Expand Down
3 changes: 3 additions & 0 deletions st2tests/st2tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ def _register_ssh_runner_opts():

def _register_scheduler_opts():
scheduler_opts = [
cfg.FloatOpt(
'execution_scheduling_timeout_threshold_min', default=5,
help='How long GC to search back in minutes for orphaned scheduled actions'),
cfg.IntOpt(
'pool_size', default=10,
help='The size of the pool used by the scheduler for scheduling executions.'),
Expand Down

0 comments on commit 2d5a4e2

Please sign in to comment.