Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add dynamic config function #842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2025
Merged

Conversation

Sushisource
Copy link
Member

What was changed

Added @workflow.dynamic_config function which can be used on dynamic workflows to specify per-type overrides to @workflow.defn settings.

Why?

Feature parity w/ Java for workflow versioning

Checklist

  1. Closes

  2. How was this tested:
    Added tests

  3. Any docs updates needed?

@Sushisource Sushisource requested a review from a team as a code owner April 22, 2025 18:37
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking

class DynamicWorkflowConfig:
"""Returned by functions using the :py:func:`dynamic_config` decorator, see it for more."""

failure_exception_types: Sequence[Type[BaseException]] = dataclasses.field(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify on this field and the next that if these are set, they override anything in the definition, they are not additive

class DynamicWorkflowConfig:
"""Returned by functions using the :py:func:`dynamic_config` decorator, see it for more."""

failure_exception_types: Sequence[Type[BaseException]] = dataclasses.field(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be Optional so that even a user-set empty list can override decorator. It's a bit pedantic though.

"@workflow.dynamic_config can only be used in dynamic workflows, but "
f"workflow class {workflow_name} ({cls.__name__}) is not dynamic"
)
dynamic_config_fn = member
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedantic, but we should error if this is already set

class DynamicWorkflowConfig:
"""Returned by functions using the :py:func:`dynamic_config` decorator, see it for more."""

failure_exception_types: Sequence[Type[BaseException]] = dataclasses.field(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda too bad this is dynamic only, this is a nice feature regardless heh (as would be a callback where they can choose programmatically whether an exception is task fail or workflow fail)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I mean we can shift it to be like that if people ask I suppose - but since it only applies on first WFT for now it's not much different from the defn version

@Sushisource Sushisource enabled auto-merge (squash) April 22, 2025 19:21
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking

@Sushisource Sushisource merged commit 2025f07 into main Apr 22, 2025
14 checks passed
@Sushisource Sushisource deleted the dynamic-workflow-version-behavior branch April 22, 2025 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants