コード例 #1
0
def job_config(template_str, jobs_directory):
    job_conf_template = string.Template(template_str)
    port = os.environ.get('GALAXY_TEST_PORT')
    assert port
    infrastructure_url = "http://%s:%s" % (GALAXY_TEST_KUBERNETES_INFRASTRUCTURE_HOST, port)
    container_amqp_url = to_infrastructure_uri(AMQP_URL)
    job_conf_str = job_conf_template.substitute(jobs_directory=jobs_directory,
                                                tool_directory=TOOL_DIR,
                                                k8s_config_path=integration_util.k8s_config_path(),
                                                amqp_url=AMQP_URL,
                                                container_amqp_url=container_amqp_url,
                                                infrastructure_url=infrastructure_url,
                                                )
    with tempfile.NamedTemporaryFile(suffix="_kubernetes_integration_job_conf.yml", mode="w", delete=False) as job_conf:
        job_conf.write(job_conf_str)
    return job_conf.name
コード例 #2
0
def job_config(template_str, jobs_directory):
    job_conf_template = string.Template(template_str)
    container_amqp_url = to_infrastructure_uri(AMQP_URL)
    instance_id = ''.join(
        random.choice(string.ascii_lowercase) for i in range(8))
    job_conf_str = job_conf_template.substitute(
        jobs_directory=jobs_directory,
        tool_directory=TOOL_DIR,
        instance_id=instance_id,
        k8s_config_path=integration_util.k8s_config_path(),
        k8s_namespace=GALAXY_TEST_KUBERNETES_NAMESPACE,
        amqp_url=AMQP_URL,
        container_amqp_url=container_amqp_url,
    )
    with tempfile.NamedTemporaryFile(
            suffix="_kubernetes_integration_job_conf.yml", mode="w",
            delete=False) as job_conf:
        job_conf.write(job_conf_str)
    return job_conf.name
コード例 #3
0
def job_config(jobs_directory):
    job_conf_template = string.Template("""<job_conf>
    <plugins>
        <plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="2"/>
        <plugin id="k8s" type="runner" load="galaxy.jobs.runners.kubernetes:KubernetesJobRunner">
            <param id="k8s_persistent_volume_claims">jobs-directory-claim:$jobs_directory,tool-directory-claim:$tool_directory</param>
            <param id="k8s_config_path">$k8s_config_path</param>
            <param id="k8s_galaxy_instance_id">gx-short-id</param>
            <param id="k8s_run_as_user_id">$$uid</param>
        </plugin>
        <plugin id="k8s_walltime_short" type="runner" load="galaxy.jobs.runners.kubernetes:KubernetesJobRunner">
            <param id="k8s_persistent_volume_claims">jobs-directory-claim:$jobs_directory,tool-directory-claim:$tool_directory</param>
            <param id="k8s_config_path">$k8s_config_path</param>
            <param id="k8s_galaxy_instance_id">gx-short-id</param>
            <param id="k8s_walltime_limit">10</param>
            <param id="k8s_run_as_user_id">$$uid</param>
        </plugin>
        <plugin id="k8s_no_cleanup" type="runner" load="galaxy.jobs.runners.kubernetes:KubernetesJobRunner">
            <param id="k8s_persistent_volume_claims">jobs-directory-claim:$jobs_directory,tool-directory-claim:$tool_directory</param>
            <param id="k8s_config_path">$k8s_config_path</param>
            <param id="k8s_galaxy_instance_id">gx-short-id</param>
            <param id="k8s_cleanup_job">never</param>
            <param id="k8s_run_as_user_id">$$uid</param>
        </plugin>
    </plugins>
    <destinations default="k8s_destination">
        <destination id="k8s_destination" runner="k8s">
            <param id="limits_cpu">1.1</param>
            <param id="limits_memory">10M</param>
            <param id="docker_enabled">true</param>
            <param id="docker_default_container_id">busybox:ubuntu-14.04</param>
            <env id="SOME_ENV_VAR">42</env>
        </destination>
        <destination id="k8s_destination_walltime_short" runner="k8s_walltime_short">
            <param id="limits_cpu">1.1</param>
            <param id="limits_memory">10M</param>
            <param id="docker_enabled">true</param>
            <param id="docker_default_container_id">busybox:ubuntu-14.04</param>
            <env id="SOME_ENV_VAR">42</env>
        </destination>
        <destination id="k8s_destination_no_cleanup" runner="k8s_no_cleanup">
            <param id="limits_cpu">1.1</param>
            <param id="limits_memory">10M</param>
            <param id="docker_enabled">true</param>
            <param id="docker_default_container_id">busybox:ubuntu-14.04</param>
            <env id="SOME_ENV_VAR">42</env>
        </destination>
        <destination id="local_dest" runner="local">
        </destination>
    </destinations>
    <tools>
        <tool id="upload1" destination="local_dest"/>
        <tool id="create_2" destination="k8s_destination_walltime_short"/>
        <tool id="galaxy_slots_and_memory" destination="k8s_destination_no_cleanup"/>
    </tools>
</job_conf>
""")
    job_conf_str = job_conf_template.substitute(
        jobs_directory=jobs_directory,
        tool_directory=TOOL_DIR,
        k8s_config_path=integration_util.k8s_config_path(),
    )
    with tempfile.NamedTemporaryFile(
            suffix="_kubernetes_integration_job_conf.xml", mode="w",
            delete=False) as job_conf:
        job_conf.write(job_conf_str)
    return Config(job_conf.name)