Back to home page

EIC code displayed by LXR

 
 

    


Warning, /swf-monitor/docs/PCS.md is written in an unsupported language. File is not indexed.

0001 # PCS — Physics Configuration System
0002 
0003 PCS manages the configuration of production tasks based on physics inputs for ePIC simulation campaigns at the Electron Ion Collider. It provides a central place to define, browse, reuse, and compose the configurations that drive Monte Carlo production and subsequent reconstruction.
0004 
0005 **URL:** `/swf-monitor/pcs/`
0006 
0007 ## What It Does
0008 
0009 Production configuration is organized as **tags** — named parameter sets that capture the settings for each stage of the simulation pipeline:
0010 
0011 | Tag Type | Prefix | What It Captures | Example |
0012 |----------|--------|-----------------|---------|
0013 | **Physics** | p | Process, beam energies, species, Q2 range | p1001 — DIS NC 10x100 ep minQ2=1 |
0014 | **EvGen** | e | Generator name and version, backgrounds | e1 — pythia8 8.310 |
0015 | **Simulation** | s | Detector sim version, background config | s1 — npsim 26.02.0 |
0016 | **Reconstruction** | r | Reco version, calibration, alignment | r1 — eicrecon 26.02.0 |
0017 
0018 Physics tags are grouped by **category** (DIS, DVCS, SIDIS, EXCLUSIVE), reflected in their numbering: DIS tags are p1xxx, DVCS are p2xxx, etc.
0019 
0020 The system is seeded with configurations from the [26.02.0 production campaign](https://eic.github.io/epic-prod/FULL/26.02.0/) — 47 physics tags, 15 evgen tags, 1 simu tag, and 1 reco tag.
0021 
0022 ## Tag Lifecycle
0023 
0024 ```
0025 draft  ──►  locked
0026 ```
0027 
0028 - **Draft** — editable. You can modify parameters, copy from other tags, or delete.
0029 - **Locked** — immutable. One-way transition. Ensures reproducibility: once a tag is used in production, its meaning never changes.
0030 
0031 Only the tag creator can edit, lock, or delete their own drafts. Anyone can copy any tag to create their own variant.
0032 
0033 ## Using the Tag Panel
0034 
0035 The main interface is the **panel view** — a split-pane layout with a tag browser on the left and detail/edit panel on the right. Access it from the PCS dropdown in the nav bar (Physics Tags, EvGen Tags, Simu Tags, Reco Tags).
0036 
0037 ### Browsing
0038 
0039 - **Arrow keys** navigate the tag list (keyboard focus is on the list at page load)
0040 - **Search box** filters by any text in tag name, description, category, or parameter values
0041 - **Status pills** filter by draft/locked
0042 - **Creator pills** filter by who created the tag (appears when multiple creators exist)
0043 - **Parameter dropdowns** filter by distinct values of each parameter (e.g. filter physics tags to only `beam_species=eAu`)
0044 - **Clear** button appears when any filter is active; resets everything
0045 
0046 ### Viewing
0047 
0048 Click any tag to see its full detail on the right: description, creator, and all parameters.
0049 
0050 ### Creating
0051 
0052 Click **New Tag** to enter create mode. The form shows required fields (marked with *) and optional fields. For fields with known values, a dropdown offers choices; select "Other..." to enter a free value.
0053 
0054 While creating, click any existing tag in the list — its values fill in as suggestions (grey italic). Fields you've already edited show a yellow suggestion bar instead of overwriting, so you can compose a new tag from pieces of existing ones.
0055 
0056 The title shows the predicted next tag number (e.g. "New Tag p1020"). The actual number is assigned on save.
0057 
0058 ### Editing
0059 
0060 Your own draft tags show an **Edit** button. Editing works in the same panel — no separate page. Changed fields appear in dark green. The Save button stays disabled until you actually change something, and re-disables if you revert all changes.
0061 
0062 While editing, click other tags to see suggestion bars for differing values. Click "Apply" to adopt a suggested value.
0063 
0064 ### Copying
0065 
0066 Any tag (yours or others') has a **Copy** button. This fills the create form with all values from the source tag, sets you as creator, and lets you modify before saving. Useful for creating variants of existing configurations.
0067 
0068 ### Locking and Deleting
0069 
0070 Your own drafts show **Lock** and **Delete** buttons. Locking is permanent — confirm carefully. Deletion removes the tag.
0071 
0072 ## Tag Numbering
0073 
0074 Tag numbers are auto-assigned. You never pick a number manually.
0075 
0076 - **Physics tags**: `category digit * 1000 + global suffix`. The suffix increments globally across all categories, so numbers within a category may have gaps (e.g. p2001, p2005, p2020). This is expected.
0077 - **EvGen/Simu/Reco tags**: Simple sequential increment (e1, e2, ... / s1, s2, ... / r1, r2, ...).
0078 
0079 All counters are managed atomically via PersistentState to prevent conflicts.
0080 
0081 ## Parameter Schemas
0082 
0083 Each tag type has required and optional parameters defined in `pcs/schemas.py`. Adding a field there makes it appear in forms and validation — no database migration needed.
0084 
0085 **Physics (p):**
0086 - Required: `process`, `beam_energy_electron`, `beam_energy_hadron`
0087 - Optional: `beam_species`, `q2_range`, `decay_mode`, `hadron_charge`, `coherence`, `model`, `polarization`, `notes`
0088 
0089 **EvGen (e):**
0090 - Required: `generator`, `generator_version`
0091 - Optional: `signal_freq`, `signal_status`, `bg_tag_prefix`, `bg_files`, `notes`
0092 
0093 **Simulation (s):**
0094 - Required: `detector_sim`, `sim_version`
0095 - Optional: `background_config`, `digitization`, `notes`
0096 
0097 **Reconstruction (r):**
0098 - Required: `reco_version`, `reco_config`
0099 - Optional: `calibration_tag`, `alignment_tag`, `notes`
0100 
0101 ## REST API
0102 
0103 Base URL: `/swf-monitor/pcs/api/`
0104 
0105 Tags support list, create, get, update (draft only), and lock. Replace `{type}` with `physics-tags`, `evgen-tags`, `simu-tags`, or `reco-tags`.
0106 
0107 | Method | Endpoint | Description |
0108 |--------|----------|-------------|
0109 | GET | `/{type}/` | List tags |
0110 | POST | `/{type}/` | Create tag (number auto-assigned) |
0111 | GET | `/{type}/{number}/` | Tag detail |
0112 | PATCH | `/{type}/{number}/` | Update draft tag |
0113 | POST | `/{type}/{number}/lock/` | Lock tag (permanent) |
0114 
0115 Physics tag creation requires a `category` field (digit). Tag numbers are always auto-assigned.
0116 
0117 ### Production Tasks — submission artifacts
0118 
0119 A single read-only endpoint regenerates a task's submission artifact from current PCS state on every call (no DB writes):
0120 
0121 ```
0122 GET /swf-monitor/pcs/api/prod-tasks/command/?name=<task_name>&fmt=<format>
0123 ```
0124 
0125 | `fmt` | Content-Type | Contents |
0126 |-------|--------------|----------|
0127 | `condor` | `text/plain` | env-prefixed `submit_csv.sh` command |
0128 | `panda` | `text/plain` | `prun` command |
0129 | `jedi` | `application/json` | `taskParamMap` for `Client.insertTaskParams()` |
0130 | `dump` | `application/json` | Full view: task + dataset + all four tags + prod config + effective config |
0131 
0132 The parameter is named `fmt` because DRF reserves `format` for its own content-negotiation.
0133 
0134 ### `pcs-task-cmd` — the CLI wrapper
0135 
0136 `scripts/pcs-task-cmd` is a stdlib-only Python client over the endpoint above. It is the recommended way for production operators and automation scripts to fetch submission artifacts — no Django import, no DB credentials.
0137 
0138 ```bash
0139 pcs-task-cmd <task_name> --format {condor|panda|jedi|dump}
0140 ```
0141 
0142 Environment:
0143 
0144 | Variable | Default | Purpose |
0145 |----------|---------|---------|
0146 | `SWFMON_URL` | `https://epic-devcloud.org/prod` | swf-monitor base URL |
0147 | `SWFMON_TOKEN` | *(unset)* | Optional DRF token for non-public deployments |
0148 
0149 Examples:
0150 
0151 ```bash
0152 # Inspect everything about a task
0153 pcs-task-cmd group.EIC.26.02.0.epic_craterlake.p3001.e1.s1.r1 --format dump
0154 
0155 # Submit to JEDI (requires a valid PanDA auth context: proxy or OIDC token)
0156 pcs-task-cmd <name> --format jedi | python -c '
0157 import json, sys
0158 from pandaclient import Client
0159 print(Client.insertTaskParams(json.load(sys.stdin)))
0160 '
0161 
0162 # Inspect what would go to PanDA prun
0163 pcs-task-cmd <name> --format panda
0164 
0165 # Get the env-prefixed Condor command (pipe into bash)
0166 eval "$(pcs-task-cmd <name> --format condor)"
0167 ```
0168 
0169 ## Datasets
0170 
0171 A dataset composes four locked tags with detector version information into a standardized name:
0172 
0173 ```
0174 {scope}.{detector_version}.{detector_config}.{physics_tag}.{evgen_tag}.{simu_tag}.{reco_tag}
0175 ```
0176 
0177 Example: `group.EIC.26.02.0.epic_craterlake.p3001.e1.s1.r1`
0178 
0179 The Rucio DID includes scope prefix and block suffix: `group.EIC:...p3001.e1.s1.r1.b1`
0180 
0181 Block `.b1` is always present. Rucio limits datasets to 100k files; PCS manages automatic subdivision into blocks (`.b1`, `.b2`, etc.) as needed.
0182 
0183 The **task name** is the dataset name (without the `.bN` block suffix). This is what appears in PanDA as the task identifier.
0184 
0185 ## Production Configs
0186 
0187 A production config is a reusable template capturing everything needed to build a submit command beyond what tags and datasets define.
0188 
0189 **Dedicated fields** (DB columns):
0190 - **Background mixing**: Enable/disable, cross section, EvtGen file
0191 - **Output control**: Which output files to copy (reco, full, log), Rucio usage
0192 - **Software stack**: JUG_XL tag, container image
0193 - **Resource targets**: Target walltime per job, events per task
0194 - **Condor template**: HTCondor submission template text
0195 - **PanDA overrides**: Site, queue, working group, resource type
0196 - **Rucio overrides**: RSE, replication rules
0197 
0198 **Submission parameters** (JSON `data` field, extensible without migrations):
0199 
0200 | Key | Example | Purpose |
0201 |-----|---------|---------|
0202 | `transformation` | `runGen-00-00-02` | PanDA TRF script name/version |
0203 | `processing_type` | `epicproduction` | PanDA classification |
0204 | `prod_source_label` | `managed` | PanDA authorization (managed/test) |
0205 | `vo` | `wlcg` | Virtual organization |
0206 | `n_jobs` | `1000` | Jobs per task submission |
0207 | `events_per_job` | `100` | Events per individual job |
0208 | `events_per_file` | `1000` | Events per output file |
0209 | `files_per_job` | `1` | Output files per job |
0210 | `corecount` | `1` | Cores per job |
0211 | `no_build` | `true` | Skip PanDA build step |
0212 | `skip_scout` | `true` | Skip scout jobs |
0213 | `exec_command` | `./run.sh` | Payload command (--exec) |
0214 | `scope` | `group.EIC` | Rucio scope for submission |
0215 
0216 Production configs are always mutable — they are working templates. The PanDA task/job spec is the immutable record of what actually ran.
0217 
0218 ## JEDI Integration
0219 
0220 PCS is being extended to submit tasks directly to JEDI (PanDA's Job Execution and Definition Interface) via the PanDA Python API, replacing the current approach of generating `prun` CLI commands as text. See:
0221 
0222 - [JEDI Integration Design](JEDI_INTEGRATION.md) — architecture, field mapping, implementation plan
0223 - [JEDI ePIC Proposal](JEDI_EPIC_PROPOSAL.md) — technical proposal for PanDA team review
0224 
0225 ## MCP Tools
0226 
0227 MCP tools for AI-assisted tag browsing and lookup:
0228 
0229 | Tool | Description |
0230 |------|-------------|
0231 | `pcs_list_tags(tag_type)` | List tags with label, description, status, key params |
0232 | `pcs_get_tag(tag_label)` | Full tag detail with all parameters |
0233 | `pcs_search_tags(query, tag_type)` | Full-text search across tag labels, descriptions, and parameter values |
0234 
0235 Tag creation, lock/delete, and dataset/prod-config management go through the REST API and the web UI — see the sections above. The submission-artifact endpoint (`/prod-tasks/command/`) plus the `pcs-task-cmd` CLI are the programmatic path for production operators.