Repository navigation
Timeouts that stop running steps, on_timeout: :fail fix, versioning phase 1 - #19
Merged
Merged
Conversation
Step options were stored as quoted code: `retry: [base: seconds(1)]` reached the backoff as a tuple, and `timeout: seconds(5)` as the call's AST. They're now evaluated in the workflow module, the way workflow options already are.
… :fail The timeout worker wrote :cancelled straight to the run, so compensations never ran, a parent run was never told, and a run that had already moved on could be overwritten. It now resumes the run with the error, and the executor fails it at the waiting step like any other failure: the run ends :failed (or :compensated), not :cancelled. A retried run waits for the input again.
A step's `timeout:` was documented but never enforced, and a workflow `timeout:` could only fail a run between steps. A step with a time limit now runs in a task that is killed when the limit passes. Past its own timeout the attempt fails and is retried like any error; past the run's deadline the run fails without a retry and runs its compensations. Parallel branches get the run's deadline too. The task starts with a copy of the worker's process dictionary and hands its own back, so context, put_context and log capture behave as before; only self() differs. Steps without a time limit still run in the worker.
A run resumed at a step the deployed workflow no longer has was marked completed, with every remaining step skipped. It now fails with a `definition_changed` error, without compensating, so restoring the step and calling Durable.retry/2 finishes it. This is phase 1 of workflow versioning.
Follow-up to #10. durable's formatter now applies the locals_without_parens it exports, and the dashboard and the Phoenix demo import them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Roadmap items 1, 2 (phase 1 and design) and 5. Each commit is one changelog entry and passes the suite on its own.
Changes
Timeouts
timeout:is now enforced. It was documented but never applied. A slower attempt is stopped and fails with a"timeout"error, which is retried like any other error.timeout:stops a step that's still running. Before, it was only checked between steps. The run fails without a retry and runs its compensations. Parallel branches inherit the run's deadline.timeout:, or any step in a workflow with one. The task gets a copy of the worker's process dictionary and returns its own, so context,put_contextand log capture work as before. Onlyself()differs. Steps without a limit still run in the worker.wait_for_input(..., on_timeout: :fail)now ends the runfailed, notcancelled. The timeout worker used to writecancelledstraight to the row. That skipped compensations, never notified a parent run, and could overwrite a run that had already moved on. Now it resumes the run with the error, and the executor fails it like any other failure.Step options
retry: [base: seconds(1)]used to reach the backoff as quoted code. Step options are now evaluated the way workflow options already were.Versioning, phase 1
completedand every remaining step was skipped. It now fails withdefinition_changedand doesn't compensate, so restoring the step and callingDurable.retry/2finishes it.agents/milestones/M08-workflow-versioning.mdcovers version pinning. It has three open questions:version:blocks in one module, or one module per version.Formatter
locals_without_parens, and the dashboard and Phoenix demo import them.Behaviour changes
These need a note in the 1.2.0 release:
on_timeout: :failruns endfailed(orcompensated), notcancelled.timeout:now interrupts a running step.timeout:is now enforced.self()being the worker behaves differently.Testing
compile --warnings-as-errorsare clean.put_contextand logs kept.on_timeout: :failfails the run, and a retry waits for the input again.