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.

Parameters:

  • overlap (OverlapPolicy) (defaults to: OverlapPolicy::SKIP)

    Controls what happens when an action is started while another is still running.

  • catchup_window (Float) (defaults to: 365 * 24 * 60 * 60.0)

    After a Temporal server is unavailable, amount of time in the past to execute missed actions.

  • pause_on_failure (Boolean) (defaults to: false)

    Whether to pause the schedule if an action fails or times out. Note: For workflows, this only applies after all retries have been exhausted.



742
743
744
745
746
747
748
# File 'lib/temporalio/client/schedule.rb', line 742

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

Instance Attribute Details

#catchup_windowFloat

Returns After a Temporal server is unavailable, amount of time in the past to execute missed actions.

Returns:

  • (Float)

    After a Temporal server is unavailable, amount of time in the past to execute missed actions.



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/temporalio/client/schedule.rb', line 723

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

Returns Controls what happens when an action is started while another is still running.

Returns:

  • (OverlapPolicy)

    Controls what happens when an action is started while another is still running.



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/temporalio/client/schedule.rb', line 723

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

Returns Whether to pause the schedule if an action fails or times out. Note: For workflows, this only applies after all retries have been exhausted.

Returns:

  • (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.



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/temporalio/client/schedule.rb', line 723

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