Airflow के साथ Data Pipelines बनाना
Volker Janz
Senior Developer Advocate at Astronomer
$$
$$

$$
| ऑपरेटर | उपयोग का मामला |
|---|---|
ApprovalOperator |
बाइनरी approve/reject |
HITLBranchOperator |
अगला कौन-से टास्क चलें चुनें |
HITLOperator |
कस्टम options + form |
HITLEntryOperator |
केवल form input, कोई options नहीं |
$$
from airflow.providers.standard.operators.hitl import HITLEntryOperator from airflow.sdk import Paramreview = HITLEntryOperator( task_id="human_review", subject="Review AI draft response", body="{{ ti.xcom_pull(task_ids='generate_draft') }}", params={ "feedback": Param("", type="string"), "urgency": Param("p3", type="string"), }, )
@task def send_response(hitl_output): feedback = hitl_output["params_input"]["feedback"] urgency = hitl_output["params_input"]["urgency"] print(f"Sending response (urgency: {urgency}): {feedback}")draft = generate_draft() chain(draft, review) send_response(review.output)
params_input में होता हैchosen_options में होते हैंfrom airflow.providers.standard.operators.hitl import HITLBranchOperatorroute = HITLBranchOperator( task_id="route_complaint", subject="Route customer complaint", body="A customer reported an issue. Choose the responsible team.", options=["Billing Issue", "General Inquiry", "Technical Issue"], options_mapping={ "Billing Issue": "handle_billing", "Technical Issue": "handle_technical", "General Inquiry": "handle_general", }, defaults=["General Inquiry"], )

Airflow के साथ Data Pipelines बनाना