lib/eco/api/session/config/workflow.rb in eco-helpers-1.5.1 vs lib/eco/api/session/config/workflow.rb in eco-helpers-1.5.2
- old
+ new
@@ -5,13 +5,14 @@
class Workflow
extend Eco::API::Common::ClassHierarchy
WORKFLOW_MODEL = [
:options,
- {load: [:input, {people: [:get, :filter]}, :filter]},
+ {load: [{input: [:get, :filter]}, {people: [:get, :filter]}, :filter]},
:usecases, :launch_jobs,
{post_launch: [:usecases, :launch_jobs]},
+ :report,
:end, :close
]
class << self
def stages
@@ -47,11 +48,11 @@
@stages = {}
@_parent = _parent
@pending = true
# moments
- @on = nil
+ @on = nil
@before = []
@after = []
end
# Has this stage run yet?
@@ -102,11 +103,11 @@
# - if `key` is not provided, it targets the _current stage_
# - if `key` is provided, it targets the specific _sub-stage_
# @yield [stage_workflow, io] the behaviour of the target stage `key` when the _workflow_ reaches it
# @yieldparam stage_workflow [Eco::API::Session::Config::Workflow] the _target stage_ referred by `key`
# @yieldparam io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
- # @yieldreturn io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
+ # @yieldreturn [Eco::API::UseCases::BaseIO] the `io` input/output object carried througout all the _workflow_
# @return [Eco::API::Session::Config::Workflow] the current stage object (to ease chainig).
def on(key = nil, &block)
raise "A block should be given." unless block
if !key
@on = block
@@ -118,11 +119,11 @@
# When there is an `Exception`, you might have defined some `callback` to do something with it (i.e. register, email)
# @yield [exception, io] the `callback` to do something with an `Exception` raised within this _workflow_ stage
# @yieldparam exception [Exception] the exception object that was raised
# @yieldparam io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
- # @yieldreturn io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
+ # @yieldreturn [Eco::API::UseCases::BaseIO] the `io` input/output object carried througout all the _workflow_
# @return [Eco::API::Session::Config::Workflow] the current stage object (to ease chainig).
def rescue(&block)
return @rescue unless block
@rescue = block
self
@@ -136,11 +137,11 @@
# - if `key` is not provided, it targets the _current stage_
# - if `key` is provided, it targets the specific _sub-stage_
# @yield [stage_workflow, io] one of the things to do **before** the `on` _callback_ of the (sub)stage `key` is actually `run`
# @yieldparam stage_workflow [Eco::API::Session::Config::Workflow] the _target stage_ referred by `key`
# @yieldparam io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
- # @yieldreturn io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
+ # @yieldreturn [Eco::API::UseCases::BaseIO] `io` the input/output object carried througout all the _workflow_
# @return [Eco::API::Session::Config::Workflow] the current stage object (to ease chainig).
def before(key = nil, &block)
raise "A block should be given." unless block
if !key
@before.push(block)
@@ -158,11 +159,11 @@
# - if `key` is not provided, it targets the _current stage_
# - if `key` is provided, it targets the specific _sub-stage_
# @yield [stage_workflow, io] one of the things to do **after** the `on` _callback_ of the (sub)stage `key` is actually `run`
# @yieldparam stage_workflow [Eco::API::Session::Config::Workflow] the _target stage_ referred by `key`
# @yieldparam io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
- # @yieldreturn io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
+ # @yieldreturn [Eco::API::UseCases::BaseIO] `io` the input/output object carried througout all the _workflow_
# @return [Eco::API::Session::Config::Workflow] the current stage object (to ease chainig).
def after(key = nil, &block)
raise "A block should be given." unless block
if !key
@after.push(block)
@@ -189,10 +190,10 @@
# - if `key` is provided, it targets the specific _sub-stage_
# @param io [Eco::API::UseCases::BaseIO] the input/output object
# @yield [stage_workflow, io] if a `block` is provided, see `note`
# @yieldparam stage_workflow [Eco::API::Session::Config::Workflow] the _target stage_ referred by `key`
# @yieldparam io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
- # @yieldreturn io [Eco::API::UseCases::BaseIO] the input/output object carried througout all the _workflow_
+ # @yieldreturn [Eco::API::UseCases::BaseIO] the `io` input/output object carried througout all the _workflow_
# @return [Eco::API::Session::Config::Workflow] the current stage object (to ease chainig).
def run(key = nil, io:, &block)
begin
if key
io = stage(key).run(io: io, &block)