Class: AWS::Flow::Core::AsyncScope Private
- Inherits:
-
Object
- Object
- AWS::Flow::Core::AsyncScope
- Defined in:
- lib/aws/flow/async_scope.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #failure ⇒ Object private
- #root ⇒ Object private
- #root_context ⇒ Object private
- #stackTrace ⇒ Object private
Instance Method Summary collapse
- #<<(task) ⇒ Object private
- #cancel(error) ⇒ Object private
-
#eventLoop ⇒ Object
private
Execute all queued tasks.
- #get_closest_containing_scope ⇒ Object private
-
#get_heirs ⇒ Object
private
Collects all the heirs of a task for use in async_stack_dump.
-
#initialize(&block) ⇒ AsyncScope
constructor
private
A new instance of AsyncScope.
- #is_complete? ⇒ Boolean private
Constructor Details
#initialize(&block) ⇒ AsyncScope
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.
Returns a new instance of AsyncScope.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/aws/flow/async_scope.rb', line 47 def initialize(&block) @root_context = RootAsyncScope.new # 1 for the function that skips frames # 1 for the create function # 1 for the initialize of the backtrace # "./lib/aws/rubyflow/asyncBacktrace.rb:75:in `caller'" # "./lib/aws/rubyflow/asyncBacktrace.rb:21:in `create'" # "./lib/aws/rubyflow/asyncScope.rb:18:in `initialize'" @root_context.backtrace = AsyncBacktrace.create(nil, 3) @root_error_handler = BeginRescueEnsure.new(:parent => @root_context) begin @root_error_handler.begin lambda { block.call if ! block.nil? } @root_error_handler.rescue(Exception, lambda { |e| raise e }) end @root_context << @root_error_handler end |
Instance Attribute Details
#failure ⇒ 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.
31 32 33 |
# File 'lib/aws/flow/async_scope.rb', line 31 def failure @failure end |
#root ⇒ 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.
31 32 33 |
# File 'lib/aws/flow/async_scope.rb', line 31 def root @root end |
#root_context ⇒ 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.
31 32 33 |
# File 'lib/aws/flow/async_scope.rb', line 31 def root_context @root_context end |
#stackTrace ⇒ 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.
31 32 33 |
# File 'lib/aws/flow/async_scope.rb', line 31 def stackTrace @stackTrace end |
Instance Method Details
#<<(task) ⇒ 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.
105 106 107 108 |
# File 'lib/aws/flow/async_scope.rb', line 105 def <<(task) @root_context << task task.parent = @root_context end |
#cancel(error) ⇒ 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.
44 |
# File 'lib/aws/flow/async_scope.rb', line 44 def cancel(error); @root_error_handler.cancel(error); end |
#eventLoop ⇒ 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.
In the presence of external dependencies, it is expected that #eventLoop is called every
Execute all queued tasks. If execution of those tasks results in the addition of new tasks to the queue, execute them as well.
Unless there are external dependencies or bugs in the tasks to be executed, a single call to this method performs the complete asynchronous execution.
time after a change in the state in a dependency can unblock asynchronous execution.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/aws/flow/async_scope.rb', line 83 def eventLoop #TODO Figure out when to raise Done raise "Done" if ! @root_task.alive? raise IllegalStateException, "Already complete" if is_complete? @root_context.eventLoop # TODO Does this need to be taken care of? It's supposed to protect # against people having errors that are classes, so like, passing # Exception into cancel. We might want to just catch that at the # entry point. if @root_context.failure if @root_context.failure.respond_to? : = @root_context.failure. + "\n" + @root_context.failure.backtrace.join("\n") raise @root_context.failure, else raise @root_context.failure end end return is_complete? end |
#get_closest_containing_scope ⇒ 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.
39 40 41 |
# File 'lib/aws/flow/async_scope.rb', line 39 def get_closest_containing_scope @root_error_handler end |
#get_heirs ⇒ 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.
Collects all the heirs of a task for use in async_stack_dump
69 70 71 |
# File 'lib/aws/flow/async_scope.rb', line 69 def get_heirs @root_error_handler.get_heirs end |
#is_complete? ⇒ Boolean
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.
34 35 36 |
# File 'lib/aws/flow/async_scope.rb', line 34 def is_complete? @root_context.complete end |