Exemplo n.º 1
0
    def start_dockerizer(self, resources=None, node_selectors=None):
        volumes, volume_mounts = get_docker_volumes()
        deployment = pods.get_pod(
            namespace=self.namespace,
            app=settings.APP_LABELS_DOCKERIZER,
            name=self.DOCKERIZER_JOB_NAME,
            project_name=self.project_name,
            project_uuid=self.project_uuid,
            job_name=self.job_name,
            job_uuid=self.job_uuid,
            volume_mounts=volume_mounts,
            volumes=volumes,
            image=settings.JOB_DOCKERIZER_IMAGE,
            command=None,
            args=[self.job_uuid],
            ports=[],
            env_vars=self.get_env_vars(),
            container_name=settings.CONTAINER_NAME_DOCKERIZER_JOB,
            resources=resources,
            node_selector=node_selectors,
            role=settings.ROLE_LABELS_WORKER,
            type=settings.TYPE_LABELS_EXPERIMENT,
            restart_policy='Never')
        pod_name = constants.JOB_NAME.format(
            job_uuid=self.job_uuid, name=self.DOCKERIZER_JOB_NAME)

        pod_resp, _ = self.create_or_update_pod(name=pod_name, data=deployment)
        return pod_resp.to_dict()
Exemplo n.º 2
0
    def start_dockerizer(self, resources=None, node_selectors=None):
        volumes, volume_mounts = get_docker_volumes()
        deployment = pods.get_pod(
            namespace=self.namespace,
            app=settings.APP_LABELS_DOCKERIZER,
            name=self.DOCKERIZER_JOB_NAME,
            project_name=self.project_name,
            project_uuid=self.project_uuid,
            job_name=self.job_name,
            job_uuid=self.job_uuid,
            volume_mounts=volume_mounts,
            volumes=volumes,
            image=settings.JOB_DOCKERIZER_IMAGE,
            command=None,
            args=[self.job_uuid],
            ports=[],
            env_vars=self.get_env_vars(),
            container_name=settings.CONTAINER_NAME_DOCKERIZER_JOB,
            resources=resources,
            node_selector=node_selectors,
            role=settings.ROLE_LABELS_WORKER,
            type=settings.TYPE_LABELS_EXPERIMENT,
            restart_policy='Never')
        pod_name = constants.JOB_NAME.format(job_uuid=self.job_uuid,
                                             name=self.DOCKERIZER_JOB_NAME)

        pod_resp, _ = self.create_or_update_pod(name=pod_name, data=deployment)
        return pod_resp.to_dict()
Exemplo n.º 3
0
    def start_dockerizer(self,
                         resources=None,
                         node_selector=None,
                         affinity=None,
                         tolerations=None):
        volumes, volume_mounts = get_docker_volumes()
        env_vars = self.get_env_vars()

        resource_name = self.resource_manager.get_resource_name()
        pod = self.resource_manager.get_pod(
            resource_name=resource_name,
            volume_mounts=volume_mounts,
            volumes=volumes,
            labels=self.resource_manager.labels,
            env_vars=env_vars,
            command=None,
            args=[self.job_uuid],
            persistence_outputs=None,
            persistence_data=None,
            outputs_refs_jobs=None,
            outputs_refs_experiments=None,
            secret_refs=None,
            configmap_refs=None,
            resources=resources,
            ephemeral_token=None,
            node_selector=node_selector,
            affinity=affinity,
            tolerations=tolerations,
            restart_policy='Never')

        pod_resp, _ = self.create_or_update_pod(name=resource_name, data=pod)
        return pod_resp.to_dict()
Exemplo n.º 4
0
    def start_dockerizer(self,
                         secret_refs=None,
                         config_map_refs=None,
                         resources=None,
                         labels=None,
                         annotations=None,
                         node_selector=None,
                         affinity=None,
                         tolerations=None,
                         reconcile_url=None,
                         max_restarts=None):
        volumes, volume_mounts = get_docker_volumes()
        context_volumes, context_mounts = get_build_context_volumes()
        volumes += context_volumes
        volume_mounts += context_mounts
        registry_auth_volumes, registry_auth_mounts = self.get_docker_credentials_volumes()
        volumes += registry_auth_volumes
        volume_mounts += registry_auth_mounts

        resource_name = self.resource_manager.get_resource_name()
        command, args = self.get_pod_command_args()
        init_command, init_args = self.get_init_command_args()

        labels = get_labels(default_labels=self.resource_manager.labels, labels=labels)
        pod = self.resource_manager.get_pod(
            resource_name=resource_name,
            volume_mounts=volume_mounts,
            volumes=volumes,
            labels=labels,
            env_vars=self.get_env_vars(),
            command=command,
            args=args,
            init_command=init_command,
            init_args=init_args,
            init_env_vars=self.get_init_env_vars(),
            persistence_outputs=None,
            persistence_data=None,
            outputs_refs_jobs=None,
            outputs_refs_experiments=None,
            secret_refs=secret_refs,
            config_map_refs=config_map_refs,
            resources=resources,
            annotations=annotations,
            ephemeral_token=None,
            node_selector=node_selector,
            affinity=affinity,
            tolerations=tolerations,
            init_context_mounts=context_mounts,
            reconcile_url=reconcile_url,
            max_restarts=max_restarts,
            restart_policy=get_pod_restart_policy(max_restarts))

        pod_resp, _ = self.create_or_update_pod(name=resource_name, body=pod, reraise=True)
        return pod_resp.to_dict()
