-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from lsst-sqre/tickets/DM-29532
[DM-29532] Code cleanup
- Loading branch information
Showing
12 changed files
with
262 additions
and
215 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from aiohttp import ClientSession | ||
|
||
_session = None | ||
|
||
|
||
async def get_session() -> ClientSession: | ||
"""This is the way to retrieve a ClientSession to make HTTP requests. | ||
ClientSession needs to be created inside an async function, so by | ||
calling this, you ensure it exists, or create it if it doesn't. | ||
Since there are some connection pools, we don't want to be creating | ||
these all the time. Better to just reuse one.""" | ||
global _session | ||
if not _session: | ||
_session = ClientSession() | ||
return _session |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass(frozen=True) | ||
class LabSize: | ||
"""The cpu and ram settings for a lab container.""" | ||
|
||
cpu: float | ||
"""Number of virtual CPUs to allocate for this lab. | ||
This can be a partial number, such as 2.5 or .5 vCPUs.""" | ||
|
||
name: str | ||
"""The name referring to this pairing of cpu and ram.""" | ||
|
||
ram: str | ||
"""Amount of memory to allocate for this lab. | ||
This is a string with special characters for units, such as | ||
2048M, or 2G.""" |
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
Oops, something went wrong.