예제 #1
0
파일: config.py 프로젝트: pvanheus/planemo
    def startup_command(self, ctx, **kwds):
        """Return a shell command used to startup this instance.

        Among other common planmo kwds, this should respect the
        ``daemon`` keyword.
        """
        daemon = kwds.get("daemon", False)
        daemon_str = "" if not daemon else " -d"
        docker_run_extras = "-p %s:80%s" % (self.port, daemon_str)
        env_directives = ["%s='%s'" % item for item in self.env.items()]
        image = kwds.get("docker_galaxy_image", "bgruening/galaxy-stable")
        run_command = docker_util.build_docker_run_command(
            "", image,
            interactive=False,
            env_directives=env_directives,
            working_directory=None,
            name=self.server_name,
            run_extra_arguments=docker_run_extras,
            set_user=False,
            volumes=self.volumes,
            **self.docker_target_kwds
        )
        chmod_command = [
            "chmod",
            "-R",
            "o+rwx",
            self.config_directory,
        ]
        if self.export_directory:
            chmod_command.append(self.export_directory)

        return shell_join(
            argv_to_str(chmod_command),
            run_command,
        )
예제 #2
0
    def startup_command(self, ctx, **kwds):
        """Return a shell command used to startup this instance.

        Among other common planmo kwds, this should respect the
        ``daemon`` keyword.
        """
        daemon = kwds.get("daemon", False)
        daemon_str = "" if not daemon else " -d"
        docker_run_extras = "-p %s:80%s" % (self.port, daemon_str)
        env_directives = ["%s='%s'" % item for item in self.env.items()]
        image = kwds.get("docker_galaxy_image", "bgruening/galaxy-stable")
        run_command = docker_util.build_docker_run_command(
            "",
            image,
            interactive=False,
            env_directives=env_directives,
            working_directory=None,
            name=self.server_name,
            run_extra_arguments=docker_run_extras,
            set_user=False,
            volumes=self.volumes,
            **self.docker_target_kwds)
        chmod_command = [
            "chmod",
            "-R",
            "o+rwx",
            self.config_directory,
        ]
        if self.export_directory:
            chmod_command.append(self.export_directory)

        return shell_join(
            argv_to_str(chmod_command),
            run_command,
        )
예제 #3
0
파일: io.py 프로젝트: michauhl/planemo
def shell(cmds, **kwds):
    if isinstance(cmds, list):
        cmd_string = commands.argv_to_str(cmds)
    else:
        cmd_string = cmds
    info(cmd_string)
    return commands.shell(cmds, **kwds)
예제 #4
0
파일: io.py 프로젝트: natefoo/planemo
def communicate(cmds, **kwds):
    if isinstance(cmds, list):
        cmds = commands.argv_to_str(cmds)
    info(cmds)
    p = commands.shell_process(cmds, **kwds)
    if kwds.get("stdout", None) is None and commands.redirecting_io(sys=sys):
        output = commands.redirect_aware_commmunicate(p)
    else:
        output = p.communicate()

    if p.returncode != 0:
        template = "Problem executing commands {0} - ({1}, {2})"
        msg = template.format(cmds, output[0], output[1])
        raise RuntimeError(msg)
    return output
예제 #5
0
def communicate(cmds, **kwds):
    if isinstance(cmds, list):
        cmds = commands.argv_to_str(cmds)
    info(cmds)
    p = commands.shell_process(cmds, **kwds)
    if kwds.get("stdout", None) is None and commands.redirecting_io(sys=sys):
        output = commands.redirect_aware_commmunicate(p)
    else:
        output = p.communicate()

    if p.returncode != 0:
        template = "Problem executing commands {0} - ({1}, {2})"
        msg = template.format(cmds, output[0], output[1])
        raise RuntimeError(msg)
    return output
예제 #6
0
def args_to_str(args):
    if args is None or isinstance(args, string_types):
        return args
    else:
        return commands.argv_to_str(args)
예제 #7
0
파일: io.py 프로젝트: galaxyproject/planemo
def args_to_str(args):
    if args is None or isinstance(args, string_types):
        return args
    else:
        return commands.argv_to_str(args)