I need to run the DAG with the repository folder name, and I need to call the other modules from another directory from another path repository deployed.
So, I have a cloudbuild.yaml
that will deploy the script into DAG folder and Plugins folder, but I still didn't know, how to get the other modules from the other path on Cloud Composer Bucket Storage.
This is my Bucket Storage path
cloud-composer-bucket/
dags/
github_my_repository_deployed-testing/
test_dag.py
plugins/
github_my_repository_deployed-testing/
planning/
modules_1.py
I need to call modules_1.py
from my test_dag.py
, I used this command to call the module
from planning.modules_1 import get_data
But from this method, I got an error shown like this
Broken DAG: [/home/airflow/gcs/dags/github_my_repository_deployed-testing/test_dag.py] Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/airflow/gcs/dags/github_my_repository_deployed-testing/test_dag.py", line 7, in <module>
from planning.modules_1 import get_date
ModuleNotFoundError: No module named 'planning'
This is my cloudbuild.yaml
steps:
- id: 'Push into Composer DAG'
name: 'google/cloud-sdk'
entrypoint: 'sh'
args: [ '-c', 'gsutil -m rsync -d -r ./dags ${_COMPOSER_BUCKET}/dags/$REPO_NAME']
- id: 'Push into Composer Plugins'
name: 'google/cloud-sdk'
entrypoint: 'sh'
args: [ '-c', 'gsutil -m rsync -d -r ./plugins ${_COMPOSER_BUCKET}/plugins/$REPO_NAME']
- id: 'Code Scanning'
name: 'python:3.7-slim'
entrypoint: 'sh'
args: [ '-c', 'pip install bandit && bandit --exit-zero -r ./']
substitutions:
_CONTAINER_VERSION: v0.0.1
_COMPOSER_BUCKET: gs://asia-southeast1-testing-cloud-composer-025c0511-bucket
My question is, what is the best and how to call the other modules into DAG?