-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: asyncio.run was sometimes used within a coroutine
`asyncio.run` was called when initializing a pool object using `VmPool.__init__(...)`. This caused two issues: 1. The pool was sometimes created from within a coroutine in the context of tests, and this would raise an error. 2. Having side effects inside the `__init__` method makes objects more difficult to manipulate and test. 3. Tests should not load persistent executions automatically. 4. The network was configured after loading persistent executions, which could cause networking issues. A related issue is the snapshot manager being started when initializing the `VmPool`, while this is not always desirable. Solution proposed: 1. Explicitly load the persistent executions using `pool.load_persistent_executions()` from the `supervisor.run()` function. This is now called after `VmPool.setup()` and therefore after the networking of the host has been configured. 2. The snapshot manager is now started by `VmPool.setup()` instead of `VmPool.__init__`. This function is almost always called just after initializing the pool. 3. Configuring `settings.SNAPSHOT_FREQUENCY` to zero now disables the snapshot manager. 4. `SnapshotManager.run_snapshots` is renamed `SnapshotManager.run_in_thread` to make its behaviour more explicit.
- Loading branch information
Showing
4 changed files
with
16 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 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 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 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