Repository navigation
Allow for reseting the Quent context in StreamingEngine._reset.
#24649
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
base: main
Are you sure you want to change the base?
Changes from 13 commits
1bd2d66
a8d2dd4
33820dd
6f302e2
4a3de24
c5a5234
9da5f3f
6243197
ec21c4c
625885f
257cd05
154e2bd
557bbd6
436e0fa
b2b0a4f
e2599f8
9dab31b
06b884d
ddfd1d4
3d623f5
019c4a2
ce04869
1427992
2eff55f
5c1bda1
952af6f
d1bada3
74ea0e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,12 +539,6 @@ def _reset( | |
| existing_executor_options = self.config.get("executor_options", {}) | ||
| if not isinstance(existing_executor_options, dict): | ||
| existing_executor_options = {} | ||
| existing_quent_context = existing_executor_options.get("quent_context") | ||
| if ( | ||
| "quent_context" in executor_options | ||
| and executor_options["quent_context"] != existing_quent_context | ||
| ): | ||
| raise ValueError("quent_context cannot be changed during reset") | ||
|
|
||
| _disallowed_exec = {"num_py_executors"} & executor_options.keys() | ||
| if _disallowed_exec: | ||
|
|
@@ -589,6 +583,42 @@ def __exit__(self, *_: object) -> None: | |
| """Exit the context manager, calling :meth:`shutdown`.""" | ||
| self.shutdown() | ||
|
|
||
| def _update_quent( | ||
| self, | ||
| new_quent_context: QuentConfig | None, | ||
| existing_quent_context: QuentConfig | None, | ||
| executor_options: dict[str, Any], | ||
| ) -> None: | ||
| """ | ||
| Apply a ``quent_context`` change in-place. | ||
|
|
||
| Closes existing Quent runtimes, starts new ones for | ||
| ``new_quent_context``, and patches ``executor_options["quent_context"]`` | ||
| and ``_quent_output_root``. Subclasses implement :meth:`_quent_close` | ||
| and :meth:`_quent_open` for the backend-specific work. | ||
| """ | ||
| if new_quent_context != existing_quent_context: | ||
|
Contributor
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. Questions for me to see if there are any implicit invariants:
Contributor
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. Adding to @mroeschke's questions, from my reading (@TomAugspurger please correct me if I am wrong):
One thing that worries me: this compares the whole The restart reuses the same Could we compare only
Contributor
Author
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.
But (correct me if I'm wrong), regular users will never trigger a Regular usage, including our streaming benchmarks, will hit this code path when the engine is initially created, and they'll compare a
Contributor
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. You're right, the only caller of |
||
| if existing_quent_context is not None: | ||
| self._quent_close() | ||
|
TomAugspurger marked this conversation as resolved.
Outdated
|
||
| if new_quent_context is not None: | ||
| new_quent_context = self._quent_open(new_quent_context) | ||
| self._quent_output_root = ( | ||
| new_quent_context.run_root if new_quent_context is not None else None | ||
| ) | ||
| executor_options["quent_context"] = new_quent_context | ||
|
|
||
| def _quent_close(self) -> None: | ||
| """Close all Quent runtimes for this engine (workers then controller).""" | ||
| raise NotImplementedError( # pragma: no cover | ||
| f"{type(self).__name__} does not implement _quent_close" | ||
| ) | ||
|
|
||
| def _quent_open(self, quent_context: QuentConfig) -> QuentConfig: | ||
| """Start fresh Quent runtimes and return the effective configuration.""" | ||
| raise NotImplementedError( # pragma: no cover | ||
| f"{type(self).__name__} does not implement _quent_open" | ||
| ) | ||
|
|
||
| def _run(self, func: Callable[..., T], *args: Any, **kwargs: Any) -> list[T]: | ||
| """ | ||
| Execute a function on all ranks. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.