-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating python API for Nox sessions (#1414)
* Update config.yml - fix Circle CI pipeline * Playground Implementation * Playground Implementation * Support CLI batching, and more * Update CLI test * Update CLI test * Update CLI test * CLI test Update * A few fix on the playground test * A few fix on the playground test * A few fix on the playground test * Playground with all command at #1368 * Playground with all command at #1368 * Playground with all command at #1368 * Playground with all command at #1368 * Playground with all command at #1368 * Playground with all command at #1368 * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground * Session Parallelization on CLI test playground with pytest dependency * Rich lib integration pyproject config * Make the serializer use the fields from the header (#1406) * Generalize Standard Run (#1411) * Modify header calculation to choose from predefined example output file or standard example output file * Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function * Remove unused method * Make csv serialization work for any kind of model api response * Remove the standard flag from the CLI since it is now the default run * Update tests * Creating python for Nox sessions * Creating python for Nox sessions * Generalize Standard Run (#1411) * Modify header calculation to choose from predefined example output file or standard example output file * Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function * Remove unused method * Make csv serialization work for any kind of model api response * Remove the standard flag from the CLI since it is now the default run * Update tests * Generalize Standard Run (#1411) * Modify header calculation to choose from predefined example output file or standard example output file * Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function * Remove unused method * Make csv serialization work for any kind of model api response * Remove the standard flag from the CLI since it is now the default run * Update tests * Make the serializer use the fields from the header (#1406) * Merge sample command with the example command (#1422) * Merge sample command with the example command * Fix example command usage * Generalize Standard Run (#1411) * Modify header calculation to choose from predefined example output file or standard example output file * Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function * Remove unused method * Make csv serialization work for any kind of model api response * Remove the standard flag from the CLI since it is now the default run * Update tests * Conflict resolved with upstream * Conflict resolved with upstream * Generalize Standard Run (#1411) * Modify header calculation to choose from predefined example output file or standard example output file * Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function * Remove unused method * Make csv serialization work for any kind of model api response * Remove the standard flag from the CLI since it is now the default run * Update tests * Make the serializer use the fields from the header (#1406) * Generalize Standard Run (#1411) * Modify header calculation to choose from predefined example output file or standard example output file * Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function * Remove unused method * Make csv serialization work for any kind of model api response * Remove the standard flag from the CLI since it is now the default run * Update tests * Conflict resolved with upstream * Conflict resolved with upstream * Unnecessary files removed * Generalize Standard Run (#1411) * Modify header calculation to choose from predefined example output file or standard example output file * Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function * Remove unused method * Make csv serialization work for any kind of model api response * Remove the standard flag from the CLI since it is now the default run * Update tests * Unnecessary files removed * Generalize Standard Run (#1411) * Modify header calculation to choose from predefined example output file or standard example output file * Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function * Remove unused method * Make csv serialization work for any kind of model api response * Remove the standard flag from the CLI since it is now the default run * Update tests * Make the serializer use the fields from the header (#1406) * Unnecessary files removed * Unnecessary files removed * Unnecessary files removed * Unnecessary files removed * Fix: Unnecessary files removed --------- Co-authored-by: Dhanshree Arora <[email protected]>
- Loading branch information
1 parent
ff9e2b6
commit 8c04b03
Showing
13 changed files
with
124 additions
and
43 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
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
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,68 @@ | ||
import subprocess | ||
import yaml | ||
from pathlib import Path | ||
|
||
|
||
class NoxSession: | ||
def __init__(self, name): | ||
self.name = name | ||
|
||
def execute(self, noxfile): | ||
try: | ||
subprocess.run( | ||
["nox", "-f", noxfile, "-s", self.name], | ||
check=True, | ||
) | ||
print(f"Session '{self.name}' executed successfully.") | ||
except subprocess.CalledProcessError as e: | ||
print(f"Error executing session '{self.name}': {e}") | ||
|
||
|
||
class NoxRunner: | ||
def __init__(self, config_path="config.yml", noxfile="noxfile.py"): | ||
self.original_dir = Path.cwd() | ||
self.config_path = Path(config_path) | ||
self.noxfile = noxfile | ||
self.config = yaml.safe_load(self.config_path.read_text()) | ||
self.nox_command = "nox" | ||
self.queue = [] | ||
|
||
def update_yaml_values(self, new_values: dict): | ||
existing_config = yaml.safe_load(self.config_path.read_text()) | ||
existing_config.update(new_values) | ||
self.config_path.write_text(yaml.dump(existing_config)) | ||
|
||
def get_python_version(self): | ||
return self.config.get("python_version", "3.10.10") | ||
|
||
def add_session(self, session_name): | ||
self.queue.append(NoxSession(session_name)) | ||
|
||
def execute_all(self): | ||
for session in self.queue: | ||
session.execute(self.noxfile) | ||
self.queue.clear() | ||
|
||
def clear_queue(self): | ||
self.queue.clear() | ||
|
||
def setup(self): | ||
self.add_session("setup") | ||
|
||
def test_from_github(self): | ||
self.add_session("test_from_github") | ||
|
||
def test_from_dockerhub(self): | ||
self.add_session("test_from_dockerhub") | ||
|
||
def test_auto_fetcher_decider(self): | ||
self.add_session("test_auto_fetcher_decider") | ||
|
||
def test_fetch_multiple_models(self): | ||
self.add_session("test_fetch_multiple_models") | ||
|
||
def test_serve_multiple_models(self): | ||
self.add_session("test_serve_multiple_models") | ||
|
||
def test_conventional_run(self): | ||
self.add_session("test_conventional_run") |
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