Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

723 B
Raw Blame
from abc import ABC, abstractmethod
from enum import StrEnum

from services.workflow.entities import WorkflowScheduleCFSPlanEntity


class SchedulerCommand(StrEnum):
    """
    Scheduler command.
    """

    RESOURCE_LIMIT_REACHED = "resource_limit_reached"
    NONE = "none"


class CFSPlanScheduler[PlanT: WorkflowScheduleCFSPlanEntity](ABC):
    """
    CFS plan scheduler.
    """

    plan: PlanT

    def __init__(self, plan: PlanT):
        """
        Initialize the CFS plan scheduler.

        Args:
            plan: The CFS plan.
        """
        self.plan = plan

    @abstractmethod
    def can_schedule(self) -> SchedulerCommand:
        """
        Whether a workflow run can be scheduled.
        """