Class: AWS::Flow::ActivityOptions

Inherits:
Options
  • Object
show all
Defined in:
lib/aws/decider/options.rb

Overview

Options to use on an activity or decider. The following options are defined:

Direct Known Subclasses

ActivityRuntimeOptions

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Options

#get_options, inherited, #method_missing

Constructor Details

#initialize(default_options = {}, use_defaults = false) ⇒ ActivityOptions

Creates a new set of ActivityOptions

Parameters:

  • default_options (Hash) (defaults to: {})

    A set of ActivityOptions to use as the default values.

  • use_defaults (true, false) (defaults to: false)

    Set to ‘true` to use the pre-defined default ActivityOptions.

Options Hash (default_options):

  • :heartbeat_timeout (Integer)

    The optional default maximum time, specified when registering the activity type, before which a worker processing a task must report progress by calling RecordActivityTaskHeartbeat. You can override this default when scheduling a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task.

  • :schedule_to_close_timeout (Integer)

    The optional default maximum duration, specified when registering the activity type, for tasks of this activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.

  • :schedule_to_start_timeout (Integer)

    The optional default maximum duration, specified when registering the activity type, that a task of an activity type can wait before being assigned to a worker. You can override this default when scheduling a task through the ScheduleActivityTask Decision.

  • :start_to_close_timeout (Integer)

    The optional default maximum duration for tasks of an activity type specified when registering the activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.

  • :task_list (Array)

    The optional default task list specified for this activity type at registration. This default task list is used if a task list is not provided when a task is scheduled through the ScheduleActivityTask Decision. You can override this default when scheduling a task through the ScheduleActivityTask Decision.

  • :version (String)

    The version of this Activity. If you change any other options on the activity, you must also change the version.



524
525
526
527
528
529
# File 'lib/aws/decider/options.rb', line 524

def initialize(default_options={}, use_defaults=false)
  if default_options.keys.include? :exponential_retry
    @_exponential_retry = ExponentialRetryOptions.new(default_options[:exponential_retry])
  end
  super(default_options, use_defaults)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AWS::Flow::Options

Class Attribute Details

.default_optionsObject (readonly)

Returns the value of attribute default_options.



466
467
468
# File 'lib/aws/decider/options.rb', line 466

def default_options
  @default_options
end

.runtime_optionsObject (readonly)

Returns the value of attribute runtime_options.



466
467
468
# File 'lib/aws/decider/options.rb', line 466

def runtime_options
  @runtime_options
end

Instance Attribute Details

#default_task_heartbeat_timeoutObject

The optional default maximum time, specified when registering the activity type, before which a worker processing a task must report progress by calling record_heartbeat on the ActivityTask.

You can override this default when scheduling a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task.

The valid values are integers greater than or equal to zero. An integer value can be used to specify the duration in seconds while “NONE” can be used to specify unlimited duration.



462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/aws/decider/options.rb', line 462

class ActivityOptions < Options
  # The default options for the activity. These can be specified when creating a new ActivityOptions instance.
  #
  class << self
    attr_reader :default_options,  :runtime_options
  end
  properties(:default_task_heartbeat_timeout, :default_task_list, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout, :heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout, :version, :input)
  property(:manual_completion, [lambda {|x| x == true}])
  property(:data_converter, [])

  default_classes << ActivityDefaults.new

  # Gets the activity prefix name
  # @return [String] the activity name
  def activity_name
    @prefix_name
  end

  # Sets the activity prefix name
  # @param [String] value the activity name to set
  def activity_name=(value)
    @prefix_name = value
  end

  # Creates a new set of ActivityOptions
  #
  # @param [Hash] default_options
  #   A set of ActivityOptions to use as the default values.
  #
  # @option default_options [Integer] :heartbeat_timeout
  #   The optional default maximum time, specified when registering the activity type, before which a worker
  #   processing a task must report progress by calling RecordActivityTaskHeartbeat. You can override this default
  #   when scheduling a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts
  #   to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this
  #   case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the
  #   activity task.
  #
  # @option default_options [Integer] :schedule_to_close_timeout
  #   The optional default maximum duration, specified when registering the activity type, for tasks of this
  #   activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :schedule_to_start_timeout
  #   The optional default maximum duration, specified when registering the activity type, that a task of an
  #   activity type can wait before being assigned to a worker. You can override this default when scheduling a task
  #   through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :start_to_close_timeout
  #   The optional default maximum duration for tasks of an activity type specified when registering the activity
  #   type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Array] :task_list
  #   The optional default task list specified for this activity type at registration. This default task list is
  #   used if a task list is not provided when a task is scheduled through the ScheduleActivityTask Decision. You
  #   can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [String] :version
  #  The version of this Activity. If you change any other options on the activity, you must also change the
  #  version.
  #
  # @param [true, false] use_defaults
  #   Set to `true` to use the pre-defined default ActivityOptions.
  #
  def initialize(default_options={}, use_defaults=false)
    if default_options.keys.include? :exponential_retry
      @_exponential_retry = ExponentialRetryOptions.new(default_options[:exponential_retry])
    end
    super(default_options, use_defaults)
  end

  # Retrieves the runtime options for this Activity. The runtime options returned are:
  #
  # * :heartbeat_timeout
  # * :task_list
  # * :schedule_to_close_timeout
  # * :schedule_to_start_timeout
  # * :start_to_close_timeout
  #
  # For a description of each of these options, see {#initialize}.
  #
  # @return [Hash]
  #   The runtime option names and their current values.
  #
  def get_runtime_options
    result = get_options([:heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout])
    default_options = get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
    default_option_keys, default_option_values = default_options.keys, default_options.values
    default_option_keys.map! { |option| option.to_s.gsub(/default_task_/, "").to_sym }
    default_hash = Hash[default_option_keys.zip(default_option_values)]
    default_hash.merge(result)
  end

  property(:_exponential_retry, [])

  # Retries the supplied block with exponential retry logic.
  #
  # @param [Hash] block
  #   A hash of ExponentialRetryOptions.
  #
  def exponential_retry(&block)
    retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
    @_exponential_retry = retry_options
  end

  # Retrieves the runtime options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the runtime option names and their current values.
  #
  def get_full_options
    options_hash = self.get_runtime_options
    [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|
      options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)
    end
    options_hash
  end

  # Retrieves the default options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the default option names and their current values.
  #
  #   The options retrieved are:
  #
  #   * :default_task_heartbeat_timeout
  #   * :default_task_schedule_to_close_timeout
  #   * :default_task_schedule_to_start_timeout
  #   * :default_task_start_to_close_timeout
  #
  def get_default_options
    get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
  end
end

#default_task_listObject

The optional default task list specified for this activity type at registration. This default task list is used if a task list is not provided when a task is scheduled through the ScheduleActivityTask decision. You can override this default when scheduling a task through the ScheduleActivityTask decision.



462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/aws/decider/options.rb', line 462

class ActivityOptions < Options
  # The default options for the activity. These can be specified when creating a new ActivityOptions instance.
  #
  class << self
    attr_reader :default_options,  :runtime_options
  end
  properties(:default_task_heartbeat_timeout, :default_task_list, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout, :heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout, :version, :input)
  property(:manual_completion, [lambda {|x| x == true}])
  property(:data_converter, [])

  default_classes << ActivityDefaults.new

  # Gets the activity prefix name
  # @return [String] the activity name
  def activity_name
    @prefix_name
  end

  # Sets the activity prefix name
  # @param [String] value the activity name to set
  def activity_name=(value)
    @prefix_name = value
  end

  # Creates a new set of ActivityOptions
  #
  # @param [Hash] default_options
  #   A set of ActivityOptions to use as the default values.
  #
  # @option default_options [Integer] :heartbeat_timeout
  #   The optional default maximum time, specified when registering the activity type, before which a worker
  #   processing a task must report progress by calling RecordActivityTaskHeartbeat. You can override this default
  #   when scheduling a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts
  #   to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this
  #   case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the
  #   activity task.
  #
  # @option default_options [Integer] :schedule_to_close_timeout
  #   The optional default maximum duration, specified when registering the activity type, for tasks of this
  #   activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :schedule_to_start_timeout
  #   The optional default maximum duration, specified when registering the activity type, that a task of an
  #   activity type can wait before being assigned to a worker. You can override this default when scheduling a task
  #   through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :start_to_close_timeout
  #   The optional default maximum duration for tasks of an activity type specified when registering the activity
  #   type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Array] :task_list
  #   The optional default task list specified for this activity type at registration. This default task list is
  #   used if a task list is not provided when a task is scheduled through the ScheduleActivityTask Decision. You
  #   can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [String] :version
  #  The version of this Activity. If you change any other options on the activity, you must also change the
  #  version.
  #
  # @param [true, false] use_defaults
  #   Set to `true` to use the pre-defined default ActivityOptions.
  #
  def initialize(default_options={}, use_defaults=false)
    if default_options.keys.include? :exponential_retry
      @_exponential_retry = ExponentialRetryOptions.new(default_options[:exponential_retry])
    end
    super(default_options, use_defaults)
  end

  # Retrieves the runtime options for this Activity. The runtime options returned are:
  #
  # * :heartbeat_timeout
  # * :task_list
  # * :schedule_to_close_timeout
  # * :schedule_to_start_timeout
  # * :start_to_close_timeout
  #
  # For a description of each of these options, see {#initialize}.
  #
  # @return [Hash]
  #   The runtime option names and their current values.
  #
  def get_runtime_options
    result = get_options([:heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout])
    default_options = get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
    default_option_keys, default_option_values = default_options.keys, default_options.values
    default_option_keys.map! { |option| option.to_s.gsub(/default_task_/, "").to_sym }
    default_hash = Hash[default_option_keys.zip(default_option_values)]
    default_hash.merge(result)
  end

  property(:_exponential_retry, [])

  # Retries the supplied block with exponential retry logic.
  #
  # @param [Hash] block
  #   A hash of ExponentialRetryOptions.
  #
  def exponential_retry(&block)
    retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
    @_exponential_retry = retry_options
  end

  # Retrieves the runtime options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the runtime option names and their current values.
  #
  def get_full_options
    options_hash = self.get_runtime_options
    [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|
      options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)
    end
    options_hash
  end

  # Retrieves the default options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the default option names and their current values.
  #
  #   The options retrieved are:
  #
  #   * :default_task_heartbeat_timeout
  #   * :default_task_schedule_to_close_timeout
  #   * :default_task_schedule_to_start_timeout
  #   * :default_task_start_to_close_timeout
  #
  def get_default_options
    get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
  end
end

#default_task_schedule_to_close_timeoutObject

The optional default maximum duration, specified when registering the activity type, for tasks of this activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.

The valid values are integers greater than or equal to zero, or the string “NONE”. An integer value can be used to specify the duration in seconds while “NONE” is be used to specify unlimited duration.



462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/aws/decider/options.rb', line 462

class ActivityOptions < Options
  # The default options for the activity. These can be specified when creating a new ActivityOptions instance.
  #
  class << self
    attr_reader :default_options,  :runtime_options
  end
  properties(:default_task_heartbeat_timeout, :default_task_list, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout, :heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout, :version, :input)
  property(:manual_completion, [lambda {|x| x == true}])
  property(:data_converter, [])

  default_classes << ActivityDefaults.new

  # Gets the activity prefix name
  # @return [String] the activity name
  def activity_name
    @prefix_name
  end

  # Sets the activity prefix name
  # @param [String] value the activity name to set
  def activity_name=(value)
    @prefix_name = value
  end

  # Creates a new set of ActivityOptions
  #
  # @param [Hash] default_options
  #   A set of ActivityOptions to use as the default values.
  #
  # @option default_options [Integer] :heartbeat_timeout
  #   The optional default maximum time, specified when registering the activity type, before which a worker
  #   processing a task must report progress by calling RecordActivityTaskHeartbeat. You can override this default
  #   when scheduling a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts
  #   to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this
  #   case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the
  #   activity task.
  #
  # @option default_options [Integer] :schedule_to_close_timeout
  #   The optional default maximum duration, specified when registering the activity type, for tasks of this
  #   activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :schedule_to_start_timeout
  #   The optional default maximum duration, specified when registering the activity type, that a task of an
  #   activity type can wait before being assigned to a worker. You can override this default when scheduling a task
  #   through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :start_to_close_timeout
  #   The optional default maximum duration for tasks of an activity type specified when registering the activity
  #   type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Array] :task_list
  #   The optional default task list specified for this activity type at registration. This default task list is
  #   used if a task list is not provided when a task is scheduled through the ScheduleActivityTask Decision. You
  #   can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [String] :version
  #  The version of this Activity. If you change any other options on the activity, you must also change the
  #  version.
  #
  # @param [true, false] use_defaults
  #   Set to `true` to use the pre-defined default ActivityOptions.
  #
  def initialize(default_options={}, use_defaults=false)
    if default_options.keys.include? :exponential_retry
      @_exponential_retry = ExponentialRetryOptions.new(default_options[:exponential_retry])
    end
    super(default_options, use_defaults)
  end

  # Retrieves the runtime options for this Activity. The runtime options returned are:
  #
  # * :heartbeat_timeout
  # * :task_list
  # * :schedule_to_close_timeout
  # * :schedule_to_start_timeout
  # * :start_to_close_timeout
  #
  # For a description of each of these options, see {#initialize}.
  #
  # @return [Hash]
  #   The runtime option names and their current values.
  #
  def get_runtime_options
    result = get_options([:heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout])
    default_options = get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
    default_option_keys, default_option_values = default_options.keys, default_options.values
    default_option_keys.map! { |option| option.to_s.gsub(/default_task_/, "").to_sym }
    default_hash = Hash[default_option_keys.zip(default_option_values)]
    default_hash.merge(result)
  end

  property(:_exponential_retry, [])

  # Retries the supplied block with exponential retry logic.
  #
  # @param [Hash] block
  #   A hash of ExponentialRetryOptions.
  #
  def exponential_retry(&block)
    retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
    @_exponential_retry = retry_options
  end

  # Retrieves the runtime options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the runtime option names and their current values.
  #
  def get_full_options
    options_hash = self.get_runtime_options
    [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|
      options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)
    end
    options_hash
  end

  # Retrieves the default options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the default option names and their current values.
  #
  #   The options retrieved are:
  #
  #   * :default_task_heartbeat_timeout
  #   * :default_task_schedule_to_close_timeout
  #   * :default_task_schedule_to_start_timeout
  #   * :default_task_start_to_close_timeout
  #
  def get_default_options
    get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
  end
end

#default_task_schedule_to_start_timeoutObject

The optional default maximum duration, specified when registering the activity type, that a task of an activity type can wait before being assigned to a worker. You can override this default when scheduling a task through the ScheduleActivityTask decision.



462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/aws/decider/options.rb', line 462

class ActivityOptions < Options
  # The default options for the activity. These can be specified when creating a new ActivityOptions instance.
  #
  class << self
    attr_reader :default_options,  :runtime_options
  end
  properties(:default_task_heartbeat_timeout, :default_task_list, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout, :heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout, :version, :input)
  property(:manual_completion, [lambda {|x| x == true}])
  property(:data_converter, [])

  default_classes << ActivityDefaults.new

  # Gets the activity prefix name
  # @return [String] the activity name
  def activity_name
    @prefix_name
  end

  # Sets the activity prefix name
  # @param [String] value the activity name to set
  def activity_name=(value)
    @prefix_name = value
  end

  # Creates a new set of ActivityOptions
  #
  # @param [Hash] default_options
  #   A set of ActivityOptions to use as the default values.
  #
  # @option default_options [Integer] :heartbeat_timeout
  #   The optional default maximum time, specified when registering the activity type, before which a worker
  #   processing a task must report progress by calling RecordActivityTaskHeartbeat. You can override this default
  #   when scheduling a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts
  #   to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this
  #   case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the
  #   activity task.
  #
  # @option default_options [Integer] :schedule_to_close_timeout
  #   The optional default maximum duration, specified when registering the activity type, for tasks of this
  #   activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :schedule_to_start_timeout
  #   The optional default maximum duration, specified when registering the activity type, that a task of an
  #   activity type can wait before being assigned to a worker. You can override this default when scheduling a task
  #   through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :start_to_close_timeout
  #   The optional default maximum duration for tasks of an activity type specified when registering the activity
  #   type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Array] :task_list
  #   The optional default task list specified for this activity type at registration. This default task list is
  #   used if a task list is not provided when a task is scheduled through the ScheduleActivityTask Decision. You
  #   can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [String] :version
  #  The version of this Activity. If you change any other options on the activity, you must also change the
  #  version.
  #
  # @param [true, false] use_defaults
  #   Set to `true` to use the pre-defined default ActivityOptions.
  #
  def initialize(default_options={}, use_defaults=false)
    if default_options.keys.include? :exponential_retry
      @_exponential_retry = ExponentialRetryOptions.new(default_options[:exponential_retry])
    end
    super(default_options, use_defaults)
  end

  # Retrieves the runtime options for this Activity. The runtime options returned are:
  #
  # * :heartbeat_timeout
  # * :task_list
  # * :schedule_to_close_timeout
  # * :schedule_to_start_timeout
  # * :start_to_close_timeout
  #
  # For a description of each of these options, see {#initialize}.
  #
  # @return [Hash]
  #   The runtime option names and their current values.
  #
  def get_runtime_options
    result = get_options([:heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout])
    default_options = get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
    default_option_keys, default_option_values = default_options.keys, default_options.values
    default_option_keys.map! { |option| option.to_s.gsub(/default_task_/, "").to_sym }
    default_hash = Hash[default_option_keys.zip(default_option_values)]
    default_hash.merge(result)
  end

  property(:_exponential_retry, [])

  # Retries the supplied block with exponential retry logic.
  #
  # @param [Hash] block
  #   A hash of ExponentialRetryOptions.
  #
  def exponential_retry(&block)
    retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
    @_exponential_retry = retry_options
  end

  # Retrieves the runtime options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the runtime option names and their current values.
  #
  def get_full_options
    options_hash = self.get_runtime_options
    [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|
      options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)
    end
    options_hash
  end

  # Retrieves the default options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the default option names and their current values.
  #
  #   The options retrieved are:
  #
  #   * :default_task_heartbeat_timeout
  #   * :default_task_schedule_to_close_timeout
  #   * :default_task_schedule_to_start_timeout
  #   * :default_task_start_to_close_timeout
  #
  def get_default_options
    get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
  end
end

#default_task_start_to_close_timeoutObject

The optional default maximum duration for tasks of an activity type specified when registering the activity type. You can override this default when scheduling a task through the ScheduleActivityTask decision.



462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/aws/decider/options.rb', line 462

class ActivityOptions < Options
  # The default options for the activity. These can be specified when creating a new ActivityOptions instance.
  #
  class << self
    attr_reader :default_options,  :runtime_options
  end
  properties(:default_task_heartbeat_timeout, :default_task_list, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout, :heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout, :version, :input)
  property(:manual_completion, [lambda {|x| x == true}])
  property(:data_converter, [])

  default_classes << ActivityDefaults.new

  # Gets the activity prefix name
  # @return [String] the activity name
  def activity_name
    @prefix_name
  end

  # Sets the activity prefix name
  # @param [String] value the activity name to set
  def activity_name=(value)
    @prefix_name = value
  end

  # Creates a new set of ActivityOptions
  #
  # @param [Hash] default_options
  #   A set of ActivityOptions to use as the default values.
  #
  # @option default_options [Integer] :heartbeat_timeout
  #   The optional default maximum time, specified when registering the activity type, before which a worker
  #   processing a task must report progress by calling RecordActivityTaskHeartbeat. You can override this default
  #   when scheduling a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts
  #   to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this
  #   case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the
  #   activity task.
  #
  # @option default_options [Integer] :schedule_to_close_timeout
  #   The optional default maximum duration, specified when registering the activity type, for tasks of this
  #   activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :schedule_to_start_timeout
  #   The optional default maximum duration, specified when registering the activity type, that a task of an
  #   activity type can wait before being assigned to a worker. You can override this default when scheduling a task
  #   through the ScheduleActivityTask Decision.
  #
  # @option default_options [Integer] :start_to_close_timeout
  #   The optional default maximum duration for tasks of an activity type specified when registering the activity
  #   type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [Array] :task_list
  #   The optional default task list specified for this activity type at registration. This default task list is
  #   used if a task list is not provided when a task is scheduled through the ScheduleActivityTask Decision. You
  #   can override this default when scheduling a task through the ScheduleActivityTask Decision.
  #
  # @option default_options [String] :version
  #  The version of this Activity. If you change any other options on the activity, you must also change the
  #  version.
  #
  # @param [true, false] use_defaults
  #   Set to `true` to use the pre-defined default ActivityOptions.
  #
  def initialize(default_options={}, use_defaults=false)
    if default_options.keys.include? :exponential_retry
      @_exponential_retry = ExponentialRetryOptions.new(default_options[:exponential_retry])
    end
    super(default_options, use_defaults)
  end

  # Retrieves the runtime options for this Activity. The runtime options returned are:
  #
  # * :heartbeat_timeout
  # * :task_list
  # * :schedule_to_close_timeout
  # * :schedule_to_start_timeout
  # * :start_to_close_timeout
  #
  # For a description of each of these options, see {#initialize}.
  #
  # @return [Hash]
  #   The runtime option names and their current values.
  #
  def get_runtime_options
    result = get_options([:heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout])
    default_options = get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
    default_option_keys, default_option_values = default_options.keys, default_options.values
    default_option_keys.map! { |option| option.to_s.gsub(/default_task_/, "").to_sym }
    default_hash = Hash[default_option_keys.zip(default_option_values)]
    default_hash.merge(result)
  end

  property(:_exponential_retry, [])

  # Retries the supplied block with exponential retry logic.
  #
  # @param [Hash] block
  #   A hash of ExponentialRetryOptions.
  #
  def exponential_retry(&block)
    retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
    @_exponential_retry = retry_options
  end

  # Retrieves the runtime options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the runtime option names and their current values.
  #
  def get_full_options
    options_hash = self.get_runtime_options
    [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|
      options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)
    end
    options_hash
  end

  # Retrieves the default options for this Activity.
  #
  # @return [Hash]
  #   A hash containing the default option names and their current values.
  #
  #   The options retrieved are:
  #
  #   * :default_task_heartbeat_timeout
  #   * :default_task_schedule_to_close_timeout
  #   * :default_task_schedule_to_start_timeout
  #   * :default_task_start_to_close_timeout
  #
  def get_default_options
    get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
  end
end

Instance Method Details

#activity_nameString

Gets the activity prefix name

Returns:

  • (String)

    the activity name



476
477
478
# File 'lib/aws/decider/options.rb', line 476

def activity_name
  @prefix_name
end

#activity_name=(value) ⇒ Object

Sets the activity prefix name

Parameters:

  • value (String)

    the activity name to set



482
483
484
# File 'lib/aws/decider/options.rb', line 482

def activity_name=(value)
  @prefix_name = value
end

#exponential_retry(&block) ⇒ Object

Retries the supplied block with exponential retry logic.

Parameters:

  • block (Hash)

    A hash of ExponentialRetryOptions.



560
561
562
563
# File 'lib/aws/decider/options.rb', line 560

def exponential_retry(&block)
  retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
  @_exponential_retry = retry_options
end

#get_default_optionsHash

Retrieves the default options for this Activity.

Returns:

  • (Hash)

    A hash containing the default option names and their current values.

    The options retrieved are:

    • :default_task_heartbeat_timeout

    • :default_task_schedule_to_close_timeout

    • :default_task_schedule_to_start_timeout

    • :default_task_start_to_close_timeout



590
591
592
# File 'lib/aws/decider/options.rb', line 590

def get_default_options
  get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
end

#get_full_optionsHash

Retrieves the runtime options for this Activity.

Returns:

  • (Hash)

    A hash containing the runtime option names and their current values.



570
571
572
573
574
575
576
# File 'lib/aws/decider/options.rb', line 570

def get_full_options
  options_hash = self.get_runtime_options
  [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|
    options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)
  end
  options_hash
end

#get_runtime_optionsHash

Retrieves the runtime options for this Activity. The runtime options returned are:

  • :heartbeat_timeout

  • :task_list

  • :schedule_to_close_timeout

  • :schedule_to_start_timeout

  • :start_to_close_timeout

For a description of each of these options, see #initialize.

Returns:

  • (Hash)

    The runtime option names and their current values.



544
545
546
547
548
549
550
551
# File 'lib/aws/decider/options.rb', line 544

def get_runtime_options
  result = get_options([:heartbeat_timeout, :task_list, :schedule_to_close_timeout, :schedule_to_start_timeout, :start_to_close_timeout])
  default_options = get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])
  default_option_keys, default_option_values = default_options.keys, default_options.values
  default_option_keys.map! { |option| option.to_s.gsub(/default_task_/, "").to_sym }
  default_hash = Hash[default_option_keys.zip(default_option_values)]
  default_hash.merge(result)
end