From b07fbc279d70fcfd5a1eec8a73bc2d5841d961b2 Mon Sep 17 00:00:00 2001 From: rkansal47 Date: Tue, 23 Apr 2024 16:56:48 -0500 Subject: [PATCH] git user arg --- src/HHbbVV/postprocessing/PostProcess.ipynb | 2 +- src/HHbbVV/run_utils.py | 4 ++-- src/condor/submit.py | 6 +++++- src/condor/submit.templ.sh | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/HHbbVV/postprocessing/PostProcess.ipynb b/src/HHbbVV/postprocessing/PostProcess.ipynb index 426612d7..fd72a2a4 100644 --- a/src/HHbbVV/postprocessing/PostProcess.ipynb +++ b/src/HHbbVV/postprocessing/PostProcess.ipynb @@ -9,7 +9,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ diff --git a/src/HHbbVV/run_utils.py b/src/HHbbVV/run_utils.py index 913f4765..755e8961 100644 --- a/src/HHbbVV/run_utils.py +++ b/src/HHbbVV/run_utils.py @@ -55,11 +55,11 @@ def add_mixins(nanoevents): nanoevents.PFNanoAODSchema.mixins["SV"] = "PFCand" -def check_branch(git_branch: str, allow_diff_local_repo: bool = False): +def check_branch(git_branch: str, git_user: str, allow_diff_local_repo: bool = False): """Check that specified git branch exists in the repo, and local repo is up-to-date""" assert not bool( os.system( - f'git ls-remote --exit-code --heads "https://github.com/rkansal47/HHbbVV" "{git_branch}"' + f'git ls-remote --exit-code --heads "https://github.com/{git_user}/HHbbVV" "{git_branch}"' ) ), f"Branch {git_branch} does not exist" diff --git a/src/condor/submit.py b/src/condor/submit.py index 18b26c65..5eda9b87 100755 --- a/src/condor/submit.py +++ b/src/condor/submit.py @@ -38,7 +38,7 @@ def get_site_vars(site): def main(args): - run_utils.check_branch(args.git_branch, args.allow_diff_local_repo) + run_utils.check_branch(args.git_branch, args.git_user, args.allow_diff_local_repo) username, t2_local_prefix, t2_prefix, proxy = get_site_vars(args.site) homedir = Path(f"store/user/{username}/bbVV/{args.processor}/") @@ -87,6 +87,7 @@ def main(args): localsh = f"{local_dir}/{prefix}_{j}.sh" sh_args = { "branch": args.git_branch, + "gituser": args.git_user, "script": args.script, "year": args.year, "starti": j * args.files_per_job, @@ -128,6 +129,9 @@ def main(args): def parse_args(parser): parser.add_argument("--git-branch", required=True, help="git branch to use", type=str) + parser.add_argument( + "--git-user", default="rkansal47", help="which user's repo to use", type=str + ) parser.add_argument("--script", default="src/run.py", help="script to run", type=str) parser.add_argument("--outdir", default="outfiles", help="directory for output files", type=str) parser.add_argument( diff --git a/src/condor/submit.templ.sh b/src/condor/submit.templ.sh index 27c1102c..78a99bbf 100644 --- a/src/condor/submit.templ.sh +++ b/src/condor/submit.templ.sh @@ -12,7 +12,7 @@ mkdir outfiles ( r=3 # shallow clone of single branch (keep repo size as small as possible) - while ! git clone --single-branch --branch $branch --depth=1 https://github.com/rkansal47/HHbbVV/ + while ! git clone --single-branch --branch $branch --depth=1 https://github.com/$gituser/HHbbVV/ do ((--r)) || exit sleep 60 @@ -21,7 +21,7 @@ mkdir outfiles cd HHbbVV || exit commithash=$$(git rev-parse HEAD) -echo "https://github.com/rkansal47/HHbbVV/commit/$${commithash}" > commithash.txt +echo "https://github.com/$gituser/HHbbVV/commit/$${commithash}" > commithash.txt xrdcp -f commithash.txt $eosoutgithash pip install -e .