Commit Graph

13 Commits

Author SHA1 Message Date
Renat Akhmerov 6b0ff4b6c0 Delete redundant print()
* Seems like it is a left over after the big refactoring.

Change-Id: I2827e334d5b1fce844e45c5ca4240c11dc10db0e
2020-12-14 06:57:00 +00:00
Renat Akhmerov 06a0f33476 Refactor Mistral with Action Providers
* This patch refactors Mistral with the action provider concept
  that is responsible for delivering actions to the system. So
  it takes all the burden of managing action definitions w/o
  having to spread that across multiple subsystems like Engine
  and API and w/o having to assume that action definitions are
  always stored in DB.
* Added LegacyActionProvider  that represents the old way of
  delivering action definitions to the system. It pretty much just
  analyses what entries are configured in the entry point
  "mistral.actions" in setup.cfg and build a collection of
  corresponding Python action classes in memory accessible by names.
* The module mistral/services/actions.py is now renamed to
  adhoc_actions.py because it's effectively responsible only for
  ad-hoc actions (those defined in YAML).
* Added the new entry point in setup.cfg "mistral.action.providers"
  to register action provider classes
* Added the module mistral/services/actions.py that will be a facade
  for action providers. Engine and other subsystems will need to
  work with it.
* Other small code changes.

Depends-On: I13033253d5098655a001135c8702d1b1d13e76d4
Depends-On: Ic9108c9293731b3576081c75f2786e1156ba0ccd
Change-Id: I8e826657acb12bbd705668180f7a3305e1e597e2
2020-09-24 11:10:33 +00:00
Eyal 8bdf341af7 Remove OpenStack actions from mistral
Depends-on: https://review.opendev.org/#/c/703296/
Depends-On: https://review.opendev.org/#/c/704280/
Change-Id: Id62fdabe7699e7c3b2977166e253cfc77779e467
2020-02-26 10:12:01 +02:00
ali 20c3408692 Add namespaces to Ad-Hoc actions
added namespace for the actions, actions can have the same name if they
 are not in the same namespace, when executing an action, if an action
 with that name is not found in the workflow namespace or given
 namespace mistral will look for that action in the default namespace.

  * action base can only be in the same namespace,or in the
    default namespace.
  * Namespaces are not part of the mistral DSL.
  * The default namespace is an empty string ''.
  * all actions will be in a namespace, if not specified, they will be
    under default namespace

Depends-On: I61acaed1658d291798e10229e81136259fcdb627
Change-Id: I07862e30adf28404ec70a473571a9213e53d8a08
Partially-Implements: blueprint create-and-run-workflows-within-a-namespace
Signed-off-by: ali <ali.abdelal@nokia.com>
2020-01-07 08:10:53 +00:00
Renat Akhmerov 7ec4f26744 Make action heartbeats work for all executor types
* Previously action hearbeats didn't work in case of using local
  executors because the component responsible for sending heartbeats
  was started by the executor RPC server which doesn't make sense to
  initialize for a local executor. This patch refactors the code
  so that now heartbeats get sent for any type of executors. For
  local executors it is also useful because a cluster node that
  runs an engine and a local executor may also crash. With this
  change, remaining cluster nodes will be able to understand that
  the action will never complete and one of them will time it out.
  If all is fine with the node where the local executor is running
  then heartbeats will be sent normally and the action won't time
  out. Before this change, in case of local executors a long running
  action would always time out after a configured amount of time
  (by default, 60 mins) just because local executors never sent
  heartbeats.
* Made a lot of renamings to clearly see what component is
  responsible for.
* Wrote the tests that check the heartbeat sender, both positive
  and negative scenarios for local and remote executor types.

Closes-Bug: #1852722

