def cli(ctx, path, **kwds): """Launch a shell in the Docker container referenced by the specified tool. Prints a command to do this the way Galaxy would in job files it generates - so be sure to wrap this in $(...) to launch the subshell.:: % $(planemo docker_shell bowtie2.xml) ... root@b8754062f875:/# """ tool_xml = load_tool(path) requirements, containers = parse_requirements_from_xml(tool_xml) identifier = None for container in containers: if container.type == "docker": identifier = container.identifier if kwds["from_tag"]: identifier = "-t %s" % identifier script = docker_util.build_docker_run_command( "/bin/bash", identifier, interactive=True, **dockerfiles.docker_host_args(**kwds) ) print(script)
def cli(ctx, path, **kwds): """Launch a shell in the Docker container referenced by the specified tool. Prints a command to do this the way Galaxy would in job files it generates - so be sure to wrap this in $(...) to launch the subshell.:: % $(planemo docker_shell bowtie2.xml) ... root@b8754062f875:/# """ tool_xml = load_tool(path) requirements, containers = parse_requirements_from_xml(tool_xml) identifier = None for container in containers: if container.type == "docker": identifier = container.identifier if kwds["from_tag"]: identifier = "-t %s" % identifier script = docker_util.build_docker_run_command( "/bin/bash", identifier, interactive=True, **dockerfiles.docker_host_args(**kwds)) print(script)
def __init__(self, **kwds): """Construct a postgres database source from planemo configuration.""" self.psql_path = 'psql' self.database_user = '******' self.database_password = DEFAULT_POSTGRES_PASSWORD self.database_host = 'localhost' # TODO: Make docker host self.database_port = DEFAULT_POSTGRES_PORT_EXPOSE self._kwds = kwds self._docker_host_kwds = dockerfiles.docker_host_args(**kwds) if not is_running_container(**self._docker_host_kwds): start_postgres_docker(**self._docker_host_kwds) # Hack to give docker a bit of time to boot up and allow psql to start. time.sleep(30)
def cli(ctx, path, **kwds): """Launch shell in Docker container for a tool. Will launch a shell in the Docker container referenced by the specified tool. Prints a command to do this the way Galaxy would in job files it generates - so be sure to wrap this in $(...) to launch the subshell. \b $ $(planemo docker_shell bowtie2.xml) ... root@b8754062f875:/# """ tool_xml = load_tool(path) requirements, containers = parse_requirements_from_xml(tool_xml) identifier = None for container in containers: if container.type == "docker": identifier = container.identifier # Refactor mulled container resolver to be able to do this. if kwds["from_tag"]: identifier = "-t %s" % identifier tool_dir = os.path.dirname(os.path.abspath(path)) working_dir = os.path.abspath(os.getcwd()) if tool_dir.startswith(working_dir): volumes = [ "%s:%s" % (working_dir, working_dir) ] elif working_dir.startswith(tool_dir): volumes = [ "%s:%s" % (tool_dir, tool_dir) ] else: volumes = [ "%s:%s" % (working_dir, working_dir), "%s:%s" % (tool_dir, tool_dir) ] script = docker_util.build_docker_run_command( "/bin/bash", identifier, interactive=True, terminal=True, working_directory=working_dir, volumes=volumes, **dockerfiles.docker_host_args(**kwds) ) print(script)
def cli(ctx, path, **kwds): """Launch shell in Docker container for a tool. Will launch a shell in the Docker container referenced by the specified tool. Prints a command to do this the way Galaxy would in job files it generates - so be sure to wrap this in $(...) to launch the subshell.:: % $(planemo docker_shell bowtie2.xml) ... root@b8754062f875:/# """ tool_xml = load_tool(path) requirements, containers = parse_requirements_from_xml(tool_xml) identifier = None for container in containers: if container.type == "docker": identifier = container.identifier if kwds["from_tag"]: identifier = "-t %s" % identifier tool_dir = os.path.dirname(os.path.abspath(path)) working_dir = os.path.abspath(os.getcwd()) if tool_dir.startswith(working_dir): volumes = [ "%s:%s" % (working_dir, working_dir) ] elif working_dir.startswith(tool_dir): volumes = [ "%s:%s" % (tool_dir, tool_dir) ] else: volumes = [ "%s:%s" % (working_dir, working_dir), "%s:%s" % (tool_dir, tool_dir) ] script = docker_util.build_docker_run_command( "/bin/bash", identifier, interactive=True, terminal=True, working_directory=working_dir, volumes=volumes, **dockerfiles.docker_host_args(**kwds) ) print(script)