-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
setup_environment
to truss (#1188)
* Bump Version for CTX builder * skip long test * add aiofiles to requirements * increase ctx builder version * use async task instead * increase ctx builder * pass event_loop down * allow event_loop to be optional * only thread self._model.load * revert test_server changes * add integration test for setup_environment * add truss for setup_environment integration test * revert model wrapper test changes * revert load changes and check model wrapper status instead + tests * clean up resolver * fix resolver test * call setup env before load * remove print statements * unit tests + fixes * sid CR * fix polling structure * CR * bump rc version * support for clearing out env * update ctx builder and revert version of types-aiofiles * test for Nones in configmap file * better error handling * update ctx builder version * test fix + better error msg * move sleep * add cleanup to env integration tests * add a todo for async setup nv + more logging
- Loading branch information
Showing
12 changed files
with
618 additions
and
233 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -17,3 +17,4 @@ pyyaml==6.0.0 | |
requests==2.31.0 | ||
uvicorn==0.24.0 | ||
uvloop==0.19.0 | ||
aiofiles==24.1.0 |
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 |
---|---|---|
@@ -1,13 +1,28 @@ | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
import aiofiles | ||
|
||
DYNAMIC_CONFIG_MOUNT_DIR = "/etc/b10_dynamic_config" | ||
ENVIRONMENT_DYNAMIC_CONFIG_KEY = "environment" | ||
|
||
|
||
def get_dynamic_config_value(key: str) -> Optional[str]: | ||
def get_dynamic_config_value_sync(key: str) -> Optional[str]: | ||
dynamic_config_path = Path(DYNAMIC_CONFIG_MOUNT_DIR) / key | ||
if dynamic_config_path.exists() and dynamic_config_path.is_file(): | ||
if dynamic_config_path.exists(): | ||
with dynamic_config_path.open() as dynamic_config_file: | ||
dynamic_config_value = dynamic_config_file.read() | ||
return dynamic_config_value | ||
return dynamic_config_file.read() | ||
return None | ||
|
||
|
||
def get_dynamic_config_file_path(key: str): | ||
dynamic_config_path = Path(DYNAMIC_CONFIG_MOUNT_DIR) / key | ||
return dynamic_config_path | ||
|
||
|
||
async def get_dynamic_config_value_async(key: str) -> Optional[str]: | ||
dynamic_config_path = get_dynamic_config_file_path(key) | ||
if dynamic_config_path.exists(): | ||
async with aiofiles.open(dynamic_config_path, "r") as dynamic_config_file: | ||
return await dynamic_config_file.read() | ||
return None |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
model_name: Test Loaf Failure | ||
model_name: Test Load Failure | ||
python_version: py39 |
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.