Exemple #1
0
	def submit(self):
		"""
		Submit the job
		@returns:
			The `utils.cmd.Cmd` instance if succeed 
			else a `Box` object with stderr as the exception and rc as 1
		"""
		cmdlist = [self.cmds['sbatch'], self.script]
		try:
			r = cmd.run(cmdlist)
			# sbatch: Submitted batch job 99999999
			m = re.search(r'\s(\d+)$', r.stdout)
			if not m: # pragma: no cover
				r.rc = 1
			else:
				self.pid = m.group(1)

			return r
		except (OSError, subprocess.CalledProcessError) as ex: # pragma: no cover
			r = Box()
			r.stderr = str(ex)
			r.rc = 1
			return r
Exemple #2
0
	def submit(self):
		"""
		Submit the job
		@returns:
			The `utils.cmd.Cmd` instance if succeed 
			else a `Box` object with stderr as the exception and rc as 1
		"""
		cmdlist = [self.cmds['qsub'], self.script]
		try:
			r = cmd.run(cmdlist)
			# Your job 6556149 ("pSort.notag.3omQ6NdZ.0") has been submitted
			m = re.search(r'\s(\d+)\s', r.stdout)
			if not m:
				r.rc = 1
			else:
				self.pid = m.group(1)

			return r
		except (OSError, subprocess.CalledProcessError) as ex:
			r = Box()
			r.stderr = str(ex)
			r.rc = 1
			return r