3124 Commits

Author SHA1 Message Date
Brad P. Crochet
6bd96d70b1 Add yaml and json parsing functions
Sometimes you'll get a string back from some action (like swift
get_object) and it will be in either a yaml or json format. These
functions will allow you to parse those into a useful object.

Change-Id: I375219f4b019319e1b3d756dca512f7f90cd097f
2017-10-12 16:50:03 -04:00
Renat Akhmerov
f6b6f1d20b Make scheduler delay configurable
* Made scheduler delay configurable. It now consists of a fixed
  part configured with the 'fixed_delay' property and a random
  addition limited by the 'random_delay' config property.
  Because of this, using loopingcall from oslo was replaced with
  a regular loop in a separate thread becase loopingcall
  supports only fixed delays.

Closes-Bug: #1721733
Change-Id: I8f6a15be339e208755323afb18e4b58f886770c1
2017-10-09 01:39:19 +00:00
Renat Akhmerov
14c8d807b1 Optimize sending result to parent workflow
* If a subworkflow completes it sends its result to a parent
  workflow by using the scheduler (delayed call) which operates
  through the database and has a delay between iterations.
  This patch optimizes this by reusing already existing
  decorator @action_queue.process to make RPC calls to convey
  subworkflow results outside of a DB transaction, similar
  way as we schedule action runs after completion of a task.
  The main reason for making this change is how Scheduler now
  works in HA mode. In fact, it doesn't scale well because
  every Scheduler instance keeps quering DB for delayed calls
  eligible for processing and hence in HA setup many Schedulers
  take same delayed calls often and clash between each other
  causing DB deadlocks in mysql. They are caused just by mysql
  locking model (it's documented in their docs) so we have
  means to handle them. However, Scheduler still remans a
  bottleneck in the system and it's better to reduce the load
  on it as much as possible.
  One more reason to make this change is that we don't solve
  the problem of eleminating the possibility to loose RPC
  messages (when a DB TX is committed and RPC calls is not made
  yet) with Scheduler anyway. If we use Scheduler for scheduling
  RPC calls we just shift the place where we can unsync DB and
  MQ to the Scheduler. So, in other words, it is a fundamental
  problem of syncing two external data sources which can't be
  naturally enrolled into one distributed transaction.
  Based on our experience or running big workflows we concluded
  that simplication of network protocols gives better results,
  meaning that the less components we use for network
  communications the better. Eventually it increases performance
  and reduces the load on the system and also reduces the
  probability of having DB and MQ out of sync.
  We used to use Scheduler for running actions on executors too by
  scheduling RPC calls but at some point we saw that it reduces
  performance on 40-50% without bringing any real benefits at
  this expense. The opposite way, Scheduler was even a worse
  bottleneck because of this. So we decided to eliminate the
  Scheduler from this chain and the system became practically
  much more performant and reliable. So now I did the same
  with delivering a subworkflow result.
  I believe when it comes to recovering from situations of
  DB and MQ being out of sync we need to come up with special
  tools that will assume some minimal human intervention
  (although I think we can recover some things automatically).
  Such a tool should just make it very obvious what's broken
  and how to fix it, and make it convenient to fix it (restart
  a task/action etc.).
* Processing action queue now happens within a new greenthread
  because otherwise Mistral engine can get into a deadlock
  by sending a request to itself while processing another one.
  It can happen if we use blocking RPC which is the only option
  for now.
* Other small fixes

Change-Id: Ic3cf6c47bba215dc6a13944b0585cce59e4e88f9
2017-10-09 01:38:33 +00:00
Jenkins
ea0c07cac1 Merge "Mistral fails on RabbitMQ restart" 2017-10-06 11:49:57 +00:00
Jenkins
93098293ab Merge "Added created_at and updated_at fields to functions task() and exection()" 2017-10-06 10:43:40 +00:00
Nick Maludy
2871812788 Added created_at and updated_at fields to functions task() and exection()
Change-Id: Iecc1b87e00d9457ae124cb0b8fd46b3fb36d08ff
2017-10-06 03:47:53 +00:00
Bob.Haddleton
91ce8986f2 Allow mistral actions to run when authentication is not configured.
Use the configured API host and port for the mistal URL, which defaults
to 0.0.0.0 and 8989,

Change-Id: I154b3dc174a9c40887729bb3f8866d5c2316cd12
Closes-Bug: 1709677
2017-10-06 03:44:39 +00:00
Andras Kovi
68a44fd724 Mistral fails on RabbitMQ restart
Turns on the 'confirmation' for message publishing in the
Kombu RPC client.

Fixes the a race condition in the Kombu RPC client between the
reply queue being declared and the listener being started and
the reply being sent by the server side.

Fixes the Kombu RPC server not resetting the sleep timer after
successful connection to the MQ service.

Change-Id: I0db1cb4c2de7f2c7415825b28e961076870038bf
Closes-Bug: 1718883
2017-10-06 03:44:00 +00:00
Jenkins
58ec9c4ffe Merge "Add actions for the ironic virtual network interface commands" 2017-10-05 20:09:58 +00:00
Andreas Jaeger
c3eb6d6b20 remove all common jobs
A couple of jobs should remain in project-config, remove them here.

Change-Id: I9240bf13de5f63873f233a0cb335b3ef43c1bf0a
2017-10-05 20:35:48 +02:00
Jenkins
8e8a7c342f Merge "Add get cron-trigger by id support" 2017-10-05 15:34:50 +00:00
Dougal Matthews
9e5d57dadb Add actions for the ironic virtual network interface commands
To do this we need to update the Ironic API version to the latest stable
release.

Change-Id: I60101883db26f679aa833e8b5638225d9fb93761
2017-10-05 14:29:29 +00:00
int32bit
f84952a3b1 Add get cron-trigger by id support
Currently we can only do a CURD action on a cron-trigger by name.
This patch refer to workflow implementation and re-encapsulate
DB API so that users can manage a cron-trigger by id or name.

Closes-Bug: 1684469

Change-Id: I9ff657b2604647e734b5539e9bd6a524a3a20efb
2017-10-05 11:41:00 +00:00
Adriano Petrich
3ce34674cf Dynamic action name evaluation.
Evaluate action names dynamically, so yaql or jinja expression can be
used

Change-Id: I48761c215f0255976c330ffa34f27bb695c944a9
Implements: blueprint mistral-dynamic-actions
2017-10-05 03:30:59 +00:00
Jenkins
b791850ba2 Merge "Update README with Keystone authtoken config" 2017-10-04 12:02:21 +00:00
Brad P. Crochet
098845e691 Migrate Mistral jobs to Zuul v3
Change-Id: I2164953581efad6da2354f781b0567d6125bc5aa
Partial-Bug: #1720797
2017-10-03 09:46:16 -04:00
Jenkins
def783c60a Merge "Add project_id to API resources" 2017-09-28 07:05:07 +00:00
OpenStack Proposal Bot
c07f281116 Updated from global requirements
Change-Id: Ia947c164a699719a4fc79fe1ed4139d31d88f4cf
2017-09-26 03:28:03 +00:00
Brad P. Crochet
fbee074a3f Update README with Keystone authtoken config
Change-Id: Ic9f51dd55fe881417454b1b8d0c414acba7d7022
2017-09-22 15:42:53 -04:00
Jenkins
35ccebc284 Merge "Replace @loopingcall.RetryDecorator with @tenacity.retry" 2017-09-22 10:59:56 +00:00
Renat Akhmerov
6ad421b34c Replace @loopingcall.RetryDecorator with @tenacity.retry
* It turns out that the behaviour of looping.RetryDecorator from
  oslo.service is different than what was expected. See
  https://bugs.launchpad.net/oslo.service/+bug/1718635 for
  details. This patch replaces it with a similar decorator from
  tenacity library.

Change-Id: I2d8a7f2b430e26991cc13a88ad33c1266c82d113
2017-09-22 11:42:21 +07:00
Jenkins
466c45b1e4 Merge "Updated from global requirements" 2017-09-21 17:22:17 +00:00
Jenkins
455d495261 Merge "Removed NOT IN query from expiration policy." 2017-09-21 16:38:33 +00:00
OpenStack Proposal Bot
e1d881c1fe Updated from global requirements
Change-Id: I3046c5bfeecdb378d387a3b0b01f89307e65f0d0
2017-09-21 13:30:47 +00:00
Kupai József
5c0b720da2 Removed NOT IN query from expiration policy.
NOT IN subquery with limit is not supported by some databases.

Closes-bug: #1712585
Change-Id: Ieeb6629cc6c2fc0794ac9a0ef731816c2b6ea59b
2017-09-21 12:45:21 +02:00
Jenkins
43343dc87a Merge "Use @db_utils.retry_on_deadlock to retry scheduler transactions" 2017-09-20 16:46:48 +00:00
Jenkins
b8d1e096e4 Merge "Add README.mistral.conf doc in etc directory" 2017-09-20 14:16:49 +00:00
Jenkins
fd127e36ef Merge "Add root_execution_id to sub-workflow executions" 2017-09-20 12:00:13 +00:00
Jenkins
06cacce371 Merge "Update URL and indentations" 2017-09-20 09:51:18 +00:00
Renat Akhmerov
a995916f14 Use @db_utils.retry_on_deadlock to retry scheduler transactions
* Since scheduler has transactional logic we need to account for
  cases when these transactions hit DB deadlocks. It is possible
  just due to MySQL nature, it's recommended to always design
  based on that. This patch decomposes one big scheduler method
  that processes delayed calls into smaller methods so that we
  could apply @db_utils.retry_on_deadlock decorator to repeat
  transactions if they fail because of a deadlock in MySQL.
* Fixed taskk state update when we're assiging it to RUNNING.
  In this case we can't set it to RUNNING if there any paused
  child executions.
* Fixed the test for cascaded pausing which didn't account
  non-atomicity of this operation

Closes-Bug: #1715589
Change-Id: Iffa0fb540a5705c587d71d30af6ab913b26d3952
2017-09-20 16:09:02 +07:00
Jenkins
7627c5d9f9 Merge "TrivialFix: pretty format the json code block" 2017-09-18 08:53:24 +00:00
OpenStack Proposal Bot
d2fb3612e5 Updated from global requirements
Change-Id: Ia8cc08f84d0c38929bc93bc8441296d16e89f52e
2017-09-16 23:14:34 +00:00
int32bit
2018962568 Add project_id to API resources
Currently our API doesn't return any project info in many resources, like
execution, cron-trigger, workbook, etc. As a essential property in those
resources, it's really helpful for users to process resources if we
return project_id in resource endpoints.

Closes-Bug: 1707573
Closes-Bug: 1694398

Change-Id: I866d20cf1f5129b6249140063aa0836f63626767
2017-09-15 19:43:47 +08:00
junboli
47fae66fe0 Add README.mistral.conf doc in etc directory
Currently, the mistral.conf can be generated by tox, So add the
README.mistral.conf is useful.

Change-Id: I657b0d193a8f53dd86ed7b5bf228310eddbecd75
2017-09-15 04:21:12 +00:00
junboli
76bafad3ec TrivialFix: pretty format the json code block
In the file doc/source/user/dsl_v2.rst, the json format of
task publish result is not well formated, this change is to
pretty format the json code block

Change-Id: I783472c1d7c13cd7b6a464325cf7213abf3ac359
2017-09-15 01:35:33 +00:00
Dougal Matthews
053308e7c3 Add root_execution_id to sub-workflow executions
For sub-workflow executions this will be the ID of the initial workflow
execution. For example, given the following workflows.

workflows:
  wf1:
    tasks:
      task1:
        workflow: wf2

  wf2:
    tasks:
      task1:
        workflow: wf3

  wf3:
    tasks:
      task1:
        action: std.noop

When we start wf1, it calls wf2 which calls wf3. Currently, it is hard to
retrieve the full execution, including sub-workflow executions. This patch adds
the root_execution_id to the sub-workflows, so the execution for wf2 and wf3
have a root_execution_id that is the ID of the execution for wf1. The execution
for wf1 is the root execution, so root_execution_id is None. This basically
gives us a flat reference to the graph of workflow executions.

This change is useful as we can then expose it via the API and it makes
it easier and more efficient to find a full execution, including it's
sub-workflow executions.

Implements: blueprint mistral-root-execution-id
Change-Id: I24638812caa2e48e3c071925db5e552b21e15d47
2017-09-14 11:26:36 +01:00
OpenStack Proposal Bot
0b03640018 Updated from global requirements
Change-Id: I8fe4448be3551e43ddc641d714b7aa719d6b0b26
2017-09-13 12:52:59 +00:00
Jenkins
a03410a875 Merge "Cleanup test_std_http_action" 2017-09-13 10:56:47 +00:00
Jenkins
4a1e9ea2bd Merge "Add mistral/tests/unit/expressions/__init__.py" 2017-09-12 09:53:08 +00:00
Jenkins
33143d324d Merge "Updated from global requirements" 2017-09-12 04:26:31 +00:00
Jenkins
2b985feb0b Merge "Fixes issue rendering strings containing multiple jinja expressions" 2017-09-12 04:20:43 +00:00
Bob Haddleton
4dbacfe1a1 Add mistral/tests/unit/expressions/__init__.py
This patchset adds the __init__.py file to mistral/tests/unit/expressions
to enable those tests to run, and updates the Jinja tests to include
the created_at attribute.

Closes-Bug: 1716452

Change-Id: I5c7af1cd4a2777764a2a46adf85129e4cb90e4d8
2017-09-11 18:38:36 -05:00
OpenStack Proposal Bot
af7a9153f4 Updated from global requirements
Change-Id: I56ec40c6df64df5625cf66c4edc908143b6c5042
2017-09-11 21:39:11 +00:00
Andras Kovi
e416188ebc Cleanup test_std_http_action
Cleaned up redundant assertions to make tests independent and
focused.

Change-Id: I35ca39473e89a884f3e6babd0ba89d61f1434562
2017-09-11 10:27:10 +02:00
Nick Maludy
10b27fcdea Fixes issue rendering strings containing multiple jinja expressions
Closes-Bug: #1712133
Change-Id: I058e9858e4a4a9a94e0948df38758446e68bf5b9
2017-09-09 11:59:49 -04:00
Jenkins
eccd7a0bb7 Merge "Handle case with None encoding during std.http action execution" 2017-09-09 09:18:30 +00:00
Jenkins
fdaec7edd3 Merge "Clean up screen and tail_log references" 2017-09-08 10:59:23 +00:00
Anastasia Kuznetsova
178369459f Handle case with None encoding during std.http action execution
During some cases resp.content may have a context not in json format
and with 'None' in the resp.encoding. Need to properly handle this
situation and don't try to pass 'None' as an argument to decode.

Change-Id: Id87d650996f16b5ffab79d72413134a4c7fe9ca9
Closes-Bug: #1700608
2017-09-08 12:50:07 +02:00
Jenkins
5aad444d56 Merge "Fix services launcher to handle shutdown properly" 2017-09-08 10:00:41 +00:00
Jenkins
7a74b6d6fd Merge "Catch DBEntityNotFoundError exceptions for invalid AdHoc Actions" 2017-09-08 09:53:24 +00:00