acoustic-carpenter-78188
10/23/2023, 6:44 PM_flyte_operator will return a flyte task if it fails to get the attribute from the flyte context.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flytekit/exceptions/scopes.py", line 206, in user_entry_point
return wrapped(*args, **kwargs)
File "/root/flyte-example/airflow_example/bash_operator.py", line 15, in d1
b = BashOperator(task_id=f"airflow_bash_operator", bash_command="echo hello")
File "/usr/local/lib/python3.10/site-packages/flytekitplugins/airflow/task.py", line 55, in _flyte_operator
if hasattr(user_params, "get_original_task") and user_params.get_original_task:
File "/usr/local/lib/python3.10/site-packages/flytekit/core/context_manager.py", line 296, in __getattr__
raise AssertionError(f"{attr_name} not available as a parameter in Flyte context - are you in right task-type?")
Type
☑︎ Bug Fix
☐ Feature
☐ Plugin
Are all requirements met?
☐ Code completed
☐ Smoke tested
☐ Unit tests added
☐ Code documentation added
☐ Any pending items have an associated Issue
Complete description
from airflow.operators.bash import BashOperator
from flytekit import workflow, ImageSpec, task, dynamic
new_airflow_plugin = "git+https://github.com/flyteorg/flytekit.git@1775025f7e0db48e0115781e7012493b4aebb79f#subdirectory=plugins/flytekit-airflow"
image_spec = ImageSpec(packages=[new_airflow_plugin, "flytekitplugins-envd"], registry="pingsutw", apt_packages=["git"])
@task(container_image=image_spec)
def t1():
print("flyte")
@dynamic(container_image=image_spec)
def d1():
b = BashOperator(task_id=f"airflow_bash_operator", bash_command="echo hello")
b >> t1()
@workflow
def wf():
d1()
if __name__ == '__main__':
wf()
Tracking Issue
flyteorg/flyte#3936
Follow-up issue
NA
flyteorg/flytekit
Codecov: 54.71% (-0.01%) compared to c7c5d13
✅ 29 other checks have passed
29/30 successful checksacoustic-carpenter-78188
10/23/2023, 11:06 PMacoustic-carpenter-78188
10/24/2023, 10:22 PM