-
Goal: to use Procedure:
the omsmanager was build by me, which was installed in the used docker venv. when I run the function what confused me was that the function I used was in the same py file:
what I want to realize is to call funcition in mod(pyfile) through run function, is there any better way to do it, or what's the best practices? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Did you try to import required dependency inside of python callable? from airflow import DAG
from airflow.operators.python import ExternalPythonOperator
import pendulum
def venv_callable(module="", func=""):
from omsmanager import run
run(module=module, func=func)
with DAG(
dag_id="test_dag",
catchup=False,
schedule="0 0 * * *",
start_date=pendulum.datetime(2021, 1, 1, tz="UTC")
) as dag:
virtualenv_task = ExternalPythonOperator(
task_id="test_task",
queue="controller",
python="/opt/airflow/feature/bin/python",
python_callable=venv_callable,
op_kwargs = {'module':'datastack','func':'deploy'},
# requirements=["boto3>=1.17.43"],
# system_site_packages=False,
dag=dag,
) |
Beta Was this translation helpful? Give feedback.
Did you try to import required dependency inside of python callable?