-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Expanded *production* cli to an *online* cli to add test functions
- Loading branch information
1 parent
39625c4
commit 1c9489a
Showing
12 changed files
with
158 additions
and
27 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
2 changes: 1 addition & 1 deletion
2
...rs/urbanair_parser/production/__init__.py → ...arsers/urbanair_parser/online/__init__.py
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,5 +1,5 @@ | ||
"""CLI for production models""" | ||
|
||
from .main import app | ||
from .online import app | ||
|
||
__all__ = ["app"] |
8 changes: 8 additions & 0 deletions
8
containers/cleanair/cleanair/parsers/urbanair_parser/online/online.py
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,8 @@ | ||
import typer | ||
|
||
from .production import app as production | ||
from .test import app as test | ||
|
||
app = typer.Typer(help="Online Run CLI") | ||
app.add_typer(production, name="production") | ||
app.add_typer(test, name="test") |
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
33 changes: 33 additions & 0 deletions
33
containers/cleanair/cleanair/parsers/urbanair_parser/online/test.py
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,33 @@ | ||
"""CLI for production models""" | ||
|
||
from pathlib import Path | ||
import typer | ||
from ....types import ExperimentName | ||
from ..shared_args import ExperimentDir | ||
from .utils import StaticDynamic, run_experiment_online | ||
|
||
app = typer.Typer(help="Test CLI") | ||
|
||
# The test_svgp functions are not implemented | ||
# @app.command() | ||
# def svgp( | ||
# static_or_dynamic: StaticDynamic, experiment_root: Path = ExperimentDir | ||
# ) -> None: | ||
# """Run the test SVGP model""" | ||
# if static_or_dynamic == StaticDynamic.dynamic: | ||
# experiment_name = ExperimentName.production_svgp_dynamic | ||
# else: | ||
# experiment_name = ExperimentName.production_svgp_static | ||
# run_experiment_online(experiment_name, experiment_root=experiment_root) | ||
# | ||
# | ||
# @app.command() | ||
def mrdgp( | ||
static_or_dynamic: StaticDynamic, experiment_root: Path = ExperimentDir | ||
) -> None: | ||
"""Run the test MRDGP model""" | ||
if static_or_dynamic == StaticDynamic.dynamic: | ||
experiment_name = ExperimentName.test_mrdgp_dynamic | ||
else: | ||
experiment_name = ExperimentName.test_mrdgp_static | ||
run_experiment_online(experiment_name, experiment_root=experiment_root) |
20 changes: 20 additions & 0 deletions
20
containers/cleanair/cleanair/parsers/urbanair_parser/online/utils.py
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 enum import Enum | ||
from pathlib import Path | ||
|
||
from ..experiment.main import metrics, run, setup, update, upload | ||
from ....types import ExperimentName | ||
|
||
|
||
class StaticDynamic(str, Enum): | ||
"""Is the model static or dynamic?""" | ||
|
||
dynamic = "dynamic" | ||
static = "static" | ||
|
||
|
||
def run_experiment_online(experiment_name: ExperimentName, experiment_root: Path): | ||
setup(experiment_name, experiment_root=experiment_root) | ||
run(experiment_name, experiment_root=experiment_root) | ||
update(experiment_name, experiment_root=experiment_root) | ||
metrics(experiment_name, experiment_root=experiment_root) | ||
upload(experiment_name, experiment_root=experiment_root) |
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