mistral/mistral/tests/unit/engine
Renat Akhmerov 3d7acd3957 Improve workflow completion logic by removing periodic jobs
* Workflow completion algorithm use periodic scheduled jobs to
  poll DB and determine when a workflow is finished. The problem
  with this approach is that if Mistral runs another iteration
  of such job too soon then running such jobs will create a big
  load on the system. If too late, then a workflow may be in
  RUNNING state for too long after all its tasks are completed.
  The current implementation tries to predict a delay with which
  the next job should run, based on a number of incompleted tasks.
  This approach was initially taken because we switched to a
  non-blocking transactional model (previously we locked the entire
  workflow execution graph in order to change a state of anything)
  and in this architecture, when we have parallel branches, i.e.
  parallel DB transactions, we can't make a consistent read from
  DB from neither of these transactions to make a reliable decision
  about whether the workflow is completed or not. Using periodic
  jobs was a solution. However, this approach has been proven to
  work unreliably because such a prediction about delay before the
  next job iteration doesn't work well on all variety of use cases
  that we have.
  This patch removes using periodic jobs in favor of using the
  "two transactions" approach when in the first transaction we
  handle action completion event (and task completion if it causes
  it) and in the second transaction, if a task is completed, we
  check if the workflow is completed. This approach guarantees
  that at least one of the "second" transactions in parallel
  branches will make needed consistent read from DB (i.e. will
  see the actuall state of all needed objects) to make the right
  decision.

Closes-Bug: #1799382
Change-Id: I2333507503b3b8226c184beb0bd783e1dcfa397f
2018-11-07 04:00:04 +00:00
..
__init__.py Renaming "engine1" to "engine" 2015-04-09 17:47:36 +06:00
base.py Improve join by removing periodic jobs 2018-10-23 14:01:39 +07:00
test_action_context.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_action_defaults.py Get rid of a extra copy of workflow environment 2018-04-27 19:47:32 +07:00
test_adhoc_actions.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_commands.py Fix 'pause' engine command 2018-03-24 11:10:08 +00:00
test_cron_trigger.py Fix flaky cron trigger test 2018-07-30 14:03:09 +02:00
test_dataflow.py Consider size of output_on_error 2018-02-08 05:55:29 +00:00
test_default_engine.py Improve workflow completion logic by removing periodic jobs 2018-11-07 04:00:04 +00:00
test_direct_workflow.py Improve workflow completion logic by removing periodic jobs 2018-11-07 04:00:04 +00:00
test_direct_workflow_rerun.py An execution hangs in the RUNNING state after rerun 2018-10-14 10:29:16 +00:00
test_direct_workflow_rerun_cancelled.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_direct_workflow_with_cycles.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_environment.py Do not copy workflow environment into subworkflows 2018-04-27 20:08:56 +07:00
test_error_handling.py Remove a redundant initializer of InvalidUnicodeAction in the tests 2018-03-14 15:16:24 +07:00
test_error_result.py Return the result of the MistralHTTPAction 2018-07-16 11:43:26 +01:00
test_execution_fields_size_limitation.py Fixed workflow output in case of execution_field_size_limit_kb 2018-05-02 12:12:14 +04:00
test_execution_params.py Fix WF execution getting stuck on null description 2018-04-02 15:00:36 +05:30
test_integrity_check.py Improve workflow completion logic by removing periodic jobs 2018-11-07 04:00:04 +00:00
test_javascript_action.py Added JavaScript evaluator which doesn't require a compilation 2018-04-23 17:04:18 +00:00
test_join.py Improve workflow completion logic by removing periodic jobs 2018-11-07 04:00:04 +00:00
test_lookup_utils.py Use mock to patch lookup_utils._ACTION_DEF_CACHE 2018-08-22 13:22:20 +01:00
test_noop_task.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_policies.py Get rid of a extra copy of workflow environment 2018-04-27 19:47:32 +07:00
test_profiler.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_race_condition.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_reverse_workflow.py Get rid of a extra copy of workflow environment 2018-04-27 19:47:32 +07:00
test_reverse_workflow_rerun.py Get rid of a extra copy of workflow environment 2018-04-27 19:47:32 +07:00
test_reverse_workflow_rerun_cancelled.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_run_action.py Propagated a task timeout to a action execution 2018-01-31 17:40:52 +04:00
test_safe_rerun.py Added 'safe-rerun' policy to task-defaults section 2018-04-23 20:46:43 +04:00
test_set_state.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_state_info.py Fix malformed state_info when json is set to it 2018-04-09 18:24:21 +05:30
test_subworkflows.py Use "passive_deletes=True" in ORM relationships 2018-05-15 16:04:02 +07:00
test_subworkflows_pause_resume.py Improve join by removing periodic jobs 2018-10-23 14:01:39 +07:00
test_task_cancel.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_task_defaults.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_task_pause_resume.py Cascade pause and resume to and from subworkflows 2017-08-07 20:40:15 +00:00
test_task_publish.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_tasks_function.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_with_items.py A mechanism to close stuck running action executions 2018-06-12 14:15:15 +00:00
test_with_items_task.py Get rid of with_items.py module in favor of WithItemsTask class 2016-12-20 16:31:29 +07:00
test_workflow_cancel.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_workflow_resume.py Get rid of a extra copy of workflow environment 2018-04-27 19:47:32 +07:00
test_workflow_stop.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_workflow_variables.py Make workflow execution creation idempotent 2018-01-04 14:07:12 +01:00
test_yaql_functions.py Add YAQL engine options 2018-06-01 17:06:57 +07:00