##// END OF EJS Templates
Merge pull request #3328 from minrk/launcherbytes...
Min RK -
r10806:48313c24 merge
parent child Browse files
Show More
@@ -61,6 +61,7 b' from IPython.utils.text import EvalFormatter'
61 61 from IPython.utils.traitlets import (
62 62 Any, Integer, CFloat, List, Unicode, Dict, Instance, HasTraits, CRegExp
63 63 )
64 from IPython.utils.encoding import DEFAULT_ENCODING
64 65 from IPython.utils.path import get_home_dir
65 66 from IPython.utils.process import find_cmd, FindCmdError
66 67
@@ -86,7 +87,6 b' ipcontroller_cmd_argv = [sys.executable, "-c", cmd % "ipcontrollerapp"]'
86 87 # Base launchers and errors
87 88 #-----------------------------------------------------------------------------
88 89
89
90 90 class LauncherError(Exception):
91 91 pass
92 92
@@ -613,10 +613,10 b' class SSHLauncher(LocalProcessLauncher):'
613 613 # wait up to 10s for remote file to exist
614 614 check = check_output(self.ssh_cmd + self.ssh_args + \
615 615 [self.location, 'test -e', remote, "&& echo 'yes' || echo 'no'"])
616 check = check.strip()
617 if check == 'no':
616 check = check.decode(DEFAULT_ENCODING, 'replace').strip()
617 if check == u'no':
618 618 time.sleep(1)
619 elif check == 'yes':
619 elif check == u'yes':
620 620 break
621 621 check_output(self.scp_cmd + [full_remote, local])
622 622
@@ -889,6 +889,7 b' class WindowsHPCLauncher(BaseLauncher):'
889 889 cwd=self.work_dir,
890 890 stderr=STDOUT
891 891 )
892 output = output.decode(DEFAULT_ENCODING, 'replace')
892 893 job_id = self.parse_job_id(output)
893 894 self.notify_start(job_id)
894 895 return job_id
@@ -906,8 +907,9 b' class WindowsHPCLauncher(BaseLauncher):'
906 907 cwd=self.work_dir,
907 908 stderr=STDOUT
908 909 )
910 output = output.decode(DEFAULT_ENCODING, 'replace')
909 911 except:
910 output = 'The job already appears to be stoppped: %r' % self.job_id
912 output = u'The job already appears to be stopped: %r' % self.job_id
911 913 self.notify_stop(dict(job_id=self.job_id, output=output)) # Pass the output of the kill cmd
912 914 return output
913 915
@@ -1117,6 +1119,7 b' class BatchSystemLauncher(BaseLauncher):'
1117 1119 # can be used in the batch script template as {profile_dir}
1118 1120 self.write_batch_script(n)
1119 1121 output = check_output(self.args, env=os.environ)
1122 output = output.decode(DEFAULT_ENCODING, 'replace')
1120 1123
1121 1124 job_id = self.parse_job_id(output)
1122 1125 self.notify_start(job_id)
@@ -1124,6 +1127,7 b' class BatchSystemLauncher(BaseLauncher):'
1124 1127
1125 1128 def stop(self):
1126 1129 output = check_output(self.delete_command+[self.job_id], env=os.environ)
1130 output = output.decode(DEFAULT_ENCODING, 'replace')
1127 1131 self.notify_stop(dict(job_id=self.job_id, output=output)) # Pass the output of the kill cmd
1128 1132 return output
1129 1133
@@ -1242,11 +1246,11 b' class LSFLauncher(BatchSystemLauncher):'
1242 1246 # Here we save profile_dir in the context so they
1243 1247 # can be used in the batch script template as {profile_dir}
1244 1248 self.write_batch_script(n)
1245 #output = check_output(self.args, env=os.environ)
1246 1249 piped_cmd = self.args[0]+'<\"'+self.args[1]+'\"'
1247 1250 self.log.debug("Starting %s: %s", self.__class__.__name__, piped_cmd)
1248 1251 p = Popen(piped_cmd, shell=True,env=os.environ,stdout=PIPE)
1249 1252 output,err = p.communicate()
1253 output = output.decode(DEFAULT_ENCODING, 'replace')
1250 1254 job_id = self.parse_job_id(output)
1251 1255 self.notify_start(job_id)
1252 1256 return job_id
General Comments 0
You need to be logged in to leave comments. Login now