How can a define the parameters for airflow KubernetesPodOperator make all tasks in a DAG run at the same time.
In my image below you can see that some tasks are in grey "scheduled", I want them to run all at the same time green, also make it NOT possible to run the same task more than once at a time.
SO
task1_today & task1_yesterday: Cannot run together
task1_today, task2_today, ...taskN_today: Should be running ALL together
This is how my DAGs are defined
Arguments
default_args = {
"owner": "airflow",
"depends_on_past": False,
"email_on_failure": True,
"email": ["intelligence@profinda.com"],
"retries": 2,
"retry_delay": timedelta(hours=6),
"email_on_retry": False,
"image_pull_policy": "Always",
"max_active_tasks": len(LIST_OF_TASKS),
}
Kubernetes pod
KubernetesPodOperator(
namespace="airflow",
service_account_name="airflow",
image=DAG_IMAGE,
image_pull_secrets=[k8s.V1LocalObjectReference("docker-registry")],
container_resources=compute_resources,
env_vars={
"EXECUTION_DATE": "{{ execution_date }}",
},
cmds=["python3", "launcher.py", "-n", spider_name, "-r", "43000"],
is_delete_operator_pod=True,
in_cluster=True,
name=f"Crawler-{normalised_name}",
task_id=f"hydra-crawler-{normalised_name}",
get_logs=True,
max_active_tis_per_dag=1, # Previously task_concurrency before Airflow 2.2
)