-
Notifications
You must be signed in to change notification settings - Fork 58
Add documentation on transmogrifier #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cserf
wants to merge
2
commits into
rucio:main
Choose a base branch
from
cserf:transmogrifier
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also link this document to the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# Rucio Transmogrifier Daemon | ||
|
||
## Purpose | ||
|
||
The **transmogrifier daemon** in Rucio is responsible for automatically creating and managing **replication rules** for new DIDs (Data Identifiers) according to user-defined **subscriptions**. This automation ensures that new data is distributed across storage endpoints as soon as it appears, following the policies and patterns defined by users. | ||
|
||
--- | ||
|
||
## How It Works | ||
|
||
### Step-by-Step Behaviour | ||
|
||
1. **Initialization** | ||
- The daemon starts, sets up logging, threads, and heartbeats. | ||
- It checks the database schema for compatibility. | ||
|
||
2. **Loading Subscriptions** | ||
- Active subscriptions are loaded and validated. | ||
- Subscriptions contain filters (which data to match) and replication rules (where and how much to replicate). | ||
|
||
3. **Fetching New DIDs** | ||
- The daemon queries for new DIDs (datasets or containers) that have not yet been processed. | ||
|
||
4. **Matching DIDs Against Subscriptions** | ||
- For each new DID, it fetches metadata and checks against all subscription filters. | ||
- Each filter can include scope, name patterns, account, DID type, file size limits, and more. | ||
|
||
5. **Processing Matching Subscriptions** | ||
- For each matching subscription and DID: | ||
- Parses the subscription’s replication rules. | ||
- Prepares rule parameters (number of copies, RSE expressions, activity, etc.). | ||
- Handles **split** and **chained** logic for advanced placement scenarios. | ||
|
||
6. **Selecting RSEs (Storage Endpoints)** | ||
- Depending on rule logic: | ||
- **Direct:** Uses the RSEs specified in the rule. | ||
- **Split/Chained:** Calls algorithms to dynamically select RSEs based on previous rule placements or specific logic. | ||
|
||
7. **Rule Creation** | ||
- Attempts to create the required replication rules for each selected RSE. | ||
- Handles errors, blocklisted RSEs, and retry logic. | ||
|
||
8. **Marking & Updating** | ||
- Successfully processed DIDs are marked to avoid reprocessing. | ||
- Updates the subscription’s metadata (e.g., `last_processed` timestamp). | ||
|
||
9. **Metrics and Logging** | ||
- The daemon records metrics on processing counts, errors, durations, and more for monitoring. | ||
|
||
10. **Loop or Exit** | ||
- If running in continuous mode, the daemon sleeps and repeats. | ||
- If running in one-shot mode, it exits. | ||
|
||
--- | ||
|
||
## Algorithms for Chained Rules | ||
|
||
Chained subscriptions enable advanced, context-aware data placement strategies. The `algorithm` parameter determines how the next RSE(s) are selected based on previous rules. | ||
|
||
| Algorithm | Description | Typical Use Case | | ||
|-------------------|------------------------------------------------------------------|----------------------------------------------------| | ||
| `associated_site` | Select an associated RSE/site from a previous rule's site using the `ASSOCIATED_SITES` attribute. The `associated_site_idx` parameter determines which associated site to use. | Chaining copies across logically linked sites (e.g., for redundancy or workflow steps). | | ||
| `exclude_site` | Select an RSE that is **not** the site used by the parent rule (using the `site` attribute to exclude). | Ensuring that different copies are placed at physically separate sites. | | ||
|
||
- Both algorithms are only valid for rules with split logic and a single copy. | ||
- Errors are raised if required parameters are missing or misconfigured. | ||
|
||
--- | ||
|
||
## Flowchart: Transmogrifier Behaviour | ||
|
||
```mermaid | ||
flowchart TD | ||
A["Start transmogrifier daemon"] --> B["Initialize threads & heartbeat"] | ||
B --> C["Load active subscriptions"] | ||
C --> D1["Fetch new DIDs"] | ||
D1 --> E1{"For each new DID"} & W1{"No more new DIDs"} | ||
E1 --> F1["Fetch metadata for DID"] | ||
F1 --> G1{"For each subscription"} | ||
G1 --> H1{"Does DID match subscription filter?"} & U1{"All subscriptions checked"} | ||
H1 -- No --> G1 | ||
H1 -- Yes --> I1["Parse subscription rules"] | ||
I1 --> J1{"For each rule in subscription"} | ||
J1 --> K1["Prepare rule parameters<br> : RSE expression, copies, etc."] & T1{"All rules done for this subscription"} | ||
K1 --> L1{"Is rule split/chained?"} | ||
L1 -- Yes --> M1["Select RSEs using split/chained logic"] | ||
L1 -- No --> N1["Use RSEs from rule directly"] | ||
M1 --> O1["For each selected RSE"] | ||
N1 --> O1 | ||
O1 --> P1{"Is RSE blocklisted and rule wildcarded?"} | ||
P1 -- Yes --> Q1["Check ignore_availability<br>Skip or create rule"] | ||
P1 -- No --> R1["Create replication rule for DID"] | ||
Q1 --> R1 | ||
R1 --> S1["Record created rule and success"] | ||
S1 --> J1 | ||
T1 --> G1 | ||
U1 --> V1["If successful, mark DID as processed"] | ||
V1 --> D1 | ||
W1 --> X1["Update last_processed in subscriptions"] | ||
X1 --> Y1["Push metrics and logs"] | ||
Y1 --> Z1["Sleep if not once and repeat or exit"] | ||
``` | ||
|
||
--- | ||
|
||
## Key Concepts | ||
|
||
- **DID**: Data Identifier (can be a file, dataset, or container). | ||
- **Subscription**: User-defined pattern and rules for automatic data placement. | ||
- **Replication Rule**: Instruction for Rucio to place a copy of a DID on specified RSEs. | ||
- **RSE**: Rucio Storage Element (storage endpoint, e.g., a data center or cloud bucket). | ||
- **Split/Chained Logic**: Advanced methods for spreading or chaining rules across multiple sites, using algorithms. | ||
|
||
--- | ||
|
||
## Summary | ||
|
||
The transmogrifier daemon is central to Rucio’s automated data management, ensuring that new data is promptly and correctly distributed according to organizational policies and user-defined subscriptions. Its sophisticated logic—including split, chained, and algorithmic rule selection—supports even the most advanced data placement strategies, while robust error handling and metrics allow for reliable, scalable operation. | ||
rdimaio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
--- | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.