I have BigQuery connectors all running, but I have some existing scripts in Docker containers I wish to schedule on Cloud Composer instead of App Engine Flexible.
I have the below script that seems to follow the examples I can find:
import datetime
from airflow import DAG
from airflow import models
from airflow.operators.docker_operator import DockerOperator
yesterday = datetime.datetime.combine(
datetime.datetime.today() - datetime.timedelta(1),
datetime.datetime.min.time())
default_args = {
# Setting start date as yesterday starts the DAG immediately
'start_date': yesterday,
# If a task fails, retry it once after waiting at least 5 minutes
'retries': 1,
'retry_delay': datetime.timedelta(minutes=5),
}
schedule_interval = '45 09 * * *'
dag = DAG('xxx-merge', default_args=default_args, schedule_interval=schedule_interval)
hfan = DockerOperator(
task_id = 'hfan',
image = 'gcr.io/yyyyy/xxxx'
)
...but when trying to run it tells me in the web UI:
Broken DAG: [/home/airflow/gcs/dags/xxxx.py] No module named docker
Is it perhaps that the Docker is not configured to work inside the Kubernetes cluster that Cloud Composer runs? Or am I just missing something in the syntax?