From 1ba90efc8f8dd7f65b60ea826ba640c6ad1bcc56 Mon Sep 17 00:00:00 2001 From: Matthias Maiterth Date: Fri, 5 Sep 2025 12:12:30 -0400 Subject: [PATCH 1/2] Re moved schedulers. TODO: parameters of the extended policies are not parseable by pydantic! e.g. --scheduler experimental --policy acct_edp does not work! class ExtendedPolicyType(ValueComparableEnum): ACCT_FUGAKU_PTS = 'acct_fugaku_pts' ACCT_AVG_P = 'acct_avg_power' ACCT_LOW_AVG_P = 'acct_low_avg_power' ACCT_AVG_PW4LJ = 'acct_avg_power_w4lj' ACCT_EDP = 'acct_edp' ACCT_ED2P = 'acct_ed2p' ACCT_PDP = 'acct_pdp' --- raps/sim_config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/raps/sim_config.py b/raps/sim_config.py index a3091bf..f9c5ef5 100644 --- a/raps/sim_config.py +++ b/raps/sim_config.py @@ -158,7 +158,11 @@ class SimConfig(BaseModel): # Synthetic workloads scheduler: Literal[ - "default", "scheduleflow", "fastsim", "anl", "flux", "experimental", "multitenant", + "default", + "experimental", + "fastsim", + "multitenant", + "scheduleflow", ] = "default" """ Scheduler name """ policy: PolicyType | None = None -- GitLab From aa646a858a4cd7db32dc6cd6ecab2934f7dfcdc9 Mon Sep 17 00:00:00 2001 From: Matthias Maiterth Date: Fri, 5 Sep 2025 13:06:49 -0400 Subject: [PATCH 2/2] Added validator for ExtendedPolicyType and ExtendedBackfillType Note: no scheduler does implement ExtendedBackfillType as of now! --- raps/sim_config.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/raps/sim_config.py b/raps/sim_config.py index f9c5ef5..5cdd09c 100644 --- a/raps/sim_config.py +++ b/raps/sim_config.py @@ -8,6 +8,7 @@ from raps.utils import ( ) from raps.system_config import SystemConfig, get_partition_configs from pydantic import BaseModel, model_validator +import importlib Distribution = Literal['uniform', 'weibull', 'normal'] @@ -165,9 +166,9 @@ class SimConfig(BaseModel): "scheduleflow", ] = "default" """ Scheduler name """ - policy: PolicyType | None = None + policy: str | None = None """ Schedule policy """ - backfill: BackfillType | None = None + backfill: str | None = None """ Backfill policy """ # Arrival @@ -262,6 +263,34 @@ class SimConfig(BaseModel): if self.live and not self.replay and self.time is None: raise ValueError("--time must be set, specifing how long we want to predict") + if self.policy or self.backfill: + try: + module = importlib.import_module(f"raps.schedulers.{self.scheduler}") + except ImportError as e: + raise ValueError(f"Scheduler '{self.scheduler}' could not be imported") from e + + if self.policy: + extended_policytypes = getattr(module, "ExtendedPolicyType", None) + + valid_policies = set(m.value for m in PolicyType) + if extended_policytypes is not None: + valid_policies |= {m.value for m in extended_policytypes} + + if self.policy not in valid_policies: + raise ValueError(f"policy {self.policy} not implemented by {self.scheduler}. " + f"Valid selections: {sorted(valid_policies)}") + + if self.backfill: + extended_backfilltypes = getattr(module, "ExtendedBackfillType", None) + + valid_backfilltypes = set(m.value for m in BackfillType) + if extended_backfilltypes is not None: + valid_backfilltypes |= {m.value for m in extended_backfilltypes} + + if self.backfill not in valid_backfilltypes: + raise ValueError(f"policy {self.backfill} not implemented by {self.scheduler}. " + f"Valid selections: {sorted(valid_backfilltypes)}") + return self @property -- GitLab