-
Notifications
You must be signed in to change notification settings - Fork 7
Resource Manager #7
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
Closed
Closed
Changes from 48 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
100eeee
basics for RM move from RP
andre-merzky 30494a6
snap
andre-merzky 3bae4e8
fix slurm rm
andre-merzky 33c3df9
Merge branch 'main' into feature/rm
andre-merzky bc1055b
snap
andre-merzky fd8b3b2
Merge branch 'improve/execution_backends' into feature/rm
andre-merzky dc63bd9
linting, dataclass
andre-merzky 9492971
linting
andre-merzky c41983e
snap
andre-merzky 0c10406
linting
andre-merzky 169e675
linting
andre-merzky dbea907
add partitioning to RM
andre-merzky 33752d5
remove rc dependency
andre-merzky 20222e6
fix RM bugs: align _initialize interface, fix logger calls, fix _get_…
andre-merzky 72186a5
add hostlist compactify/expand methods, refactor hostlist parsing
andre-merzky 2c7739b
add partition environment variable support for all RMs
andre-merzky 5b81177
add partition support to execution backends, fix RM bugs
andre-merzky f50496f
clean up resource_manager: remove redundant comments, fix docstrings
andre-merzky 53ac4c6
Refactor Resource Manager code
andre-merzky 86bb452
snap
andre-merzky 4297d9a
Merge branch 'main' into feature/rm
andre-merzky f7ac6f9
Merge branch 'main' into feature/rm
andre-merzky bd0df7a
first shot at edge backend
andre-merzky 41228d7
add missing files
andre-merzky c814d23
backend refactoring
andre-merzky 0e34f2f
snap
andre-merzky dc81e05
fix task routing and improve error reporting
andre-merzky c002ef5
Add noop execution backend for performance benchmarking
andre-merzky b976560
snap
andre-merzky 60da2ad
snap
andre-merzky ca7fbd7
snap
andre-merzky 0aef47d
fix silent import error
andre-merzky 6a656bc
edge backend: fail-fast on Python version skew for cloudpickled tasks
andre-merzky a9522eb
edge backend: auto-select edge, simplify
andre-merzky 1bcf587
Merge branch 'main' into feature/edge
andre-merzky d4c3fe6
collect stderr in case of failure for task diagnosis
andre-merzky 606e232
revert v1 fix, v3 fix for missing stderr
andre-merzky 735e6d5
another v3 fix for missing stderr
andre-merzky 4d3eaf1
another v3 fix for missing stderr
andre-merzky d0f60ca
another v3 fix for missing stderr
andre-merzky 4547c73
merge snapshot - untested
andre-merzky 05ae574
merge from main
andre-merzky 9eff60c
migrate rm to new repo
andre-merzky 379ce85
Merge remote-tracking branch 'origin/dev' into feature/rm-reconcile
andre-merzky c5f2689
backends: drop edge backend, superseded by orbit
andre-merzky fa1da76
address gemini review — Makefile typo, RM partition safety
andre-merzky b290390
style: satisfy pre-commit formatters (ruff-format/docformatter)
andre-merzky ef1ce1f
address gemini review — RM resources retry-safety and noop task lifec…
andre-merzky 9fbfccd
address gemini review round 2 — noop/task (shared) + radical_pilot
andre-merzky 4af2cd1
concurrent: add `from __future__ import annotations` for Python 3.9
andre-merzky 45c4cc7
noop: address gemini review — task_state_cb signature + create() factory
andre-merzky 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| """No-op execution backend for performance benchmarking. | ||
|
|
||
| Tasks are immediately marked as DONE without executing anything. | ||
| """ | ||
|
|
||
| import asyncio | ||
| import logging | ||
| from typing import Any | ||
| from typing import Callable | ||
|
|
||
| from ..base import BaseBackend | ||
| from ..constants import BackendMainStates | ||
| from ..constants import StateMapper | ||
|
|
||
|
|
||
| def _get_logger() -> logging.Logger: | ||
| return logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class NoopExecutionBackend(BaseBackend): | ||
| """Backend that completes every task instantly. | ||
|
|
||
| Useful for measuring Orbit/bridge/client overhead without any actual task execution cost. | ||
| """ | ||
|
|
||
| def __init__(self, name: str = "noop"): | ||
| super().__init__(name=name) | ||
| self.logger = _get_logger() | ||
| self.tasks: dict[str, dict] = {} | ||
| self._futures: dict[str, asyncio.Task] = {} | ||
| self._callback_func: Callable = lambda t, s: None | ||
| self._initialized = False | ||
| self._backend_state = BackendMainStates.INITIALIZED | ||
|
|
||
| def __await__(self): | ||
| return self._async_init().__await__() | ||
|
|
||
| async def _async_init(self): | ||
| if not self._initialized: | ||
| StateMapper.register_backend_states_with_defaults(backend=self) | ||
| StateMapper.register_backend_tasks_states_with_defaults(backend=self) | ||
| self._backend_state = BackendMainStates.INITIALIZED | ||
| self._initialized = True | ||
| self.logger.info("Noop execution backend started") | ||
| return self | ||
|
|
||
| def get_task_states_map(self): | ||
| return StateMapper(backend=self) | ||
|
|
||
| async def submit_tasks(self, tasks: list[dict[str, Any]]) -> None: | ||
| if self._backend_state != BackendMainStates.RUNNING: | ||
| self._backend_state = BackendMainStates.RUNNING | ||
|
|
||
| for task in tasks: | ||
| task.update( | ||
| { | ||
| "return_value": True, | ||
| "stdout": "", | ||
| "stderr": "", | ||
| "exit_code": 0, | ||
| } | ||
| ) | ||
| uid = task["uid"] | ||
| self.tasks[uid] = task | ||
| # Track the completion future so it can be cancelled via | ||
| # cancel_task / cancel_all_tasks / shutdown. | ||
| self._futures[uid] = asyncio.create_task(self._complete(task)) | ||
|
|
||
| async def _complete(self, task: dict) -> None: | ||
| try: | ||
| task["state"] = "DONE" | ||
| self._callback_func(task, "DONE") | ||
| finally: | ||
| self._futures.pop(task["uid"], None) | ||
|
andre-merzky marked this conversation as resolved.
Outdated
|
||
|
|
||
| async def cancel_task(self, uid: str) -> bool: | ||
| if uid not in self.tasks: | ||
| return False | ||
|
|
||
| future = self._futures.pop(uid, None) | ||
| if future is not None and not future.done(): | ||
| future.cancel() | ||
|
|
||
| task = self.tasks[uid] | ||
| if task.get("state") not in ("DONE", "FAILED", "CANCELED"): | ||
| task["state"] = "CANCELED" | ||
| self._callback_func(task, "CANCELED") | ||
| return True | ||
|
andre-merzky marked this conversation as resolved.
|
||
|
|
||
| async def cancel_all_tasks(self) -> int: | ||
| uids = list(self.tasks) | ||
| for uid in uids: | ||
| await self.cancel_task(uid) | ||
| return len(uids) | ||
|
|
||
| async def shutdown(self) -> None: | ||
| await self.cancel_all_tasks() | ||
| self._backend_state = BackendMainStates.SHUTDOWN | ||
| self.tasks.clear() | ||
| self._futures.clear() | ||
| self.logger.info("Noop execution backend shutdown") | ||
|
andre-merzky marked this conversation as resolved.
|
||
|
|
||
| def build_task(self, uid, task_desc, task_specific_kwargs): | ||
| pass | ||
|
|
||
| def link_explicit_data_deps(self, src_task=None, dst_task=None, file_name=None, file_path=None): | ||
| pass | ||
|
|
||
| def link_implicit_data_deps(self, src_task, dst_task): | ||
| pass | ||
|
|
||
| async def state(self) -> str: | ||
| return self._backend_state.value | ||
|
|
||
| def task_state_cb(self): | ||
| pass | ||
|
andre-merzky marked this conversation as resolved.
Outdated
|
||
|
|
||
| async def __aenter__(self): | ||
| if not self._initialized: | ||
| await self._async_init() | ||
| return self | ||
|
|
||
| async def __aexit__(self, exc_type, exc_val, exc_tb): | ||
| await self.shutdown() | ||
|
andre-merzky marked this conversation as resolved.
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.