def _ls_jobs(self, jobs=None, users=None, jobnames=None, fmt=None, xheaders=False, showtimestamp=False, long=False): args = ["--disable-ssl-verify", "lsjobs"] if jobs: args.extend(["--jobs", jobs]) if users: args.extend(["--users", users]) if jobnames: args.extend(["--jobnames", jobnames]) if fmt: args.extend(["--fmt", fmt]) if xheaders: args.append("--xheaders") if showtimestamp: args.append("--showtimestamp") if long: args.append("--long") return streamtool.run_cmd(args=args)
def _run_lstoolkit(self, args): args.insert(0, "--disable-ssl-verify") args.insert(1, "lstoolkit") with captured_output() as (out, err): rc, msg = streamtool.run_cmd(args=args) stdout = out.getvalue().splitlines() self._check_header(stdout) return rc, stdout, msg
def _run_rmtoolkit(self, args): args.insert(0, "--disable-ssl-verify") args.insert(1, "rmtoolkit") rc, return_message = streamtool.run_cmd(args=args) # Operations such as adding or deleting toolkits sometimes are not # effective immediately. It may take some time for them to be completely # removed. For this reason, we sleep after deleting time.sleep(5) return rc, return_message
def _update_operators(self, job_config=None, jobID=None, job_name=None, parallelRegionWidth=None, force=None): args = ["--disable-ssl-verify", "updateoperators"] if jobID: args.append(jobID) elif job_name: args.extend(['--jobname', job_name]) args.extend(['-g', job_config]) if parallelRegionWidth: args.extend(["--parallelRegionWidth", parallelRegionWidth]) if force: args.append('--force') rc, val = streamtool.run_cmd(args=args) return rc, val
def _submitjob(self, args, sab=None): args.insert(0, "--disable-ssl-verify") args.insert(1, "submitjob") if sab: args.insert(2, sab) else: topo = Topology() topo.source([1]) cfg = {} cfg[ConfigParams.SSL_VERIFY] = False src = submit("BUNDLE", topo, cfg) sab_path = src["bundlePath"] args.insert(2, sab_path) self.files_to_remove.append(sab_path) rc, val = streamtool.run_cmd(args=args) return rc, val
def test_upload(self): name, ver, product = self._mktoolkit() args = [] args.append("--disable-ssl-verify") args.append("uploadtoolkit") args.append("--path") args.append(self.tkdir) rc, msg = streamtool.run_cmd(args) self.assertEqual(0, rc) bs = BuildService.of_endpoint(verify=False) tks = bs.get_toolkits(name=name) self.assertEqual(1, len(tks)) tk = tks[0] self.assertEqual(name, tk.name) self.assertEqual(ver, tk.version) self.assertEqual(product, tk.requiredProductVersion) tk.delete()
def _submitjob(self, sab, job_config): args = ["--disable-ssl-verify", "submitjob", sab, '-g', job_config] rc, job = streamtool.run_cmd(args=args) return rc, job