Module: AWS::Flow::Utilities
- Defined in:
- lib/aws/decider/utilities.rb
Overview
Utilities for the AWS Flow Framework for Ruby.
Defined Under Namespace
Modules: SelfMethods, UpwardLookups Classes: AddressableFuture, LogFactory
Class Method Summary collapse
- .activity_task_to_debug_string(message, task) ⇒ Object
- .client_options_from_method_name(method_name, options) ⇒ Object private
- .drill_on_future(future) ⇒ Object private
- .interpret_block_for_options(option_class, block, use_defaults = false) ⇒ Object private
- .is_external ⇒ Object private
- .merge_all_options(*args) ⇒ Object private
- .workflow_task_to_debug_string(message, task) ⇒ Object
Class Method Details
.activity_task_to_debug_string(message, task) ⇒ Object
39 40 41 |
# File 'lib/aws/decider/utilities.rb', line 39 def self.activity_task_to_debug_string(, task) return "#{} #{task.activity_type.name}.#{task.activity_type.version} with input: #{task.input} and task_token: #{task.task_token}" end |
.client_options_from_method_name(method_name, options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/aws/decider/utilities.rb', line 62 def self.(method_name, ) = .dup if method_name.nil? .precursors = .precursors.empty? ? [] : [.precursors.first] else .precursors = .precursors.select { |x| x.name.split(".").last.to_sym == method_name } end unless .precursors.empty? .precursors.map!(&:options) end end |
.drill_on_future(future) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 48 49 50 |
# File 'lib/aws/decider/utilities.rb', line 45 def self.drill_on_future(future) while (future.respond_to? :is_flow_future?) && future.is_flow_future? future = future.get end future end |
.interpret_block_for_options(option_class, block, use_defaults = false) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/aws/decider/utilities.rb', line 78 def self.(option_class, block, use_defaults = false) return option_class.new({}, use_defaults) if block.nil? if block.arity <= 0 result = block.call if result.is_a? Hash = option_class.new(result, use_defaults) else raise "If using 0 arguments to the option configuration, you must return a hash" end else = option_class.new({}, use_defaults) block.call() end if .from_class # Insert into the next-to-last position, as these options should be used excepting where they might conflict with the options specified in the block klass = get_const(.from_class) rescue nil if .precursors.empty? .precursors = klass. else .precursors.insert(-2, klass.).flatten! end .prefix_name ||= .from_class end end |
.is_external ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
131 132 133 134 135 136 137 138 |
# File 'lib/aws/decider/utilities.rb', line 131 def self.is_external if (defined? Fiber).nil? return true elsif FlowFiber.current != nil && FlowFiber.current.class != Fiber && FlowFiber.current[:decision_context] != nil return false end return true end |
.merge_all_options(*args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 56 57 58 59 |
# File 'lib/aws/decider/utilities.rb', line 53 def self.(*args) args.compact! youngest = args.last args.delete(youngest) youngest.precursors.concat(args.reverse) youngest. end |
.workflow_task_to_debug_string(message, task) ⇒ Object
36 37 38 |
# File 'lib/aws/decider/utilities.rb', line 36 def self.workflow_task_to_debug_string(, task) return "#{} #{task.workflow_type.name}.#{task.workflow_type.version} for execution with workflow_id: #{task.workflow_execution.workflow_id}, run_id: #{task.workflow_execution.run_id}, task_list: #{task.workflow_execution.task_list} with task_token: #{task.task_token}" end |