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