diff --git a/Snakefile b/Snakefile index 8cdca119..6e4bc637 100644 --- a/Snakefile +++ b/Snakefile @@ -1,3 +1,22 @@ +configfile: "config.yaml" + +if config["remote"] == "S3": + from snakemake.remote.S3 import RemoteProvider as S3RemoteProvider + provider = S3RemoteProvider( + endpoint_url="https://eics3.sdcc.bnl.gov:9000", + access_key_id=os.environ["S3_ACCESS_KEY"], + secret_access_key=os.environ["S3_SECRET_KEY"], + ) + remote_path = lambda path: f"eictest/{path}" +elif config["remote"] == "XRootD": + from snakemake.remote.XRootD import RemoteProvider as XRootDRemoteProvider + provider = XRootDRemoteProvider( + stay_on_remote=False, + ) + remote_path = lambda path: f"root://dtn-eic.jlab.org//work/eic2/{path}" +else: + raise ValueError(f"Unexpected config[\"remote\"] = {config['remote']}") + include: "benchmarks/backgrounds/Snakefile" include: "benchmarks/barrel_ecal/Snakefile" diff --git a/benchmarks/backgrounds/Snakefile b/benchmarks/backgrounds/Snakefile index 7f34ae66..3e3b1c66 100644 --- a/benchmarks/backgrounds/Snakefile +++ b/benchmarks/backgrounds/Snakefile @@ -1,19 +1,10 @@ import os import shutil -from snakemake.remote.S3 import RemoteProvider as S3RemoteProvider - - -S3 = S3RemoteProvider( - endpoint_url="https://eics3.sdcc.bnl.gov:9000", - access_key_id=os.environ["S3_ACCESS_KEY"], - secret_access_key=os.environ["S3_SECRET_KEY"], -) - rule backgrounds_get_beam_gas_electron: input: - S3.remote("eictest/EPIC/EVGEN/BACKGROUNDS/BEAMGAS/electron/beam_gas_ep_10GeV_foam_emin10keV_10Mevt_vtx.hepmc"), + provider.remote(remote_path("EPIC/EVGEN/BACKGROUNDS/BEAMGAS/electron/beam_gas_ep_10GeV_foam_emin10keV_10Mevt_vtx.hepmc")), output: "input/backgrounds/beam_gas_electron.hepmc", run: @@ -22,7 +13,7 @@ rule backgrounds_get_beam_gas_electron: rule backgrounds_get_beam_gas_proton: input: - S3.remote("eictest/EPIC/EVGEN/BACKGROUNDS/BEAMGAS/proton/ProtonBeamGasEvents/100GeV/100GeV_1.hepmc"), + provider.remote(remote_path("EPIC/EVGEN/BACKGROUNDS/BEAMGAS/proton/ProtonBeamGasEvents/100GeV/100GeV_1.hepmc")), output: "input/backgrounds/beam_gas_proton.hepmc", run: @@ -31,7 +22,7 @@ rule backgrounds_get_beam_gas_proton: rule backgrounds_get_DIS: input: - S3.remote("eictest/EPIC/EVGEN/DIS/NC/{BEAM}/minQ2={MINQ2}/pythia8NCDIS_{BEAM}_minQ2={MINQ2}_{SUFFIX}.hepmc"), + provider.remote(remote_path("EPIC/EVGEN/DIS/NC/{BEAM}/minQ2={MINQ2}/pythia8NCDIS_{BEAM}_minQ2={MINQ2}_{SUFFIX}.hepmc")), wildcard_constraints: BEAM="\d+x\d+", MINQ2="\d+", diff --git a/config.yaml b/config.yaml new file mode 100644 index 00000000..14f6faad --- /dev/null +++ b/config.yaml @@ -0,0 +1 @@ +remote: XRootD