0

I have a script stored on a drive mapped to W: on a remote windows server.

I set up this task in airflow:

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)

However it doesn't seem like I can use mapped drives in an SSH connection.

Is there any way to pass a multiline command? One line to map the drive and the next to call the above to cmd?

Rafael
  • 3,096
  • 1
  • 23
  • 61

1 Answers1

1

You can use multi-line command as following:

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)
kaxil
  • 17,706
  • 2
  • 59
  • 78
  • This doesn't seem to work. If I try `""" /n echo 1 /n echo 2 /n """` (with actual new lines instead of \n), and then look at the log it's printing either of those (when it had been when it was just one line) – Rafael Apr 30 '19 at 23:08