yesemsanthoshkumar edited a comment on issue #14714:
URL: https://github.com/apache/airflow/issues/14714#issuecomment-865639159
Airflow version: 2.0.2
I faced the similar issue as well. The custom operators wouldn't load even
if they are inside the dags folder. Tried loading it from the plugins dir as
well.
What worked for me is setting `reload_on_plugin_change` to `True` in the
values.yaml. Operators got picked up from the dags folder itself.
````
from datetime import datetime
from airflow.models import DAG
from airflow.operators.dummy import DummyOperator
from custom_operator import MyDummyOperator
default_args = {
'owner': 'airflow,
'start_date': datetime(2021, 6, 1),
'depends_on_past': False,
}
dag = DAG(
dag_id='import_test',
schedule_interval=None,
default_args=default_args,
catchup=False
)
op = DummyOperator(
task_id='dummy',
dag=dag
)
my_op = MyDummyOperator(
task_id='dummy_mine',
dag=dag
)
````
and my custom operator was
```
from airflow.operators.dummy import DummyOperator
class MyDummyOperator(DummyOperator):
pass
```
I also found that this works even though I don't have the plugins folder and
all the imports are within the dags folder. Which didn't workout when setting
it to false. @kaxil Am I configuring it correctly? I thought this reload was
intended for the plugins folder.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]