Skip to content

Commit

Permalink
Patch user parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Jun 10, 2024
1 parent 5f96d66 commit 6da689a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Lint and test](https://github.com/uhh-cms/hh2bbtautau/actions/workflows/lint_and_test.yaml/badge.svg)](https://github.com/uhh-cms/hh2bbtautau/actions/workflows/lint_and_test.yaml)
[![License](https://img.shields.io/github/license/uhh-cms/hh2bbtautau.svg)](https://github.com/uhh-cms/hh2bbtautau/blob/master/LICENSE)


### Quickstart

A couple test tasks are listed below.
Expand Down Expand Up @@ -44,6 +43,12 @@ law run cf.CreateDatacards \
--workers 3
```

### Useful links

- [columnflow documentation](https://columnflow.readthedocs.io/en/latest/index.html)
- [Nano documentation](https://gitlab.cern.ch/cms-nanoAOD/nanoaod-doc)
- [Correctionlib files](https://gitlab.cern.ch/cms-nanoAOD/jsonpog-integration)
- [HLT info browser](https://cmshltinfo.app.cern.ch/path/HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v)

### Development

Expand Down
29 changes: 28 additions & 1 deletion hbt/columnflow_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,34 @@ def htcondor_job_resources(self, job_num, branches):
logger.debug(f"patched htcondor_job_resources of {HTCondorWorkflow.task_family}")


@memoize
def patch_user_parameters():
"""
Adds user parameters to some tasks.
"""
from hbt.tasks.parameters import user_parameter_inst
from columnflow.tasks.framework.remote import (
BundleRepo,
BundleSoftware,
BuildBashSandbox,
BundleBashSandbox,
BundleCMSSWSandbox,
)

for cls in [
BundleRepo,
BundleSoftware,
BuildBashSandbox,
BundleBashSandbox,
BundleCMSSWSandbox,
]:
cls.user_parameter = user_parameter_inst

logger.debug("patched user parameters")


@memoize
def patch_all():
patch_bundle_repo_exclude_files()
patch_htcondor_workflow_naf_resources
patch_htcondor_workflow_naf_resources()
patch_user_parameters()
8 changes: 8 additions & 0 deletions hbt/tasks/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Custom, common parameters.
"""

import getpass

import luigi


Expand All @@ -15,3 +17,9 @@
default=False,
description="escape some characters for markdown; default: False",
)
user_parameter_inst = luigi.Parameter(
default=getpass.getuser(),
description="the user running the current task, mainly for central schedulers to distinguish "
"between tasks that should or should not be run in parallel by multiple users; "
"default: current user",
)

0 comments on commit 6da689a

Please sign in to comment.