Change-Id: I4d0fdff54de9bee70aeaf10a4ef483ad7000840b
2019-11-15 16:44:40 +07:00
Renat Akhmerov 8f02e8a7d7 Change the action error message format
* Some users rely on the presence of the root error related to
  running an action and it's not convenient that it is now in
  the end of the string, e.g. if we look at the corresponding
  task execution "state_info" field. This patch includes the cause
  error message in the beginning of the resulting error string
  returned by the action executor so that it's clearly visible.
  This message can be also truncated in some cases (depending on
  the config option) so we need to make sure we keep the cause
  error message.

Closes-Bug: #1847984
Change-Id: Ieb10c10401380410665c418f4688681e929b1e23
2019-10-14 17:08:44 +07:00
Dougal Matthews df46ec72b9 Clarify what an exception from an action means
When Python actions raise an exception they may not have failed to run.
This may not even be an issue. For example, the OpenStack action
`swift.head_container` will raise an exception is the container doesn't
exist.

This change lowers the exception to a warning but keeps the exception
traceback in the logs. It also changes the wording in the message. We
didn't fail to run the action, rather the action raise an exception.

Change-Id: If9a6a3b98999acae8b80ad4ddeb9d197a628c280
2018-07-31 15:00:11 +01:00
Vitalii Solodilov b79f91e9ec Propagated a task timeout to a action execution
It shall be possible to specify timeout for Mistral actions in order
to cancel some long-performed action so that to provide predictable
execution time for client service.
Currently Mistral allows configure timeout on task and automatically
changes task status to error. However mistral don't interrupt action
execution.
We need Mistral to terminate timed out action execution, because there
might be the following issues:
* several the same action executions can run at the same time breaking
data consistency
* stale action executions may lead to the massive resources
consumption (memory, cpu..)

Change-Id: I2a960110663627a54b8150917fd01eec68e8933d
Signed-off-by: Vitalii Solodilov <mcdkr@yandex.ru>
2018-01-31 17:40:52 +04:00
Dougal Matthews dd4a4bd440 Pass the new ActionContext to mistral-lib
Partial-Bug: #1718353
Depends-On: I6057d0ce3fe4ae23468be8fb06cb85dc5f467f6b
Change-Id: Ife653558bfcda794e7f37086832f70b0ad7c28a4
2017-12-11 22:42:48 +00:00
Adriano Petrich e420357dcd Add more use of mistral-lib in mistral
This is a middle step to move serveral parts into mistral-lib

Fixes a typo on the deprecation message
Changes the last actions to use mistral-lib actions
Convert the serialization to use mistral-lib serialization
Use mistral-lib results as the standard. (the serialization mixin change
is required for the results to work)

Next steps are:
change mistral-lib serialization to take care of all serialization
change dependent libraries to use mistral-lib directly

Change-Id: I4eacf5ce2e72916b700e8bc77ac9d95859131931
2017-06-20 15:23:18 +00:00
Dougal Matthews 20f66fd8f2 Add support for mistral-lib to Mistral
This patch wont pass CI until mistral-lib is packaged for the TripleO
CI.

Depends-On-External: https://review.rdoproject.org/r/6266
Depends-On: Icec6d1a3c483a30e9e3fa3175ed0233053c69daa
Change-Id: Iab8d093f53477585e60a99413ed5379fb7e5b4ae
2017-05-02 10:04:01 +01:00
Winson Chan eb09a90749 Make rpc_backend not engine specific
The rpc_backend with kombu and oslo are being used by the executor
and event engine as well. This patch move the rpc_backend up one
level so it's not engine specific. Also Event engine has its own module
and the EventEngine class is defined in the engine module. This patch
moves the EventEngine to it's own base file in the event_engine module.

Implements: blueprint mistral-actions-run-by-engine

Change-Id: Ie814a26e05f5ca6bfba10f20a7d5921836aa7602
2017-04-27 20:02:40 +00:00
Winson Chan 62d8c5edaf Add option to run actions locally on the engine
Make executor pluggable and allow option to run the executor
locally on the engine or remotely over RPC.

Change-Id: I7cfb13068aa1d1f88136eaa092e629c34b78adf2
Implements: blueprint mistral-actions-run-by-engine
2017-04-27 20:02:27 +00:00