Skip to content

Commit

Permalink
Merge pull request #61 from rkansal47/gituser-arg
Browse files Browse the repository at this point in the history
git user arg
  • Loading branch information
rkansal47 authored Apr 23, 2024
2 parents bdcc8c6 + b07fbc2 commit 4946784
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/HHbbVV/postprocessing/PostProcess.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand Down
4 changes: 2 additions & 2 deletions src/HHbbVV/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 5 additions & 1 deletion src/condor/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}/")
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/condor/submit.templ.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 .
Expand Down

0 comments on commit 4946784

Please sign in to comment.