-
Notifications
You must be signed in to change notification settings - Fork 97
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking
temporalio/workflow.py
Outdated
class DynamicWorkflowConfig: | ||
"""Returned by functions using the :py:func:`dynamic_config` decorator, see it for more.""" | ||
|
||
failure_exception_types: Sequence[Type[BaseException]] = dataclasses.field( |
There was a problem hiding this comment.
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
temporalio/workflow.py
Outdated
class DynamicWorkflowConfig: | ||
"""Returned by functions using the :py:func:`dynamic_config` decorator, see it for more.""" | ||
|
||
failure_exception_types: Sequence[Type[BaseException]] = dataclasses.field( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
temporalio/workflow.py
Outdated
class DynamicWorkflowConfig: | ||
"""Returned by functions using the :py:func:`dynamic_config` decorator, see it for more.""" | ||
|
||
failure_exception_types: Sequence[Type[BaseException]] = dataclasses.field( |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking
Co-authored-by: Chad Retz <[email protected]>
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
Closes
How was this tested:
Added tests
Any docs updates needed?