Esempio n. 1
0
    def _find_container(
        self,
        job_wrapper,
        compute_working_directory=None,
        compute_tool_directory=None,
        compute_job_directory=None,
        compute_tmp_directory=None,
    ):
        job_directory_type = "galaxy" if compute_working_directory is None else "pulsar"
        if not compute_working_directory:
            compute_working_directory = job_wrapper.tool_working_directory

        if not compute_job_directory:
            compute_job_directory = job_wrapper.working_directory

        if not compute_tool_directory:
            compute_tool_directory = job_wrapper.tool.tool_dir

        if not compute_tmp_directory:
            compute_tmp_directory = job_wrapper.tmp_directory()

        tool = job_wrapper.tool
        guest_ports = job_wrapper.guest_ports
        tool_info = ToolInfo(
            tool.containers,
            tool.requirements,
            tool.requires_galaxy_python_environment,
            tool.docker_env_pass_through,
            guest_ports=guest_ports,
            tool_id=tool.id,
            tool_version=tool.version,
            profile=tool.profile,
        )
        job_info = JobInfo(
            working_directory=compute_working_directory,
            tool_directory=compute_tool_directory,
            job_directory=compute_job_directory,
            tmp_directory=compute_tmp_directory,
            home_directory=job_wrapper.home_directory(),
            job_directory_type=job_directory_type,
        )

        destination_info = job_wrapper.job_destination.params
        container = self.app.container_finder.find_container(
            tool_info,
            destination_info,
            job_info
        )
        if container:
            job_wrapper.set_container(container)
        return container
Esempio n. 2
0
    def _find_container(
        self,
        job_wrapper,
        compute_working_directory=None,
        compute_tool_directory=None,
        compute_job_directory=None,
        compute_tmp_directory=None,
    ):
        job_directory_type = "galaxy" if compute_working_directory is None else "pulsar"
        if not compute_working_directory:
            compute_working_directory = job_wrapper.tool_working_directory

        if not compute_job_directory:
            compute_job_directory = job_wrapper.working_directory

        if not compute_tool_directory:
            compute_tool_directory = job_wrapper.tool.tool_dir

        if not compute_tmp_directory:
            compute_tmp_directory = job_wrapper.tmp_directory()

        tool = job_wrapper.tool
        guest_ports = [
            ep.get('port')
            for ep in getattr(job_wrapper, 'interactivetools', [])
        ]
        tool_info = ToolInfo(tool.containers,
                             tool.requirements,
                             tool.requires_galaxy_python_environment,
                             tool.docker_env_pass_through,
                             guest_ports=guest_ports)
        job_info = JobInfo(
            compute_working_directory,
            compute_tool_directory,
            compute_job_directory,
            compute_tmp_directory,
            job_directory_type,
        )

        destination_info = job_wrapper.job_destination.params
        container = self.app.container_finder.find_container(
            tool_info, destination_info, job_info)
        if container:
            job_wrapper.set_container(container)
        return container