Skip to content

Commit ce3e5da

Browse files
committed
enable usage of uhh campaigns
1 parent 64c45b9 commit ce3e5da

File tree

4 files changed

+81
-2
lines changed

4 files changed

+81
-2
lines changed

hbw/config/datasets.py

+43
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ def configure_hbw_datasets(
397397
limit_dataset_files: int | None = None,
398398
add_dataset_extensions: bool = False,
399399
):
400+
# allow usage of UHH campaign
401+
enable_uhh_campaign_usage(config)
402+
400403
for dataset in config.datasets:
401404
if add_dataset_extensions:
402405
add_dataset_extension_to_nominal(dataset)
@@ -541,3 +544,43 @@ def get_dataset_lfns_2017(
541544
lfn_base.child(basename, type="f").path
542545
for basename in lfn_base.listdir(pattern="*.root")
543546
]
547+
548+
549+
def enable_uhh_campaign_usage(cfg: od.Config) -> None:
550+
# custom lfn retrieval method in case the underlying campaign is custom uhh
551+
def get_dataset_lfns_uhh(
552+
dataset_inst: od.Dataset,
553+
shift_inst: od.Shift,
554+
dataset_key: str,
555+
) -> list[str]:
556+
if "uhh" not in dataset_inst.x("campaign", ""):
557+
# for non-uhh datasets, use default GetDatasetLFNs method
558+
return GetDatasetLFNs.get_dataset_lfns_dasgoclient(
559+
GetDatasetLFNs, dataset_inst=dataset_inst, shift_inst=shift_inst, dataset_key=dataset_key,
560+
)
561+
cpn_name = dataset_inst.x.campaign
562+
# destructure dataset_key into parts and create the lfn base directory
563+
dataset_id, full_campaign, tier = dataset_key.split("/")[1:]
564+
main_campaign, sub_campaign = full_campaign.split("-", 1)
565+
lfn_base = law.wlcg.WLCGDirectoryTarget(
566+
f"/store/{dataset_inst.data_source}/{main_campaign}/{dataset_id}/{tier}/{sub_campaign}/0",
567+
# fs=f"wlcg_fs_{cfg.campaign.x.custom['name']}",
568+
fs=f"wlcg_fs_{cpn_name}",
569+
)
570+
571+
# loop though files and interpret paths as lfns
572+
return [
573+
lfn_base.child(basename, type="f").path
574+
for basename in lfn_base.listdir(pattern="*.root")
575+
]
576+
577+
if any("uhh" in cpn_name for cpn_name in cfg.campaign.x("campaigns", [])):
578+
# define the lfn retrieval function
579+
cfg.x.get_dataset_lfns = get_dataset_lfns_uhh
580+
581+
# define custom remote fs's to look at
582+
cfg.x.get_dataset_lfns_remote_fs = lambda dataset_inst: (
583+
None if "uhh" not in dataset_inst.x("campaign", "") else [
584+
f"local_fs_{dataset_inst.x.campaign}",
585+
f"wlcg_fs_{dataset_inst.x.campaign}",
586+
])

hbw/config/styling.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"dy_m50toinf": color_palette["yellow"],
8383
"dy_m10to50": color_palette["brown"],
8484
"dy_m4to10": color_palette["darkgrey"],
85-
"ttV": color_palette["brown"],
85+
"ttv": color_palette["brown"],
8686
"vv": color_palette["blue"],
8787
"other": color_palette["grey"],
8888
"hh_ggf_hbb_htt": color_palette["grey"],

hbw/tasks/campaigns.py

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ def get_custom_campaign(self):
137137
dataset_inst.x.campaign = campaign_inst.name
138138
hbw_campaign_inst.add_dataset(dataset_inst)
139139

140+
hbw_campaign_inst.x.campaigns = list(self.campaigns)
141+
140142
return hbw_campaign_inst
141143

142144
from hbw.util import timeit_multiple

law.cfg

+35-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ check_overlapping_inputs: None
7373
[outputs]
7474

7575
# list of all used file systems
76-
wlcg_file_systems: wlcg_fs, wlcg_fs_desy, wlcg_fs_cernbox, wlcg_fs_desy_store, wlcg_fs_infn_redirector, wlcg_fs_global_redirector
76+
wlcg_file_systems: wlcg_fs, wlcg_fs_desy, wlcg_fs_cernbox, wlcg_fs_desy_store, wlcg_fs_infn_redirector, wlcg_fs_global_redirector, wlcg_fs_run3_2022_preEE_nano_uhh_v12, wlcg_fs_run3_2022_postEE_nano_uhh_v12
7777

7878
# list of file systems used by columnflow.tasks.external.GetDatasetLFNs.iter_nano_files to
7979
# look for the correct fs per nano input file (in that order)
@@ -259,6 +259,40 @@ gsiftp_base: gsiftp://dcache-door-cms04.desy.de:2811/pnfs/desy.de/cms/tier2/stor
259259
base: &::gsiftp_base
260260

261261

262+
[wlcg_fs_run3_2022_preEE_nano_uhh_v12]
263+
264+
webdav_base: davs://dcache-cms-webdav-wan.desy.de:2880/pnfs/desy.de/cms/tier2/store/user/nprouvos/nanogen_store/MergeNano/config_22pre_v12/prod3
265+
gsiftp_base: gsiftp://dcache-door-cms04.desy.de:2811/pnfs/desy.de/cms/tier2/store/user/nprouvos/nanogen_store/MergeNano/config_22pre_v12/prod3
266+
xrootd_base: root://dcache-cms-xrootd.desy.de:1094/pnfs/desy.de/cms/tier2/store/user/nprouvos/nanogen_store/MergeNano/config_22pre_v12/prod3
267+
base: &::xrootd_base
268+
use_cache: $CF_WLCG_USE_CACHE
269+
cache_root: $CF_WLCG_CACHE_ROOT
270+
cache_cleanup: $CF_WLCG_CACHE_CLEANUP
271+
cache_max_size: 15GB
272+
cache_global_lock: True
273+
274+
[local_fs_run3_2022_preEE_nano_uhh_v12]
275+
276+
base: file:///pnfs/desy.de/cms/tier2/store/user/nprouvos/nanogen_store/MergeNano/config_22pre_v12/prod3
277+
278+
279+
[wlcg_fs_run3_2022_postEE_nano_uhh_v12]
280+
281+
webdav_base: davs://dcache-cms-webdav-wan.desy.de:2880/pnfs/desy.de/cms/tier2/store/user/aalvesan/nanogen_store/MergeNano/config_22post_v12/prod1
282+
gsiftp_base: gsiftp://dcache-door-cms04.desy.de:2811/pnfs/desy.de/cms/tier2/store/user/aalvesan/nanogen_store/MergeNano/config_22post_v12/prod1
283+
xrootd_base: root://dcache-cms-xrootd.desy.de:1094/pnfs/desy.de/cms/tier2/store/user/aalvesan/nanogen_store/MergeNano/config_22post_v12/prod1
284+
base: &::xrootd_base
285+
use_cache: $CF_WLCG_USE_CACHE
286+
cache_root: $CF_WLCG_CACHE_ROOT
287+
cache_cleanup: $CF_WLCG_CACHE_CLEANUP
288+
cache_max_size: 15GB
289+
cache_global_lock: True
290+
291+
[local_fs_run3_2022_postEE_nano_uhh_v12]
292+
293+
base: file:///pnfs/desy.de/cms/tier2/store/user/aalvesan/nanogen_store/MergeNano/config_22post_v12/prod1
294+
295+
262296

263297
[luigi_resources]
264298

0 commit comments

Comments
 (0)