Class: Temporalio::Client::Schedule::Policy

Inherits:
Object
  • Object
show all
Defined in:
lib/temporalio/client/schedule.rb

Overview

Policies of a schedule.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(overlap: OverlapPolicy::SKIP, catchup_window: 365 * 24 * 60 * 60.0, pause_on_failure: false) ⇒ Policy

Create a schedule policy.



718
719
720
721
722
723
724
# File 'lib/temporalio/client/schedule.rb', line 718

def initialize(
  overlap: OverlapPolicy::SKIP,
  catchup_window: 365 * 24 * 60 * 60.0,
  pause_on_failure: false
)
  super
end

Instance Attribute Details

#catchup_windowFloat



699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
# File 'lib/temporalio/client/schedule.rb', line 699

class Policy
  # @!visibility private
  def self._from_proto(raw_policies)
    Schedule::Policy.new(
      overlap: Internal::ProtoUtils.enum_to_int(Api::Enums::V1::ScheduleOverlapPolicy,
                                                raw_policies.overlap_policy,
                                                zero_means_nil: true),
      catchup_window: Internal::ProtoUtils.duration_to_seconds(raw_policies.catchup_window) || raise, # Never nil
      pause_on_failure: raw_policies.pause_on_failure
    )
  end

  # Create a schedule policy.
  #
  # @param overlap [OverlapPolicy] Controls what happens when an action is started while another is still running.
  # @param catchup_window [Float] After a Temporal server is unavailable, amount of time in the past to execute
  #   missed actions.
  # @param pause_on_failure [Boolean] Whether to pause the schedule if an action fails or times out. Note: For
  #   workflows, this only applies after all retries have been exhausted.
  def initialize(
    overlap: OverlapPolicy::SKIP,
    catchup_window: 365 * 24 * 60 * 60.0,
    pause_on_failure: false
  )
    super
  end

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::SchedulePolicies.new(
      overlap_policy: overlap,
      catchup_window: Internal::ProtoUtils.seconds_to_duration(catchup_window),
      pause_on_failure:
    )
  end
end

#overlapOverlapPolicy



699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
# File 'lib/temporalio/client/schedule.rb', line 699

class Policy
  # @!visibility private
  def self._from_proto(raw_policies)
    Schedule::Policy.new(
      overlap: Internal::ProtoUtils.enum_to_int(Api::Enums::V1::ScheduleOverlapPolicy,
                                                raw_policies.overlap_policy,
                                                zero_means_nil: true),
      catchup_window: Internal::ProtoUtils.duration_to_seconds(raw_policies.catchup_window) || raise, # Never nil
      pause_on_failure: raw_policies.pause_on_failure
    )
  end

  # Create a schedule policy.
  #
  # @param overlap [OverlapPolicy] Controls what happens when an action is started while another is still running.
  # @param catchup_window [Float] After a Temporal server is unavailable, amount of time in the past to execute
  #   missed actions.
  # @param pause_on_failure [Boolean] Whether to pause the schedule if an action fails or times out. Note: For
  #   workflows, this only applies after all retries have been exhausted.
  def initialize(
    overlap: OverlapPolicy::SKIP,
    catchup_window: 365 * 24 * 60 * 60.0,
    pause_on_failure: false
  )
    super
  end

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::SchedulePolicies.new(
      overlap_policy: overlap,
      catchup_window: Internal::ProtoUtils.seconds_to_duration(catchup_window),
      pause_on_failure:
    )
  end
end

#pause_on_failureBoolean



699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
# File 'lib/temporalio/client/schedule.rb', line 699

class Policy
  # @!visibility private
  def self._from_proto(raw_policies)
    Schedule::Policy.new(
      overlap: Internal::ProtoUtils.enum_to_int(Api::Enums::V1::ScheduleOverlapPolicy,
                                                raw_policies.overlap_policy,
                                                zero_means_nil: true),
      catchup_window: Internal::ProtoUtils.duration_to_seconds(raw_policies.catchup_window) || raise, # Never nil
      pause_on_failure: raw_policies.pause_on_failure
    )
  end

  # Create a schedule policy.
  #
  # @param overlap [OverlapPolicy] Controls what happens when an action is started while another is still running.
  # @param catchup_window [Float] After a Temporal server is unavailable, amount of time in the past to execute
  #   missed actions.
  # @param pause_on_failure [Boolean] Whether to pause the schedule if an action fails or times out. Note: For
  #   workflows, this only applies after all retries have been exhausted.
  def initialize(
    overlap: OverlapPolicy::SKIP,
    catchup_window: 365 * 24 * 60 * 60.0,
    pause_on_failure: false
  )
    super
  end

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::SchedulePolicies.new(
      overlap_policy: overlap,
      catchup_window: Internal::ProtoUtils.seconds_to_duration(catchup_window),
      pause_on_failure:
    )
  end
end