You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be helpful to allow users to explicitly declare the name of an activity or workflow when they are registered, and the name of a called activity, as an alternative to using the activity or workflow function __name__.
Consider an application that can download and process files from various sources, A, B and C. In the future, additional sources will be added.
Suppose each source has the same nominal activity get_input_file
I think it would be cleaner to use these activities this way:
frominterfaceimportA, B, C, D
...
input_module=Aifinput_type=='A'elseBfile_result=yieldctx.call_activity(input_module.get_input_file)
...
Currently the activity name will be taken from the function name, there's no way to have the same activity in different modules.
Therefore I have to write code like this instead:
frominterfaceimportA, B, C, D
...
ifinput_type=='A':
file_result=yieldctx.call_activity(A.get_input_file_A)
else:
file_result=yieldctx.call_activity(B.get_input_file_B)
...
If an optional name can be explicitly passed to call_activity, register_activity and register_workflow, then users could manage complicated workflows in a tidier way.
for example, I would write a decorator to assign an __registered_name attribute to my activity functions.
Then I would use a wrapper function to call activities, something like:
Describe the proposal
It would be helpful to allow users to explicitly declare the name of an activity or workflow when they are registered, and the name of a called activity, as an alternative to using the activity or workflow function
__name__
.Consider an application that can download and process files from various sources, A, B and C. In the future, additional sources will be added.
Here's one way to lay out the code.
Suppose each source has the same nominal activity
get_input_file
I think it would be cleaner to use these activities this way:
Currently the activity name will be taken from the function name, there's no way to have the same activity in different modules.
Therefore I have to write code like this instead:
If an optional name can be explicitly passed to call_activity, register_activity and register_workflow, then users could manage complicated workflows in a tidier way.
for example, I would write a decorator to assign an
__registered_name
attribute to my activity functions.Then I would use a wrapper function to call activities, something like:
The text was updated successfully, but these errors were encountered: