在气流SSHOperator中使用映射驱动器

时间:2019-04-30 22:01:32

标签: ssh airflow

我有一个脚本存储在映射到远程Windows服务器上的W:的驱动器上。

我在气流中设置了此任务:

t2 = SSHOperator(
    ssh_con_id = 'svr07',
    task_id = 'test_R', 
    command = 'C:/[path to R]/Rscript.exe W:/[path to script]/script.R', 
    dag = dag)

但是,我似乎无法在SSH连接中使用映射的驱动器。

是否可以通过多行command?一行要映射驱动器,另一行将以上内容调用到cmd

1 个答案:

答案 0 :(得分:1)

您可以按以下方式使用多行命令:

t2 = SSHOperator(
    ssh_con_id = 'svr07',
    task_id = 'test_R', 
    command = """
    # Code to Map your drive
    C:/[path to R]/Rscript.exe W:/[path to script]/script.R
    """, 
    dag = dag)
相关问题