Add CRAB workflow support for remote LAW tasks - #299
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a first-class CRAB (WLCG) backend for FLAF's LAW tasks, alongside the existing HTCondor backend, so the full analysis chain can run anywhere on the CMS grid using the same FLAF remote-I/O model (fs_default/gfal + stageout_logs.sh) rather than CRAB's own stageout. It refactors the shared HTCondor bundle/render logic into reusable helpers, introduces a CrabWorkflow mixin, and hardens the bootstrap/CMSSW relocation for AFS-less workers.
Changes:
- Add
CrabWorkflow,FLAFCrabJobFileFactory, and a MyProxy-gating workflow proxy inrun_tools/law_customizations.py; mixCrabWorkflowinto the AnaTuple/Analysis tasks; extract shared bundle/bootstrap/render helpers. - Bootstrap/CMSSW hardening (
bootstrap.sh,RunKit/includeCMSSWlibs.py,Common/Setup.py): safe ProjectRename, forceCMSSW_BASE=FLAF_CMSSW_BASE, materialize external symlinks in the cmssw bundle, resolve stageduser_custompaths, honor top-levelvariables:, and setRUCIO_ACCOUNTfrom the submitter. - CRAB-aware log naming (
stageout_logs.sh),HistProducerFromNTupleImplicitMT/materialization fix, a grid-access probe in the hello-world test task, and new/updated docs.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
run_tools/law_customizations.py |
Core CrabWorkflow integration + refactor of bundle/bootstrap/render helpers |
bootstrap.sh |
Relocate CMSSW safely on workers, force CMSSW_BASE, set RUCIO_ACCOUNT |
RunKit/includeCMSSWlibs.py |
Prefer FLAF_CMSSW_BASE over CMSSW_BASE with existence check |
run_tools/stageout_logs.sh |
Distinct remote log name per CRAB job number |
Common/Setup.py |
resolve_user_custom_path, top-level variables: handling, force CMSSW_BASE |
Analysis/HistProducerFromNTuple.py |
Materialize RDF hists via GetValue(); disable ImplicitMT |
Analysis/tasks.py |
Add CrabWorkflow mixin, crab_output_directory, pass --user-custom |
AnaProd/tasks.py |
Add CrabWorkflow mixin to AnaTuple tasks |
Analysis/AnalysisCacheProducer.py |
Add help text to --user-custom |
test/hello_world_task.py |
Grid/X509/Rucio access probe for CRAB validation |
mkdocs.yml, docs/workflow/*.md, docs/configuration/user-custom.md |
Documentation for CRAB and variables: |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
pipeline#15527414 started |
|
pipeline#15527835 started |
|
pipeline#15527835 failed |
|
GitHub Actions integration workflow dispatched for HH_bbWW, HH_bbtautau, H_mumu |
|
❌ GitHub Actions integration pipeline failed. |
|
pipeline#15528712 started |
|
pipeline#15528712 failed |
b808c67 to
5a4345a
Compare
|
pipeline#15536685 started |
|
pipeline#15536685 passed |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Common/Setup.py:443
- The comment states that when the active flavor's variable list is empty, the top-level
variables:list is used as the active "plot/full-res set". However, theelsebranch below only reassignsself.histTuple_plot_vars = list(user_vars);self.histTuple_fullres_varsis left as the (empty) flavor value and is never populated fromuser_vars. SincehistTuple_fullres_varsis consumed downstream (e.g.Analysis/HistTupleProducer.py:86asfullres_variables), this branch will produce no full-resolution variables despite the comment. Either update the comment to say only the plot set is driven byuser_vars, or also assignhistTuple_fullres_varsif full-resolution histograms are intended here.
# - When the flavor list is empty (e.g. H_mumu default): use the list as the
# active plot/full-res set so user_custom alone can drive a short CI chain
# without requiring histTuple_flavor: CI.
|
pipeline#15538117 started |
|
pipeline#15538117 passed |
|
pipeline#15539896 started |
|
pipeline#15539896 passed |
|
Verified on lxplus that the ci-like workflow via crab works for all analyses |
Summary
Adds a first-class CRAB backend for FLAF LAW tasks (via
law.contrib.cms.CrabWorkflow), so the full analysis chain (AnaTuple → HistTuple → histograms → plots) can run on CRAB with the same remote I/O (fs_*) model as HTCondor+bundles.Analysis products are not staged out through CRAB storage; workers write/read via FLAF remote filesystems. File-list / merge-plan tasks remain local by design.
Key changes
run_tools/law_customizations.py(submit, MyProxy gate, user_custom staging, log URLs)AnaTuple*/ Analysis tasks inheritCrabWorkflowwhere HTCondor already appliesCMSSW_BASE=FLAF_CMSSW_BASE; materialize absolute AFS/CVMFS symlinks in the cmssw bundleRUCIO_ACCOUNTon pilots (not the pilotUSER)variables:when the activehistTuple_flavorlist is emptyfs_default; site lists fromglobal.yamlcrab:; memory2 GB * n_cpusdocs/workflow/crab.md+ updates for arguments / user_customTesting
Full crab CI (
run_ci_test.sh … crab, TestModel,--test 1000, Run3_2022EE) PASS for:MyProxy: CRAB hash credential (
crab createmyproxy/ workspacesetup_crab_myproxy.sh), ≥5 days remaining.Companion PRs
Merge this FLAF PR first, then analysis PRs (and a follow-up submodule advance if desired).
Notes / known non-blockers
--branches 0(wall-time cost only)