xingdao opened a new issue #17257:
URL: https://github.com/apache/airflow/issues/17257
**Apache Airflow version**: 2.1.0
**Kubernetes version (if you are using kubernetes)** (use `kubectl
version`): no
**Environment**:
- **Cloud provider or hardware configuration**: linux
- **OS** (e.g. from /etc/os-release): Debian GNU/Linux 10
- **Kernel** (e.g. `uname -a`): Linux 832222993e59 5.4.0-77-generic x86_64
GNU/Linux
- **Install tools**: docker
- **Others**:
**What happened**:
after extend SubDagOperator
in web graph view, subdag is error get `DAG total_test.loop seems to be
missing`
**What you expected to happen**:
normal display graph view
**How to reproduce it**:
run dag as:
from airflow.models.dag import DAG
from airflow.operators.dummy import DummyOperator
from airflow.operators.subdag import SubDagOperator
from airflow.utils.dates import days_ago
import logging
class MySubDagOperator(SubDagOperator):
@property
def task_type(self) -> str:
return 'SubDagOperator'
DAG_NAME = 'total_test'
args = {
'owner': 'airflow',
}
def sub_dag(parent_dag_name, child_dag_name, sub_args):
dag_subdag = DAG(
dag_id=f'{parent_dag_name}.{child_dag_name}',
default_args=sub_args,
start_date=days_ago(2),
schedule_interval=None,
)
sub_start = DummyOperator(
task_id='sub_start',
dag=dag_subdag
)
return dag_subdag
with DAG(
dag_id=DAG_NAME, default_args=args, start_date=days_ago(2),
schedule_interval=None
) as dag:
start = DummyOperator(
task_id='start',
)
loop = MySubDagOperator(
task_id='loop',
subdag=sub_dag(DAG_NAME, 'loop', args),
)
start >> loop
**Anything else we need to know**:
bug in airflow\serialization\serialized_objects.py#401
@classmethod
def serialize_operator(cls, op: BaseOperator) -> Dict[str, Any]:
"""Serializes operator into a JSON object."""
serialize_op = cls.serialize_to_json(op, cls._decorated_fields)
serialize_op['_task_type'] = op.__class__.__name__ # bug
serialize_op['_task_module'] = op.__class__.__module__
maybe op.__class__.__name__ -> op.__class__.task_type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]