Class: AWS::Flow::Core::ExternalTaskCompletionHandle Private
- Inherits:
-
Object
- Object
- AWS::Flow::Core::ExternalTaskCompletionHandle
- Defined in:
- lib/aws/flow/tasks.rb
Overview
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.
Used to complete or fail an external task initiated through ExternalTask#initiate_task, and thus handles the logic of what to do when the external task is failed.
Instance Attribute Summary collapse
- #completed ⇒ Object private
- #external_task ⇒ Object private
- #failure ⇒ Object private
Instance Method Summary collapse
-
#complete ⇒ Object
private
Sets the task to complete, and removes it from its parent.
-
#fail(error) ⇒ Object
private
Merges the backtrace, sets the @failure, and then fails the task from the parent.
-
#initialize(external_task) ⇒ ExternalTaskCompletionHandle
constructor
private
A new instance of ExternalTaskCompletionHandle.
Constructor Details
#initialize(external_task) ⇒ ExternalTaskCompletionHandle
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 ExternalTaskCompletionHandle.
320 321 322 |
# File 'lib/aws/flow/tasks.rb', line 320 def initialize(external_task) @external_task = external_task end |
Instance Attribute Details
#completed ⇒ 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.
317 318 319 |
# File 'lib/aws/flow/tasks.rb', line 317 def completed @completed end |
#external_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.
317 318 319 |
# File 'lib/aws/flow/tasks.rb', line 317 def external_task @external_task end |
#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.
317 318 319 |
# File 'lib/aws/flow/tasks.rb', line 317 def failure @failure end |
Instance Method Details
#complete ⇒ 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.
Sets the task to complete, and removes it from its parent.
360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/aws/flow/tasks.rb', line 360 def complete if ! failure.nil? raise IllegalStateException, "" end if @completed raise IllegalStateException, "Already Completed" end @completed = true @external_task.remove_from_parent if ! @external_task.inCancellationHandler end |
#fail(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.
Merges the backtrace, sets the @failure, and then fails the task from the parent.
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/aws/flow/tasks.rb', line 334 def fail(error) if ! @failure.nil? raise IllegalStateException, "Invalid ExternalTaskCompletionHandle" end if @completed raise IllegalStateException, "Already completed" end #TODO Might want to flip the logic to only alert if variable is set if @stacktrace.nil? if ! @external_task.backtrace.nil? backtrace = AsyncBacktrace.create_from_exception(@external_task.backtrace, error) error.set_backtrace(backtrace.backtrace) if backtrace end end @failure = error if ! @external_task.inCancellationHandler @external_task.fail_to_parent(error) end end |