Skip to content

Commit

Permalink
Merge pull request #4977 from minrk/scp-mkdir-p
Browse files Browse the repository at this point in the history
ensure scp destination directories exist (with mkdir -p)
  • Loading branch information
ellisonbg committed Feb 9, 2014
2 parents 52c3158 + 2127d18 commit d522a1b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions IPython/parallel/apps/launcher.py
Expand Up @@ -600,6 +600,11 @@ def _send_file(self, local, remote):
time.sleep(1)
else:
break
remote_dir = os.path.dirname(remote)
self.log.info("ensuring remote %s:%s/ exists", self.location, remote_dir)
check_output(self.ssh_cmd + self.ssh_args + \
[self.location, 'mkdir', '-p', '--', remote_dir]
)
self.log.info("sending %s to %s", local, remote)
check_output(self.scp_cmd + [local, remote])

Expand All @@ -623,6 +628,9 @@ def _fetch_file(self, remote, local):
time.sleep(1)
elif check == u'yes':
break
local_dir = os.path.dirname(local)
if not os.path.exists(local_dir):
os.makedirs(local_dir, 775)
check_output(self.scp_cmd + [full_remote, local])

def fetch_files(self):
Expand Down

0 comments on commit d522a1b

Please sign in to comment.