def run(argv): opts = util.parse_docopt(__doc__, argv, True) image = opts["<image>"] biobox_type = opts["<biobox_type>"] tty = not "--no-tty" in opts["<args>"] remove = not "--no-rm" in opts["<args>"] docker.exit_if_no_image_available(image) params = get_login_parameters(biobox_type) if params is None: error.err_exit("unknown_command", { "command_type": "biobox type", "command": biobox_type }) volumes = list( map(lambda d: create_login_volume(d['directory'], d['files']), params)) ctnr = docker.create_tty(image, tty, volumes) docker.login(ctnr) rm_login_dir() if remove: docker.remove(ctnr)
def run(argv): opts = util.parse_docopt(__doc__, argv, False) biobox = opts['<biobox_type>'] image = opts['<image>'] task = opts['--task'] verbose = opts['--verbose'] log = opts['--log'] if not behave.features_available(biobox): error.err_exit("unknown_command", { "command_type": "biobox type", "command": biobox }) ctn.exit_if_no_image_available(image) if verbose: results = behave.run(biobox, image, task, False) else: results = behave.run(biobox, image, task) if verbose: if log: sys.stdout = open(log, "w+") statuses = fn.thread([ behave.get_scenarios_and_statuses(results), F(map, lambda x: name_and_status(*x)), F(list) ]) longest_name = fn.thread( [statuses, F(map, fn.first), F(map, len), max]) def justify(x, y): return x.ljust(longest_name), y output = fn.thread([ statuses, F(map, lambda x: justify(*x)), F(map, F(" ".join)), fn.unique, F("\n".join) ]) print(output) if behave.is_failed(results): exit(1) elif behave.is_failed(results): if log: sys.stderr = open(log, "w+") msg = fn.thread([ behave.get_failing_scenarios(results), F(map, behave.scenario_name), F("\n".join) ]) error.err_exit('failed_verification', { 'image': image, 'error': msg, 'biobox': biobox })
def run(argv): opts = util.parse_docopt(__doc__, argv, True) module = util.select_module("biobox_type", opts["<biobox_type>"]) Biobox = util.get_subclasses(module, ABiobox).next() bbx = Biobox() ctnr = bbx.run(argv) if not '--no-rm' in argv: bbx.remove(ctnr)
def run(argv): opts = util.parse_docopt(__doc__, argv, True) module = util.select_module("biobox_type", opts["<biobox_type>"]) Biobox = next(util.get_subclasses(module, ABiobox)) bbx = Biobox() ctnr = bbx.run(argv) if not '--no-rm' in argv: ctn.remove(ctnr)
def run(argv): opts = util.parse_docopt(__doc__, argv, False) biobox = opts['<biobox_type>'] image = opts['<image>'] task = opts['--task'] verbose = opts['--verbose'] log = opts['--log'] if not behave.features_available(biobox): error.err_exit("unknown_command", {"command_type" : "biobox type", "command" : biobox}) ctn.exit_if_no_image_available(image) if verbose: results = behave.run(biobox, image, task, False) else: results = behave.run(biobox, image, task) if verbose: if log: sys.stdout = open(log, "w+") statuses = fn.thread([ behave.get_scenarios_and_statuses(results), F(map, lambda x: name_and_status(*x)), F(list)]) longest_name = fn.thread([ statuses, F(map, fn.first), F(map, len), max]) def justify(x, y): return x.ljust(longest_name), y output = fn.thread([ statuses, F(map, lambda x: justify(*x)), F(map, F(" ".join)), fn.unique, F("\n".join)]) print(output) if behave.is_failed(results): exit(1) elif behave.is_failed(results): if log: sys.stderr = open(log, "w+") msg = fn.thread([ behave.get_failing_scenarios(results), F(map, behave.scenario_name), F("\n".join)]) error.err_exit('failed_verification', {'image': image, 'error': msg, 'biobox' : biobox})
def run(self, argv): doc = inspect.getdoc(inspect.getmodule(self)) opts = util.parse_docopt(doc, argv, False) task = opts['--task'] image = opts['<image>'] output = opts['--output'] host_dst_dir = tmp.mkdtemp() volumes = self.prepare_volumes(opts, host_dst_dir) ctn.exit_if_no_image_available(image) ctnr = ctn.create(image, task, volumes) ctn.run(ctnr) self.after_run(output, host_dst_dir) return ctnr
def run(argv): opts = util.parse_docopt(__doc__, argv, True) image = opts["<image>"] biobox_type = opts["<biobox_type>"] tty = not "--no-tty" in opts["<args>"] remove = not "--no-rm" in opts["<args>"] docker.exit_if_no_image_available(image) params = get_login_parameters(biobox_type) if params is None: error.err_exit("unknown_command", {"command_type": "biobox type", "command": biobox_type}) volumes = list(map(lambda d: create_login_volume(d["directory"], d["files"]), params)) ctnr = docker.create_tty(image, tty, volumes) docker.login(ctnr) rm_login_dir() if remove: docker.remove(ctnr)
def run(self, argv): doc = inspect.getdoc(inspect.getmodule(self)) opts = util.parse_docopt(doc, argv, False) task = opts['--task'] image = opts['<image>'] output = opts['--output'] # Check the image exists ctn.exit_if_no_image_available(image) # Additional non-biobox args to pass to the docker daemon docker_args = {'mem_limit': opts['--memory'], 'cpuset': opts['--cpuset'], 'cpu_shares': int_or_none(opts['--cpu-shares'])} output_dir = tempfile.mkdtemp() ctnr = biobox.create_container(image, self.prepare_config(opts), output_dir, task, docker_args) ctn.run(ctnr) self.after_run(output, output_dir) return ctnr
def run(): args = input_args() opts = util.parse_docopt(__doc__, args, True) util.select_module("command", opts["<command>"]).run(args)