Victor Gustavo da Silva Oliveira
03/29/2023, 12:15 PM'ReferenceTask' object has no attribute '_task_function'
... Can someone help me? I would be very appreciatedfrom flytekit import task
@task
def task_example(n: int) -> int:
"""
Simple example task for library building.
Parameters:
n (int): name of the parameter for the task will be derived from the name of the input variable
the type will be automatically deduced to be Types.Integer
Return:
int: The label for the output will be automatically assigned and type will be deduced from the annotation
"""
return n * n
And I'm referencing like this:
from flytekit import reference_task
@reference_task(
project="flyte-tasks",
domain="development",
name="src.flyte_tasks.example_task.example_task.task_example",
)
def task_example(n: int)->int:
...
Ketan (kumare3)
Victor Gustavo da Silva Oliveira
03/29/2023, 2:42 PMSamhita Alla
Victor Gustavo da Silva Oliveira
04/04/2023, 1:14 PMTraceback (most recent call last):
File "/home/jbudke/miniforge3/envs/dedup/bin/pyflyte", line 8, in <module>
sys.exit(main())
File "/home/jbudke/.local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/jbudke/.local/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/jbudke/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/jbudke/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/jbudke/.local/lib/python3.8/site-packages/click/core.py", line 1651, in invoke
cmd_name, cmd, args = self.resolve_command(ctx, args)
File "/home/jbudke/.local/lib/python3.8/site-packages/click/core.py", line 1698, in resolve_command
cmd = self.get_command(ctx, cmd_name)
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/clis/sdk_in_container/run.py", line 607, in get_command
entity = load_naive_entity(module, exe_entity, project_root)
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/clis/sdk_in_container/run.py", line 447, in load_naive_entity
importlib.import_module(module_name)
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/jbudke/Área de Trabalho/image-intelligence/dsc-image-intelligence/src/flyte_tasks/workflows/image_workflow.py", line 13, in <module>
def image_workflow(
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/core/workflow.py", line 739, in workflow
return wrapper(_workflow_function)
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/core/workflow.py", line 734, in wrapper
workflow_instance.compile()
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/core/workflow.py", line 614, in compile
workflow_outputs = exception_scopes.user_entry_point(self._workflow_function)(**input_kwargs)
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/exceptions/scopes.py", line 198, in user_entry_point
return wrapped(*args, **kwargs)
File "/home/jbudke/Área de Trabalho/image-intelligence/dsc-image-intelligence/src/flyte_tasks/workflows/image_workflow.py", line 41, in image_workflow
all_samples = map_task(
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/core/map_task.py", line 274, in map_task
return MapPythonTask(task_function, concurrency=concurrency, min_success_ratio=min_success_ratio, **kwargs)
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/core/tracker.py", line 35, in __call__
o = super(InstanceTrackingMeta, cls).__call__(*args, **kwargs)
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/core/map_task.py", line 58, in __init__
_, mod, f, _ = tracker.extract_task_module(python_function_task.task_function)
File "/home/jbudke/miniforge3/envs/dedup/lib/python3.8/site-packages/flytekit/core/python_function_task.py", line 156, in task_function
return self._task_function
AttributeError: 'ReferenceTask' object has no attribute '_task_function'
Samhita Alla
Victor Gustavo da Silva Oliveira
04/04/2023, 1:35 PMSamhita Alla
from flytekit import map_task, reference_task, workflow
@reference_task(
project="flytesnacks",
domain="development",
name="core.flyte_basics.decorating_tasks.t1",
version="AdGs5FM0Sh2WFM0T6rZemg==",
)
def t1(x: int) -> int:
...
@workflow
def wf(x: list[int] = [3, 2]):
return map_task(t1)(x=x)
Error:
Failed with Unknown Exception <class 'AttributeError'> Reason: 'ReferenceTask' object has no attribute '_task_function'
Eduardo Apolinario (eapolinario)
04/04/2023, 5:39 PMSamhita Alla
Ketan (kumare3)