Skip to content

Commit

Permalink
add config setting for execution schedule timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
guzzijones committed Apr 14, 2020
1 parent 18c4a0e commit 6e30c5f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Added
* Add ``get_entrypoint()`` method to ``ActionResourceManager`` attribute of st2client.
#4791
* Add support for orquesta task retry. (new feature)
* Add config option ``scheduler.execution_scheduling_timeout_threshold_min``. Fixes #4887

Changed
~~~~~~~
Expand Down
3 changes: 2 additions & 1 deletion 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
# How often in minutes to check for unscheduled actions
execution_scheduling_timeout_threshold_min = 1

[schema]
# Version of JSON schema to use.
Expand Down Expand Up @@ -379,4 +381,3 @@ retry_max_jitter_msec = 1000
retry_wait_fixed_msec = 1000
# Max seconds to allow workflow execution be idled before it is identified as orphaned and cancelled by the garbage collector. A value of zero means the feature is disabled. This is disabled by default.
gc_max_idle_sec = 0

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=1,
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_ms = \
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_ms
),
'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=1,
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 6e30c5f

Please sign in to comment.