Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Procedural Scheduling Tweaks #151

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/aerie_cli/aerie_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1782,9 +1782,9 @@ def get_goal_id_for_name(self, name):
name=name
)
if len(resp) == 0:
raise RuntimeError(f"No goals found with name {name}. Specify goal id manually with -g.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improment.

raise RuntimeError(f"No goals found with name {name}.")
elif len(resp) > 1:
raise RuntimeError(f"Multiple goals found with name {name}. Specify goal id manually with -g.")
raise RuntimeError(f"Multiple goals found with name {name}.")
return resp[0]["id"]

def add_goals_to_specifications(self, upload_object):
Expand Down
1 change: 0 additions & 1 deletion src/aerie_cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
`app` is the CLI application with which all commands, subcommands, and callbacks are registered.
"""
import typer
from rich import print
from typing import Optional

from aerie_cli.commands import models
Expand Down
19 changes: 8 additions & 11 deletions src/aerie_cli/commands/scheduling.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
import typer
import os
from pathlib import Path
from typing import Optional

from aerie_cli.commands.command_context import CommandContext

app = typer.Typer()

def _get_name_and_ext(path: str):
path = path.strip()
filename = os.path.basename(path)
return os.path.splitext(filename)

@app.command()
def new(
path: str = typer.Argument(default=...),
path: Path = typer.Argument(default=...),
description: Optional[str] = typer.Option(
None, '--description', '-d', help="Description metadata"
),
public: bool = typer.Option(False, '-pub', help="Indicates a public goal visible to all users (default false)"),
public: bool = typer.Option(False, '--public', '-pub', help="Indicates a public goal visible to all users (default false)"),
name: Optional[str] = typer.Option(
None, '--name', '-n', help="Name of the new goal (default is the file name without extension)"
),
Expand All @@ -31,7 +26,8 @@ def new(
"""Upload new scheduling goal"""

client = CommandContext.get_client()
filename, extension = _get_name_and_ext(path)
filename = path.stem
extension = path.suffix
if name is None:
name = filename
upload_obj = {}
Expand Down Expand Up @@ -63,13 +59,14 @@ def new(

@app.command()
def update(
path: str = typer.Argument(default=...),
path: Path = typer.Argument(default=...),
goal_id: Optional[int] = typer.Option(None, '--goal', '-g', help="Goal ID of goal to be updated (will search by name if omitted)"),
name: Optional[str] = typer.Option(None, '--name', '-n', help="Name of the goal to be updated (ignored if goal is provided, default is the file name without extension)"),
):
"""Upload an update to a scheduling goal"""
client = CommandContext.get_client()
filename, extension = _get_name_and_ext(path)
filename = path.stem
extension = path.suffix
if goal_id is None:
if name is None:
name = filename
Expand Down
22 changes: 13 additions & 9 deletions tests/integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ python3 -m pytest .

## Updating Tests for New Aerie Versions

Integration tests are automatically run by CI against all supported Aerie versions. To add and test support for a new Aerie version:
Integration tests are automatically run by CI against all supported Aerie versions. Update as follows with the supported set of Aerie versions:

1. Download the appropriate version release JAR for the [Banananation model](https://github.com/NASA-AMMOS/aerie/packages/1171106/versions) and add it to `tests/integration_tests/files/models`, named as `banananation-X.X.X.jar` (substituting the correct version number).
2. Update the [`.env`](../../.env) file `DOCKER_TAG` value to the new version string. This defaults the local deployment to the latest Aerie version.
3. Update [`docker-compose-test.yml`](../../docker-compose-test.yml) as necessary to match the new Aerie version. The [aerie-ui compose file](https://github.com/NASA-AMMOS/aerie-ui/blob/develop/docker-compose-test.yml) can be a helpful reference to identify changes.
4. Manually run the integration tests and update the code and tests as necessary for any Aerie changes.
1. Integration tests require a JAR for the Banananation model for each tested Aerie version. [Download official artifacts from Github](https://github.com/NASA-AMMOS/aerie/packages/1171106/versions) and add to `tests/integration_tests/files/models`, named as `banananation-X.X.X.jar` (substituting the correct version number). Remove outdated JAR files.
2. Update the `COMPATIBLE_AERIE_VERSIONS` array in [`aerie_host.py`](../../src/aerie_cli/aerie_host.py).
3. Update the [`.env`](../../.env) file `DOCKER_TAG` value to the latest compatible version. This sets the default value for a local Aerie deployment.
4. Update [`docker-compose-test.yml`](../../docker-compose-test.yml) as necessary to match the supported Aerie versions. The [aerie-ui compose file](https://github.com/NASA-AMMOS/aerie-ui/blob/develop/docker-compose-test.yml) can be a helpful reference to identify changes.
5. Update the `aerie-version` list in the [CI configuration](../../.github/workflows/test.yml) to include the new version.
6. If breaking changes are necessary to support the new Aerie version, remove any Aerie versions which are no longer supported from the CI configuration and remove the corresponding banananation JAR file.
7. Open a PR and verify all tests still pass.

To verify changes:

1. Manually run the integration tests and update the code and tests as necessary for any Aerie changes.
2. If breaking changes are necessary to support the new Aerie version, remove any Aerie versions which will no longer be supported as described above.
3. Open a PR and verify all CI tests pass.

## Summary of Integration Tests

Expand All @@ -48,8 +52,8 @@ Integration tests are automatically run by CI against all supported Aerie versio
- Test all `plans` commands
- Tests simulations and `plans download...` commands as well

### [Goals test](test_goals.py)
- Test all `goals` commands
### [Scheduling test](test_scheduling.py)
- Test all `scheduling` commands

### [Expansion test](test_expansion.py)
- Test all `expansion` commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import arrow

from typer.testing import CliRunner
from pathlib import Path

from aerie_cli.__main__ import app
from aerie_cli.schemas.client import ActivityPlanCreate
Expand Down