Skip to content

Commit

Permalink
Update flow run policy retry settings to be nullable
Browse files Browse the repository at this point in the history
This allows us to tell if these values were provided _explicitly_ on the run or if they can be updated with values discovered at runtime.
  • Loading branch information
zanieb committed Aug 19, 2022
1 parent fe2ce3b commit 26b9052
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/prefect/orion/orchestration/core_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ async def before_transition(

run_settings = context.run_settings
run_count = context.run.run_count
if run_count > run_settings.max_retries:
if run_settings.max_retries is None or run_count > run_settings.max_retries:
return # Retry count exceeded, allow transition to failed

scheduled_start_time = pendulum.now("UTC").add(
seconds=run_settings.retry_delay_seconds
seconds=run_settings.retry_delay_seconds or 0
)

failed_task_runs = await task_runs.read_task_runs(
Expand Down
4 changes: 2 additions & 2 deletions src/prefect/orion/schemas/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class FlowRunPolicy(PrefectBaseModel):

# TODO: Determine how to separate between infrastructure and within-process level
# retries
max_retries: int = 0
retry_delay_seconds: float = 0
max_retries: Optional[int] = None
retry_delay_seconds: Optional[float] = None


class FlowRun(ORMBaseModel):
Expand Down

0 comments on commit 26b9052

Please sign in to comment.