cadence icon indicating copy to clipboard operation
cadence copied to clipboard

Why does worker not support uninstalling or updating WorkflowType?

Open 1059915154 opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. My requirement requires work support for uninstalling or updating workflowType, and I need to check if they are registered through workflow name.

Proposed Solution

  1. Provide an API for uninstalling workflowType.
  2. Provide APIs for updating workflow types.
  3. Provide an API for querying whether registered through workflow name.

Additional context I have implemented these locally.

1059915154 avatar Oct 19 '23 02:10 1059915154

I implement these functions based on the registry structure cache mapping.

1059915154 avatar Oct 19 '23 02:10 1059915154

Hey. Could you elaborate what is your usecase? I'm not sure I understand.

  1. Cadence provide a way to schedule workflow executions and is meant to tolerate a single server outage with a retry. I don't think deregistering is an intended behaviour. How would Cadence react if the workflow started and you decided to uninstall workflowType?
  2. All workflows should be idempotent, so running them again with the same arguments should lead to the same result, for any changes your code should use versioning to ensure replayability. How can Cadence ensure the replayability of workflows if you update workflowType?
  3. This could make sense, though I'm not sure I understand the usecase.

3vilhamster avatar Oct 19 '23 08:10 3vilhamster

@3vilhamster Thanks. My scenario is to combine multiple HTTP interfaces into a workflow, including registering, uninstalling, or updating workflows. I require the entire process to be dynamic, rather than sending new versions every time changes are made. I have already implemented the corresponding requirements locally. The general processing process is as follows:

  1. Dynamically generate corresponding functions based on GO plugins, where each plugin corresponds to a complete workflow processing logic.
  2. Dynamically register, uninstall, or update workflows based on the above functions, although cadence currently does not support uninstallation or update workflows. So I implemented it by modifying the cadence source code, first defining three interfaces in the cadence/worker that correspond to uninstallation, update, and detecting whether the workflow has been registered through name. Then implement these three interfaces in cadence/internal/registry, mainly based on a series of operations on registry.workflowFuncMap.

I am not sure if dynamic updates or uninstallations are suitable for long-term or scheduled workflows. But in my scenario, it seems reasonable.

1059915154 avatar Oct 19 '23 09:10 1059915154