Exemplo n.º 5
0
    def start_dockerizer(self,
                         resources=None,
                         node_selector=None,
                         affinity=None,
                         tolerations=None):
        volumes, volume_mounts = get_docker_volumes()

        node_selector = get_node_selector(
            node_selector=node_selector,
            default_node_selector=conf.get('NODE_SELECTOR_BUILDS'))
        affinity = get_affinity(
            affinity=affinity,
            default_affinity=conf.get('AFFINITY_BUILDS'))
        tolerations = get_tolerations(
            tolerations=tolerations,
            default_tolerations=conf.get('TOLERATIONS_BUILDS'))
        pod = pods.get_pod(
            namespace=self.namespace,
            app=conf.get('APP_LABELS_DOCKERIZER'),
            name=DOCKERIZER_JOB_NAME,
            project_name=self.project_name,
            project_uuid=self.project_uuid,
            job_name=self.job_name,
            job_uuid=self.job_uuid,
            volume_mounts=volume_mounts,
            volumes=volumes,
            image=conf.get('JOB_DOCKERIZER_IMAGE'),
            image_pull_policy=conf.get('JOB_DOCKERIZER_IMAGE_PULL_POLICY'),
            command=None,
            args=[self.job_uuid],
            ports=[],
            env_vars=self.get_env_vars(),
            container_name=conf.get('CONTAINER_NAME_DOCKERIZER_JOB'),
            resources=resources,
            node_selector=node_selector,
            affinity=affinity,
            tolerations=tolerations,
            role=conf.get('ROLE_LABELS_WORKER'),
            type=conf.get('TYPE_LABELS_RUNNER'),
            service_account_name=conf.get('K8S_SERVICE_ACCOUNT_BUILDS'),
            restart_policy='Never')
        pod_name = JOB_NAME_FORMAT.format(job_uuid=self.job_uuid, name=DOCKERIZER_JOB_NAME)

        pod_resp, _ = self.create_or_update_pod(name=pod_name, data=pod)
        return pod_resp.to_dict()
Exemplo n.º 6
0
    def start_dockerizer(self,
                         resources=None,
                         node_selector=None,
                         affinity=None,
                         tolerations=None):
        volumes, volume_mounts = get_docker_volumes()

        node_selector = get_node_selector(
            node_selector=node_selector,
            default_node_selector=settings.NODE_SELECTOR_BUILDS)
        affinity = get_affinity(
            affinity=affinity,
            default_affinity=settings.AFFINITY_BUILDS)
        tolerations = get_tolerations(
            tolerations=tolerations,
            default_tolerations=settings.TOLERATIONS_BUILDS)
        deployment = pods.get_pod(
            namespace=self.namespace,
            app=settings.APP_LABELS_DOCKERIZER,
            name=self.DOCKERIZER_JOB_NAME,
            project_name=self.project_name,
            project_uuid=self.project_uuid,
            job_name=self.job_name,
            job_uuid=self.job_uuid,
            volume_mounts=volume_mounts,
            volumes=volumes,
            image=settings.JOB_DOCKERIZER_IMAGE,
            command=None,
            args=[self.job_uuid],
            ports=[],
            env_vars=self.get_env_vars(),
            container_name=settings.CONTAINER_NAME_DOCKERIZER_JOB,
            resources=resources,
            node_selector=node_selector,
            affinity=affinity,
            tolerations=tolerations,
            role=settings.ROLE_LABELS_WORKER,
            type=settings.TYPE_LABELS_RUNNER,
            restart_policy='Never')
        pod_name = constants.JOB_NAME.format(
            job_uuid=self.job_uuid, name=self.DOCKERIZER_JOB_NAME)

        pod_resp, _ = self.create_or_update_pod(name=pod_name, data=deployment)
        return pod_resp.to_dict()