lib/floe/workflow/states/task.rb in floe-0.9.0 vs lib/floe/workflow/states/task.rb in floe-0.10.0
- old
+ new
@@ -44,23 +44,22 @@
def status
@end ? "success" : "running"
end
def finish
- super
-
output = runner.output(context.state["RunnerContext"])
if success?
output = parse_output(output)
- context.state["Output"] = process_output(context.input.dup, output)
+ context.output = process_output(context.input.dup, output)
+ super
else
context.next_state = nil
- error = parse_error(output)
+ context.output = error = parse_error(output)
+ super
retry_state!(error) || catch_error!(error) || fail_workflow!(error)
end
-
ensure
runner.cleanup(context.state["RunnerContext"])
end
def running?
@@ -108,25 +107,28 @@
return if context["State"]["RetryCount"] > retrier.max_attempts
wait_until!(:seconds => retrier.sleep_duration(context["State"]["RetryCount"]))
context.next_state = context.state_name
+ logger.info("Running state: [#{long_name}] with input [#{context.input}]...Retry - delay: #{wait_until}")
true
end
def catch_error!(error)
catcher = find_catcher(error["Error"]) if error
return if catcher.nil?
context.next_state = catcher.next
context.output = catcher.result_path.set(context.input, error)
+ logger.info("Running state: [#{long_name}] with input [#{context.input}]...CatchError - next state: [#{context.next_state}] output: [#{context.output}]")
+
true
end
def fail_workflow!(error)
context.next_state = nil
context.output = {"Error" => error["Error"], "Cause" => error["Cause"]}.compact
- context.state["Error"] = context.output["Error"]
+ logger.error("Running state: [#{long_name}] with input [#{context.input}]...Complete workflow - output: [#{context.output}]")
end
def parse_error(output)
return if output.nil?
return output if output.kind_of?(Hash)