You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "sangrpatil2 (via GitHub)" <gi...@apache.org> on 2023/02/22 06:39:30 UTC

[GitHub] [airflow] sangrpatil2 commented on issue #29555: Dag Fails while creating a Dynamic Tasks using airflow variables.

sangrpatil2 commented on issue #29555:
URL: https://github.com/apache/airflow/issues/29555#issuecomment-1439511002

   @hussein-awala / @ephraimbuddy 
   
   Dag is only failing while creating dynamic tasks using airflow variables, the rest of the tasks/flow is working fine. You can refer to the sample code given below:
   
   `batch_list = [1,2] #[3,4] for next run
   domain_list = [A, B, C]
   
   
   start >> fetch_batch >> load_batch
   
   for domain in domain_list:
   	with TaskGroup(group_id=domain) as domain_tg:
   		step_task_name = 'load_' + domain
   		task_list = []
   
   		for i in range(0, len(batch_list)):
   			batch_id = batch_list[i]
   			task_list.append(create_python_operator(
   				dag=dag,
   				task_name=step_task_name + batch_id,
   				op_kwargs={
   					"command": <execute shell script>
   				},
   				python_callable=ssm_send_command,
   				trigger_rule="all_success"
   			))
   			if i == 0:
   				load_batch >> task_list[0]
   			else:
   				task_list[i-1] >> task_list[i]
   
   	domain_tg >> finish`
   
   Let me know if you need more details about it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org