コード例 #1
0
    def scheduler_debug_info(self):
        from dagster.core.scheduler import SchedulerDebugInfo, ScheduleStatus

        errors = []

        schedules = []
        for schedule_state in self.all_stored_schedule_state():
            if schedule_state.status == ScheduleStatus.RUNNING and not self.running_schedule_count(
                    schedule_state.schedule_origin_id):
                errors.append(
                    "Schedule {schedule_name} is set to be running, but the scheduler is not "
                    "running the schedule.".format(
                        schedule_name=schedule_state.name))
            elif schedule_state.status == ScheduleStatus.STOPPED and self.running_schedule_count(
                    schedule_state.schedule_origin_id):
                errors.append(
                    "Schedule {schedule_name} is set to be stopped, but the scheduler is still running "
                    "the schedule.".format(schedule_name=schedule_state.name))

            if self.running_schedule_count(
                    schedule_state.schedule_origin_id) > 1:
                errors.append(
                    "Duplicate jobs found: More than one job for schedule {schedule_name} are "
                    "running on the scheduler.".format(
                        schedule_name=schedule_state.name))

            schedule_info = {
                schedule_state.name: {
                    "status":
                    schedule_state.status.value,
                    "cron_schedule":
                    schedule_state.cron_schedule,
                    "python_path":
                    schedule_state.pipeline_origin.executable_path,
                    "pipeline_origin_id":
                    schedule_state.pipeline_origin.get_id(),
                    "repository_pointer":
                    schedule_state.pipeline_origin.get_repo_cli_args(),
                    "schedule_origin_id":
                    schedule_state.schedule_origin_id,
                    "repository_origin_id":
                    schedule_state.repository_origin_id,
                }
            }

            schedules.append(
                yaml.safe_dump(schedule_info, default_flow_style=False))

        return SchedulerDebugInfo(
            scheduler_config_info=self.info_str_for_component(
                "Scheduler", self.scheduler),
            scheduler_info=self.scheduler.debug_info(),
            schedule_storage=schedules,
            errors=errors,
        )
コード例 #2
0
    def scheduler_debug_info(self):
        from dagster.core.scheduler import SchedulerDebugInfo, ScheduleStatus

        errors = []

        schedule_info = self.all_schedules_info()
        schedules = []
        for repository_name, schedule in schedule_info:
            if (schedule.status == ScheduleStatus.RUNNING
                    and not self._scheduler.is_scheduler_job_running(
                        repository_name, schedule.name)):
                errors.append(
                    "Schedule {schedule_name} is set to be running, but the scheduler is not "
                    "running the schedule. Run `dagster schedule up` to resolve"
                    .format(schedule_name=schedule.name))
            elif (schedule.status == ScheduleStatus.STOPPED
                  and self._scheduler.is_scheduler_job_running(
                      repository_name, schedule.name)):
                errors.append(
                    "Schedule {schedule_name} is set to be stopped, but the scheduler is still running "
                    "the schedule. Run `dagster schedule up` to resolve".
                    format(schedule_name=schedule.name))

            if self._scheduler.is_scheduler_job_running(
                    repository_name, schedule.name) > 1:
                errors.append(
                    "Duplicate jobs found: More than one job for schedule {schedule_name} are "
                    "running on the scheduler.  "
                    "Run `dagster schedule up` to resolve".format(
                        schedule_name=schedule.name))

            schedule_info = {
                schedule.name: {
                    "status": schedule.status.value,
                    "cron_schedule": schedule.cron_schedule,
                    "python_path": schedule.python_path,
                    "repository_name": repository_name,
                    "repository_path": schedule.repository_path,
                }
            }

            schedules.append(
                yaml.safe_dump(schedule_info, default_flow_style=False))

        return SchedulerDebugInfo(
            scheduler_config_info=self.info_str_for_component(
                'Scheduler', self.scheduler),
            scheduler_info=self.scheduler.debug_info(),
            schedule_storage=schedules,
            errors=errors,
        )