Skip to content

Commit

Permalink
Merge pull request #80 from felix5572/master
Browse files Browse the repository at this point in the history
fix bug of ssh_context
  • Loading branch information
felix5572 committed Jul 3, 2021
2 parents 3d54733 + ad54378 commit e323e76
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions dpdispatcher/ssh_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def _setup_ssh(self):
def get_ssh_client(self) :
return self.ssh

# def get_session_root(self) :
# def get_session_root(self):
# return self.remote_root

def close(self) :
Expand Down Expand Up @@ -175,6 +175,9 @@ def __init__ (self,
):
assert(type(local_root) == str)
self.temp_local_root = os.path.abspath(local_root)
assert os.path.isabs(remote_root), f"remote_root must be a abspath"
self.temp_remote_root = remote_root

# self.job_uuid = None
self.clean_asynchronously = clean_asynchronously
# self.job_uuid = job_uuid
Expand All @@ -184,7 +187,6 @@ def __init__ (self,
# self.job_uuid = str(uuid.uuid4())
self.ssh_session = SSHSession(**remote_profile)
# self.temp_remote_root = os.path.join(self.ssh_session.get_session_root())
self.temp_remote_root = remote_root
self.ssh_session.ensure_alive()
try:
self.sftp.mkdir(self.temp_remote_root)
Expand Down Expand Up @@ -261,6 +263,15 @@ def upload(self,
submission,
# local_up_files,
dereference = True) :
print('debug^^^^^^^^^^^^^^^^^', self.remote_root)
# remote_cwd =
self.ssh_session.sftp.chdir(self.temp_remote_root)
try:
self.ssh_session.sftp.mkdir(os.path.basename(self.remote_root))
except OSError:
pass
self.ssh_session.sftp.chdir(None)

cwd = os.getcwd()
os.chdir(self.local_root)
file_list = []
Expand Down

0 comments on commit e323e76

Please sign in to comment.