-
Notifications
You must be signed in to change notification settings - Fork 6
ROSE Spec for Service #97
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
AymenFJA
wants to merge
21
commits into
main
Choose a base branch
from
feature/yaml-spec
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 5 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
cae8e47
Introducing yaml spec for rose api
AymenFJA b7bd9ac
support config learner/task
AymenFJA ed0ad86
docs, tests and schema expansion
AymenFJA 846d33f
major docs refine
AymenFJA fae7af7
fix Spec API and docs inconsistency
AymenFJA 59990d3
improve docs
AymenFJA 44512ff
This commit:
AymenFJA fa09051
fix pre-commit
AymenFJA 8c30b1e
adding missing init for tests
AymenFJA 7cce508
update rose with new orbit
AymenFJA 85f2f17
leftovers
AymenFJA a4b3f0a
rename rose/al,rl,uq to descriptive package names; add rose run CLI
AymenFJA 2556dbd
pre-commit
AymenFJA 3c60d65
implement `rose run --remote` (spec-driven remote execution via ORBIT)
AymenFJA 7e07df8
pre-commit
AymenFJA 3a47c55
ruff
AymenFJA 0a374f8
adding pre-commit to tox
AymenFJA 1ae6633
another attempt to fix pre-commit
AymenFJA d6ff2fe
adding orbit as dep
AymenFJA 8bb05e0
reorganize remote execution, make HPC wait configurable, rework docs
AymenFJA 4c22af7
cleanup docs
AymenFJA 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
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
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
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
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
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
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
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
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
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
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
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
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,82 @@ | ||
| # ROSE as a Service | ||
|
|
||
| This page describes ROSE's service model: how the active-learning/RL loop you define stays under your control while the actual simulation and training work executes on HPC, and what that does and does not require from you today. | ||
|
|
||
| --- | ||
|
|
||
| ## Core idea: BYOF — Bring Your Own Workflow | ||
|
|
||
| ROSE does not own the science. It owns the **orchestration loop**: submit a task, wait for it, decide what runs next, check a stop criterion, repeat — until `max_iter` or the criterion is met. | ||
|
|
||
| You bring: | ||
|
|
||
| - A `simulate` / `train` / `active_learn` (or `environment` / `update`, or `prediction` / `uncertainty`) implementation, as a plain Python function or a shell command. | ||
| - The environment that implementation needs (packages, data, scripts). | ||
| - The decision of where it should run — a laptop, a login node, or a leadership-class HPC allocation. | ||
|
|
||
| ROSE brings the orchestration: dependency-correct task submission, iteration bookkeeping, stop-criterion evaluation, checkpoint-safe state, and tracking integration. The [YAML Spec API](spec-api.md) is the declarative form of this contract — `function: tasks:simulate` is a pointer to *your* code, not a hook into ROSE's. | ||
|
|
||
| This is the same boundary that makes ROSE usable across domains without ROSE having to understand any of them: it sees `*args, **kwargs` in, a return value out, nothing about what happened in between. | ||
|
|
||
| --- | ||
|
|
||
| ## Two places work can happen | ||
|
|
||
| A ROSE learner doesn't run anything itself — it submits tasks through whichever `asyncflow` execution backend you hand it. Two backends matter for the "as a Service" framing: | ||
|
|
||
| | Backend | Where the orchestration loop runs | Where tasks execute | Documented at | | ||
| |---|---|---|---| | ||
| | `RadicalExecutionBackend` (RHAPSODY) | Wherever your script runs — it submits a pilot job and blocks inside it | Inside the pilot job it just submitted | [Target Resources](target-resources.md) | | ||
| | Edge backend (RHAPSODY, `bridge_url` + `edge_name`) | Wherever your script runs — does **not** need to be the HPC machine | Inside a separate, already-running edge agent — possibly on a different machine entirely | this page | | ||
|
|
||
| The first model is "submit a job, then run my loop inside it." The second is "run my loop here; dispatch tasks to a job running somewhere else." That second model is what makes ROSE service-like: the loop's control plane (your `learner.start()` call, deciding when to stop, talking to MLflow/ClearML) is decoupled from the compute plane (the HPC allocation actually executing `simulate`/`train`). | ||
|
|
||
| --- | ||
|
|
||
| ## How ROSE operates within a job | ||
|
|
||
| The edge backend connects two things over a bridge: | ||
|
|
||
| 1. **An edge agent**, running inside an HPC job allocation. The job itself is requested through whatever your site normally uses to get an allocation — it doesn't have to be requested by ROSE. Once the job starts, the edge agent comes up inside it and stays alive for the allocation's lifetime, ready to accept task descriptions. | ||
| 2. **Your orchestration process**, running anywhere — your laptop, a long-lived service host, a CI runner. It builds the learner from your spec (`LearnerBuilder(cfg, asyncflow).build()`), starts the loop (`learner.start(...)`), and for every `simulation`/`training`/`active_learn`/... task it submits, the asyncflow engine forwards that task description over the bridge to the edge, waits for the result, and resumes the loop. | ||
|
|
||
| The practical effect: you submit a ROSE workflow to HPC without an interactive session on the cluster, and without your laptop needing to stay connected to the scheduler — only to the bridge. The job allocation is what's expensive and scheduler-queued; your control process is cheap and can be restarted independently of it. Stop-criterion checks, `set_next_config()` decisions, and tracking calls all happen on your side of the bridge, on every iteration, with no per-iteration job resubmission. | ||
|
|
||
| This is additive to the model in [Target Resources](target-resources.md), not a replacement — both go through the same `WorkflowEngine`/`LearnerBuilder` plumbing. Which backend you choose only changes *where* the edge lives; the spec, the learner, and the loop semantics are identical either way. | ||
|
|
||
| --- | ||
|
|
||
| ## What ROSE automates for you today | ||
|
|
||
| - **The loop itself** — iterate, await, check criterion, repeat, with no boilerplate beyond defining your tasks and the threshold. | ||
| - **Preemption-safe state** — every completed iteration is durable before the next starts, so a killed job loses at most the in-flight iteration. | ||
| - **Tracking** — `tracking.backend: mlflow | clearml` in the spec wires a tracker once; every iteration's metrics, params, and lifecycle events are reported automatically, with no tracking code inside your task functions. | ||
| - **Heterogeneous dispatch** — the same loop drives CPU-only, GPU, MPI, or shell-executable tasks, and (via the `learners:` block) distinct task implementations per parallel learner. | ||
|
|
||
| ## What ROSE does **not** yet automate: data movement | ||
|
|
||
| Today, getting a simulation's output into the training task's hands is entirely your task code's responsibility: | ||
|
|
||
| - `type: python` slots pass the previous task's return value in-memory, as the first positional argument — this is implicit in the task type, not something you declare. | ||
| - `type: shell` slots pass nothing automatically; your command's stdout becomes the next task's input only if your scripts agree on a file path or convention outside the spec (this is exactly the pattern in the M3DC1 use case, where `simulate`/`train`/`active_learn` hand-roll a namespaced directory of files to communicate). | ||
|
|
||
| **Planned:** a `DataExchangeProtocol` field in the YAML spec — `FileBased` or `MemoryBased` — that makes this an explicit, ROSE-managed choice instead of an implicit consequence of task type: | ||
|
|
||
| - `MemoryBased` formalizes what `type: python` already does today — in-process object passing between tasks on the same worker. | ||
| - `FileBased` would let ROSE own staging a per-iteration (and per-learner, for parallel runs) working directory, instead of every use case reimplementing its own namespace/path convention by hand inside task code. | ||
|
|
||
| This isn't implemented yet — it's the next piece of surface area on the spec, and the natural place to close the "no environment/output contract" gap without ROSE needing to know anything about the science moving through it. | ||
|
|
||
| --- | ||
|
|
||
| ## What you bring, concretely | ||
|
|
||
| | You supply | ROSE does not check this for you (today) | | ||
| |---|---| | ||
| | Task implementations (`simulate`, `train`, `active_learn`, criterion evaluator, ...) matching the `*args, **kwargs` convention | Whether return shapes match what the next task expects | | ||
| | The runtime environment those implementations need on the worker | No environment/dependency manifest in the spec | | ||
| | Access to wherever the edge agent's job runs (account, queue, allocation) | Out of scope for the spec layer entirely | | ||
| | Your data, and a convention for how tasks find it (today: `parameters:` + your own file paths) | No declared output/data contract yet — see `DataExchangeProtocol` above | | ||
| | Correct `remote.pythonpath` if task modules aren't already importable where the edge runs | `validate_imports=True` only checks importability in *your local* environment | | ||
|
|
||
| None of this is unique to the service model — it's the same BYOF boundary as running ROSE locally. What the service model changes is *where* that boundary sits physically: your task code and its dependencies need to be reachable from the edge's job allocation, not from your laptop. |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in this line: 'distribuited' should be 'distributed'.