airflow-code-editor
airflow-code-editor copied to clipboard
How do I install extra packages from the code editor
Hi Team,
Is there a way we could install some dependent packages of the Dags which are hosted on PyPi via code editor. Maybe running requirements.txt file programatically/ button?
Thanks
You can install the requirements creating (and starting manually) a dag like the following:
from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.utils.dates import days_ago
dag = DAG( dag_id='update-requirements', schedule_interval=None, start_date=days_ago(1) )
pip_install_requirements = BashOperator( task_id='pip_install_requirements ', bash_command="pip install -r requirements.txt", dag=dag )
if name == "main": dag.cli()