Commit c3dc842a authored by Brewer, Wes's avatar Brewer, Wes
Browse files

feat: add urgent queue configuration for reserved nodes and max runtime

parent 5fa83847
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -243,6 +243,10 @@ class SimConfig(RAPSBaseModel, abc.ABC):
    Downtime length. Can pass a string like 123, 27m, 3h, 7d
    """

    @cached_property
    def urgent_max_runtime_int(self) -> int:
        return int(self.urgent_max_runtime / self.time_unit)

    @cached_property
    def downtime_first_int(self) -> int | None:
        return None if self.downtime_first is None else int(self.downtime_first / self.time_unit)
@@ -256,6 +260,14 @@ class SimConfig(RAPSBaseModel, abc.ABC):
        return None if self.downtime_length is None else int(self.downtime_length / self.time_unit)

    # Continous Job Generation
    urgent_reserved_nodes: int = 64
    """ Number of nodes reserved exclusively for the urgent job queue """
    urgent_max_runtime: SmartTimedelta = timedelta(days=2)
    """
    Maximum allowed runtime for urgent jobs. Jobs exceeding this are demoted to the normal queue.
    Can pass a string like 123, 27m, 3h, 7d
    """

    continuous_job_generation: bool = False
    """ Activate continuous job generation """
    maxqueue: int = 50
@@ -274,6 +286,7 @@ class SimConfig(RAPSBaseModel, abc.ABC):
        td_fields = [
            "time_delta", "time", "fastforward",
            "downtime_first", "downtime_interval", "downtime_length",
            "urgent_max_runtime",
        ]
        # infer time unit from other timedelta fields if it wasn't set explicitly
        if data.get('time_unit') is None:
@@ -312,6 +325,7 @@ class SimConfig(RAPSBaseModel, abc.ABC):
        td_fields = [
            "time_delta", "time", "fastforward",
            "downtime_first", "downtime_interval", "downtime_length",
            "urgent_max_runtime",
        ]
        # Check time fields are divisible by time_unit.
        for field in td_fields:
@@ -509,4 +523,6 @@ SIM_SHORTCUTS = {
    "plot": "p",
    "replay": "f",
    "workload": "w",
    "urgent-reserved-nodes": "urn",
    "urgent-max-runtime": "umr",
}