Ejemplo n.º 1
0
    def start_schedule(self, deployment_path: str):
        # Load start_schedule_deployment
        with open(deployment_path, 'r') as fr:
            start_schedule_deployment = yaml.safe_load(fr)

        # Standardize start_schedule_deployment
        K8sAzureExecutor._standardize_start_schedule_deployment(start_schedule_deployment=start_schedule_deployment)
        schedule_name = start_schedule_deployment['name']

        # Save schedule deployment
        os.makedirs(os.path.expanduser(
            f"{GlobalPaths.MARO_CLUSTERS}/{self.cluster_name}/schedules/{schedule_name}"), exist_ok=True)
        save_schedule_details(
            cluster_name=self.cluster_name,
            schedule_name=schedule_name,
            schedule_details=start_schedule_deployment
        )

        # Start jobs
        for job_name in start_schedule_deployment['job_names']:
            job_details = K8sAzureExecutor._build_job_details(
                schedule_details=start_schedule_deployment,
                job_name=job_name
            )
            self._start_job(
                job_details=job_details
            )
Ejemplo n.º 2
0
    def start_schedule(self, deployment_path: str):
        # Load start_schedule_deployment
        with open(deployment_path, 'r') as fr:
            start_schedule_deployment = yaml.safe_load(fr)

        # Standardize start_schedule_deployment
        self._standardize_start_schedule_deployment(
            start_schedule_deployment=start_schedule_deployment)
        schedule_name = start_schedule_deployment['name']

        # Load details
        cluster_details = self.cluster_details
        admin_username = cluster_details['user']['admin_username']
        master_public_ip_address = cluster_details['master'][
            'public_ip_address']

        # Sync mkdir
        sync_mkdir(
            remote_path=
            f"{GlobalPaths.MARO_CLUSTERS}/{self.cluster_name}/schedules/{schedule_name}",
            admin_username=admin_username,
            node_ip_address=master_public_ip_address)

        # Save schedule deployment
        save_schedule_details(cluster_name=self.cluster_name,
                              schedule_name=schedule_name,
                              schedule_details=start_schedule_deployment)

        # Start jobs
        for job_name in start_schedule_deployment['job_names']:
            job_details = self._build_job_details(
                schedule_details=start_schedule_deployment, job_name=job_name)

            self._start_job(job_details=job_details)