Skip to content

Commit f77826c

Browse files
authored
Prepare the groundwork for testing cases (#336)
This is to prevent CI from failing when modifying the benchmarks to test #334
1 parent 32d2521 commit f77826c

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

utils/run_benchmarks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ def run_benchmark(
215215
args += ["--include_dummy_imports"]
216216
if "regions" in benchmark:
217217
args.extend(["--regions", benchmark["regions"]])
218+
if "case" in benchmark:
219+
args.extend(["--case", benchmark["case"]])
218220
if verbose:
219221
args.append("--verbose")
220222
if "inputs" in benchmark:

xl2times/datatypes.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ class TimesModel:
263263
custom_psets: DataFrame = field(default_factory=DataFrame)
264264
user_psets: DataFrame = field(default_factory=DataFrame)
265265
user_csets: DataFrame = field(default_factory=DataFrame)
266+
cases: dict[str, str] = field(default_factory=dict)
266267

267268
@property
268269
def external_regions(self) -> set[str]:
@@ -361,6 +362,8 @@ class Config:
361362
ie_override_in_syssettings: bool = False
362363
# Switch to include dummy imports in the model
363364
include_dummy_imports: bool
365+
# Name of the case to produce dd files for
366+
produce_case: str | None
364367

365368
def __init__(
366369
self,
@@ -371,6 +374,7 @@ def __init__(
371374
veda_attr_defaults_file: str,
372375
regions: str,
373376
include_dummy_imports: bool,
377+
case: str | None,
374378
):
375379
self.times_xl_maps = Config._read_mappings(mapping_file)
376380
(
@@ -403,6 +407,7 @@ def __init__(
403407
self.times_xl_maps = list(name_to_map.values())
404408
self.filter_regions = Config._read_regions_filter(regions)
405409
self.include_dummy_imports = include_dummy_imports
410+
self.produce_case = case
406411

407412
@staticmethod
408413
def _read_times_sets(

xl2times/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def read_xl(
7575
inputs: list[str],
7676
regions: str,
7777
include_dummy_imports: bool,
78+
case: str | None = None,
7879
output_dir: str | None = None,
7980
no_cache: bool = False,
8081
stop_after_read: bool = False,
@@ -90,6 +91,7 @@ def read_xl(
9091
"veda-attr-defaults.json",
9192
regions,
9293
include_dummy_imports,
94+
case,
9395
)
9496

9597
if len(inputs) == 1:
@@ -573,6 +575,7 @@ def run(args: argparse.Namespace) -> str | None:
573575
args.input,
574576
args.regions,
575577
args.include_dummy_imports,
578+
case=args.case,
576579
output_dir=args.output_dir,
577580
no_cache=args.no_cache,
578581
stop_after_read=True,
@@ -583,6 +586,7 @@ def run(args: argparse.Namespace) -> str | None:
583586
args.input,
584587
args.regions,
585588
args.include_dummy_imports,
589+
case=args.case,
586590
output_dir=args.output_dir,
587591
no_cache=args.no_cache,
588592
)
@@ -633,6 +637,11 @@ def parse_args(arg_list: None | list[str]) -> argparse.Namespace:
633637
action="store_true",
634638
help="Include dummy import processes in the model",
635639
)
640+
args_parser.add_argument(
641+
"--case",
642+
type=str,
643+
help="Case name to produce dd files for. If not provided, all the input files are used",
644+
)
636645
args_parser.add_argument(
637646
"--output_dir", type=str, default="output", help="Output directory"
638647
)

0 commit comments

Comments
 (0)