XCom से टास्क के बीच डेटा भेजना

Python में Apache Airflow परिचय

Mike Metzger

Data Engineer

XCom क्या है?

  • "Cross Communication"
    • टास्क एक-दूसरे से बात कर सकते हैं
  • Airflow मेटाडेटा डेटाबेस में स्टोर होता है
    • छोटे डेटा पास करें
    • फ़ाइलनाम, URI, row counts

Airflow टास्क के बीच XCom से छोटा डेटा पास होने का चित्र

Python में Apache Airflow परिचय

XCom से क्या न भेजें

  • बड़े फ़ाइलें
  • DataFrames
  • पूरी डेटाबेस
  • बड़े images

XCom से न भेजने योग्य डेटा प्रकारों का चित्र, जैसे बड़े फ़ाइलें और DataFrames

Python में Apache Airflow परिचय

XCom लागू करना

  • XCom इस्तेमाल करने के कई तरीके
  • हम TaskFlow API पर फोकस करेंगे
  • वही चीज़ जो आपने @tasks के साथ की है, उसका विस्तार
Python में Apache Airflow परिचय

XCom उदाहरण

@dag(dag_id='Example_XCom')
def example_xcom():

@task def get_data(): return data
@task(multiple_outputs=True) def clean_data(sourcedata): return clean(sourcedata) # Example, not implemented
clean_data(get_data()) example_xcom()
Python में Apache Airflow परिचय

XCom dependencies

  • XCom अपने-आप dependency order तय करते हैं
  • उदाहरण
    clean_data(get_data())
    
  • वैचारिक रूप से get_data() >> clean_data() जैसा ही है
  • एक और उदाहरण
     result = clean_data(get_data())
     result >> alert_when_complete()
    
Python में Apache Airflow परिचय

XCom डेटा देखना

Airflow XCom पेज, जहाँ मान key, Dag, और task के आधार पर सूचीबद्ध हैं

Python में Apache Airflow परिचय

अभ्यास करते हैं!

Python में Apache Airflow परिचय

Preparing Video For Download...