What I should consider in a design regarding to workflow reset?
What is the best way to make use of the workflow reset feature in Cadence/Temporal/iWF?
1.5k Views Asked by Long Quanzheng At
1
There are 1 best solutions below
Related Questions in CADENCE-WORKFLOW
- Is it a good idea to run cadence workflows and activities on differnet deployable services?
- How do I safely close my cadence client when my program exits?
- Cadence Activity metrics not being emitted
- Why are some of my old decision tasks stuck waiting to get picked up while newer decision tasks immediately get picked in cadence?
- Why is cadence only doing task deletion queries on my DB
- Temporal io workflow engine does it block a thread while calling an activity?
- How to determine the number of workers I need in Uber Cadence?
- Cannot find workflow definition even though I register it to worker
- How can I pass a complex objects as input when using Cadence HTTP API tool?
- Connection timeout on identification
- Unable to run Cadence Workflow from GoLang
- Problems with Cadence-Cassandra when searching for closed workflows
- What is the config file format when i use the command ./server start?
- How to kill a cron parent workflow
- Are there any pros and cons for code maintenance when using the default settings of the Cadence Versioning API?
Related Questions in TEMPORAL-WORKFLOW
- Concurrent Execution of Workflow and Activities in One Worker Instance
- io.opentelemetry.api.internal.AutoValue_ImmutableSpanContext cannot be cast to class co.elastic.apm.agent.opentelemetry.tracing.OTelSpanContext
- Using JdbcLockRegistry from different threads to lock and unlock based on lockKey
- Fire and forget activity in temporal
- Temporal Workflow Issue in python: Workflow is not running in background, Unable to Trigger New Workflow Unit Until Current One Finishes
- Temporal io workflow engine does it block a thread while calling an activity?
- Unable to start Temporal Workflow in PHP
- Getting exception in Temporal application
- How to determine the number of workers I need in Uber Cadence?
- Temporal : Query on Promise with get() method call
- debugging workflows and/or activities in VSCode or similar
- GoESL with Temporal: Calls Not Originating Past Certain Point in FreeSWITCH
- Jackson Json Crypto with temporal workflow - Decryption of data while retrieval not happening
- Need with with authentication in Temporal Cluster
- How to know if running inside temporal workflow when using TypeScript
Related Questions in UBER-CADENCE
- How do I safely close my cadence client when my program exits?
- Cadence Activity metrics not being emitted
- Why are some of my old decision tasks stuck waiting to get picked up while newer decision tasks immediately get picked in cadence?
- Why is cadence only doing task deletion queries on my DB
- Temporal io workflow engine does it block a thread while calling an activity?
- How to determine the number of workers I need in Uber Cadence?
- Cannot find workflow definition even though I register it to worker
- How can I pass a complex objects as input when using Cadence HTTP API tool?
- Connection timeout on identification
- Unable to run Cadence Workflow from GoLang
- Problems with Cadence-Cassandra when searching for closed workflows
- How to kill a cron parent workflow
- Are there any pros and cons for code maintenance when using the default settings of the Cadence Versioning API?
- How to execute the same workflow with cadence RegisterDelayedCallback in unit tests?
- Uber Cadence - Timer started
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Workflow Reset is probably the most powerful & unique feature in Cadence/Temporal. It allows you reset any workflow execution to any previous point of history, with all signals preserved(by default, but can be skipped if specified) to be re-applied.
Here is the best practice to design your workflow to be resettable:
Activity(or State API in iWF) should be idempotent and no side effects when re-executing. Although activity should be idempotent already disregarding reset, activity won't be re-executed after result is recorded into history. But with reset you should expect the activity could be re-executed even after it has been executed and recorded into history because workflow could be reset anytime.
Workflow should be able to handle signal reapplication -- this is the default reset behavior but you can also skip signal-reapplication in some rare cases. Signal reapplication should be preferred by default, as signals are usually used as external data input and could be hard to be re-attrieved.
If 1. cannot be implemented, consider sending signal to self to avoid re-execute some logic(eg activity) that is not idempotent or has side effects when re-executing. Signals are specially handled for reset. All the signals are preserved by default. For example, if you have a workflow that read some data and then write some data, after reset, the workflow may read different data to write to DB which could cause some side effects. To fix this, you can send a signal to self with the read result and process the signal in the workflow.
Alternatively, consider using a different workflow to perform actions on some logic that is not reset safe — eg emit some metrics may not be safe to be reset. So that the reset can be performed on the workflows that are resettable safe.
Don't use childWorkflow feature. Use activity to start other workflow as "child workflows". See Should I use child workflow or use activity to start new workflow for more. (iWF doesn't let you use childWF)
Expect to reset the workflow to very beginning(firstDecisionTask/firstWorkflowTask). Though it's allowed to reset a workflow to any point of the history, it's generally super hard to find the reset point(eventId) as it's hard to interpret the history events with your workflow code. Resetting to beginning makes your life easier for resetting thousands of workflows. Although, expect to pay for some perf penalty for resetting to beginning. (finding reset point will be a lot easier with iWF as iWF will directly correlate your business logic with the history eventId by using stateId)