thousands-car-79657
04/25/2023, 5:41 PMpyflyte register
to register the workflow, the resolver path would be app.<…>.default_task_resolver
, but if programmatically register workflow using register_workflow()
, the resolver path would be module.<…>.default_task_resolver
(module
being the root of the workflow code). Is there a way to change the resolver path back to app
if I use register_workflow
?thankful-minister-83577
thankful-minister-83577
tree
structure and some sample repro code?thousands-car-79657
04/26/2023, 4:07 PMregister_workflow
, and the resolver path would be run_my_workflow.pip_pypi__flytekit.flytekit.core.python_auto_container.default_task_resolver
. And run_my_workflow
is the register_workflow
thousands-car-79657
04/26/2023, 4:09 PMpyflyte register
, the resolver path in the task would look like app.pip_pypi__flytekit.flytekit.core.python_auto_container.default_task_resolver
thousands-car-79657
04/26/2023, 4:11 PMapp
when calling register_workflow
thousands-car-79657
04/26/2023, 4:12 PMthankful-minister-83577
thankful-minister-83577
thousands-car-79657
04/26/2023, 4:49 PMthousands-car-79657
04/26/2023, 9:42 PMlocation
in the DefaultTaskResolver
Here is my solution:
TASK_RESOLVER_LOCATION = "app.pip_pypi__flytekit.flytekit.core.python_auto_container.default_task_resolver"
class CustomTaskResolver(DefaultTaskResolver):
def __init__(self, *args, resolver_location = TASK_RESOLVER_LOCATION, **kwargs):
super().__init__(*args, **kwargs)
self.resolver_location = resolver_location
@property
def location(self) -> str:
return self.resolver_location
@task(task_resolver=CustomTaskResolver())
def my_task(a: int, b: int) -> int:
return a + b
@task(task_resolver=CustomTaskResolver())
def my_other_task(m: int, n: int) -> int:
return 2 * (m - n)