正文

Airflow SSH operator example

(2024-04-29 16:27:10) 下一個

from airflow import DAG
from airflow.operators.ssh_operator import SSHOperator
from datetime import datetime

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2024, 4, 29),
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1
}

dag = DAG('ssh_example', default_args=default_args, schedule_interval=None)

task_ssh = SSHOperator(
    task_id='execute_ssh_command',
    ssh_conn_id='ssh_default',  # The name of the SSH connection to use, defined in Airflow Connections
    command='echo "Hello, remote server"',
    dag=dag
)

[ 打印 ]
閱讀 ()評論 (0)
評論
目前還沒有任何評論
登錄後才可評論.