From bb6228280b30a93d267367d48c2d8edbda055c6d Mon Sep 17 00:00:00 2001
From: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Date: Fri, 5 Jul 2024 18:31:29 -0400
Subject: [PATCH] drop use of Snakemake 7.x-specific remote functionality (#30)

---
 Snakefile                      | 27 ++++++++-------------------
 benchmarks/ecal_gaps/Snakefile |  2 +-
 config.yaml                    |  1 -
 3 files changed, 9 insertions(+), 21 deletions(-)
 delete mode 100644 config.yaml

diff --git a/Snakefile b/Snakefile
index a543b210..1ee7abdb 100644
--- a/Snakefile
+++ b/Snakefile
@@ -1,28 +1,17 @@
-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"
 include: "benchmarks/ecal_gaps/Snakefile"
 include: "benchmarks/material_scan/Snakefile"
 
 
+rule fetch_epic:
+    output:
+        filepath="EPIC/{PATH}"
+    shell: """
+xrdcp root://dtn-eic.jlab.org//work/eic2/{output.filepath} {output.filepath}
+"""
+
+
 rule warmup_run:
     output:
         "warmup/{DETECTOR_CONFIG}.edm4hep.root",
diff --git a/benchmarks/ecal_gaps/Snakefile b/benchmarks/ecal_gaps/Snakefile
index b649f15d..a90f6900 100644
--- a/benchmarks/ecal_gaps/Snakefile
+++ b/benchmarks/ecal_gaps/Snakefile
@@ -3,7 +3,7 @@ import os
 
 rule ecal_gaps_sim:
     input:
-        steering_file=provider.remote(remote_path("EPIC/EVGEN/SINGLE/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.steer")),
+        steering_file="EPIC/EVGEN/SINGLE/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.steer",
         warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
     output:
         "sim_output/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.{INDEX}.edm4hep.root",
diff --git a/config.yaml b/config.yaml
deleted file mode 100644
index 75d4ff68..00000000
--- a/config.yaml
+++ /dev/null
@@ -1 +0,0 @@
-remote: S3
-- 
GitLab