Skip to content

Commit

Permalink
Merge pull request #103 from NASA-AMMOS/release--v2.2.0
Browse files Browse the repository at this point in the history
Release  v2.2.0
cartermak authored Dec 12, 2023
2 parents ac1b33e + 68f9112 commit ca9e426
Showing 15 changed files with 162 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOCKER_TAG=v1.14.0
DOCKER_TAG=v2.1.0
REPOSITORY_DOCKER_URL=ghcr.io/nasa-ammos

AERIE_USERNAME=aerie
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ jobs:
strategy:
matrix:
python-version: [ "3.6.15", "3.11" ]
aerie-version: ["1.13.0", "1.14.0"]
aerie-version: ["2.1.0"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
70 changes: 24 additions & 46 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
@@ -8,8 +8,7 @@ services:
GQL_API_URL: http://localhost:8080/v1/graphql
HASURA_GRAPHQL_JWT_SECRET: "${HASURA_GRAPHQL_JWT_SECRET}"
LOG_FILE: console
LOG_LEVEL: debug
NODE_TLS_REJECT_UNAUTHORIZED: "0"
LOG_LEVEL: warn
PORT: 9000
POSTGRES_AERIE_MERLIN_DB: aerie_merlin
POSTGRES_HOST: postgres
@@ -21,6 +20,8 @@ services:
restart: always
volumes:
- aerie_file_store:/app/files
networks:
- aerie_net
aerie_merlin:
container_name: aerie_merlin
depends_on: ["postgres"]
@@ -43,8 +44,10 @@ services:
restart: always
volumes:
- aerie_file_store:/usr/src/app/merlin_file_store
networks:
- aerie_net
aerie_merlin_worker_1:
container_name: aerie_merlin_worker_1
container_name: aerie_merlin_worker
depends_on: ["postgres"]
environment:
MERLIN_WORKER_DB: "aerie_merlin"
@@ -64,27 +67,8 @@ services:
restart: always
volumes:
- aerie_file_store:/usr/src/app/merlin_file_store:ro
aerie_merlin_worker_2:
container_name: aerie_merlin_worker_2
depends_on: ["postgres"]
environment:
MERLIN_WORKER_DB: "aerie_merlin"
MERLIN_WORKER_DB_PASSWORD: "${AERIE_PASSWORD}"
MERLIN_WORKER_DB_PORT: 5432
MERLIN_WORKER_DB_SERVER: postgres
MERLIN_WORKER_DB_USER: "${AERIE_USERNAME}"
MERLIN_WORKER_LOCAL_STORE: /usr/src/app/merlin_file_store
SIMULATION_PROGRESS_POLL_PERIOD_MILLIS: 2000
JAVA_OPTS: >
-Dorg.slf4j.simpleLogger.defaultLogLevel=INFO
-Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=WARN
-Dorg.slf4j.simpleLogger.logFile=System.err
UNTRUE_PLAN_START: "2000-01-01T11:58:55.816Z"
image: "${REPOSITORY_DOCKER_URL}/aerie-merlin-worker:${DOCKER_TAG}"
ports: ["27188:8080"]
restart: always
volumes:
- aerie_file_store:/usr/src/app/merlin_file_store:ro
networks:
- aerie_net
aerie_scheduler:
container_name: aerie_scheduler
depends_on: ["aerie_merlin", "postgres"]
@@ -105,6 +89,8 @@ services:
restart: always
volumes:
- aerie_file_store:/usr/src/app/merlin_file_store
networks:
- aerie_net
aerie_scheduler_worker_1:
container_name: aerie_scheduler_worker_1
depends_on: ["postgres"]
@@ -127,27 +113,8 @@ services:
restart: always
volumes:
- aerie_file_store:/usr/src/app/merlin_file_store:ro
aerie_scheduler_worker_2:
depends_on: ["postgres"]
environment:
HASURA_GRAPHQL_ADMIN_SECRET: "${HASURA_GRAPHQL_ADMIN_SECRET}"
MERLIN_GRAPHQL_URL: http://hasura:8080/v1/graphql
SCHEDULER_WORKER_DB: "aerie_scheduler"
SCHEDULER_WORKER_DB_PASSWORD: "${AERIE_PASSWORD}"
SCHEDULER_WORKER_DB_PORT: 5432
SCHEDULER_WORKER_DB_SERVER: postgres
SCHEDULER_WORKER_DB_USER: "${AERIE_USERNAME}"
SCHEDULER_OUTPUT_MODE: UpdateInputPlanWithNewActivities
MERLIN_LOCAL_STORE: /usr/src/app/merlin_file_store
SCHEDULER_RULES_JAR: /usr/src/app/merlin_file_store/scheduler_rules.jar
JAVA_OPTS: >
-Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=INFO
-Dorg.slf4j.simpleLogger.logFile=System.err
image: "${REPOSITORY_DOCKER_URL}/aerie-scheduler-worker:${DOCKER_TAG}"
ports: ["27190:8080"]
restart: always
volumes:
- aerie_file_store:/usr/src/app/merlin_file_store:ro
networks:
- aerie_net
aerie_sequencing:
container_name: aerie_sequencing
depends_on: ["postgres"]
@@ -168,12 +135,13 @@ services:
restart: always
volumes:
- aerie_file_store:/usr/src/app/sequencing_file_store
networks:
- aerie_net
aerie_ui:
container_name: aerie_ui
depends_on: ["postgres"]
environment:
ORIGIN: http://localhost
NODE_TLS_REJECT_UNAUTHORIZED: "0"
PUBLIC_LOGIN_PAGE: "enabled"
PUBLIC_GATEWAY_CLIENT_URL: http://localhost:9000
PUBLIC_GATEWAY_SERVER_URL: http://aerie_gateway:9000
@@ -183,6 +151,8 @@ services:
image: "${REPOSITORY_DOCKER_URL}/aerie-ui:${DOCKER_TAG}"
ports: ["80:80"]
restart: always
networks:
- aerie_net
hasura:
container_name: aerie_hasura
depends_on: ["postgres"]
@@ -205,9 +175,12 @@ services:
image: "${REPOSITORY_DOCKER_URL}/aerie-hasura:${DOCKER_TAG}"
ports: ["8080:8080"]
restart: always
networks:
- aerie_net
postgres:
container_name: aerie_postgres
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_USER: "${POSTGRES_USER}"
AERIE_USERNAME: "${AERIE_USERNAME}"
@@ -217,8 +190,13 @@ services:
restart: always
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- aerie_net

volumes:
aerie_file_store:
mission_file_store:
postgres_data:

networks:
aerie_net:
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aerie-cli"
version = "2.1.1"
version = "2.2.0"
description = "A CLI application and Python API for interacting with Aerie."
authors = []
license = "MIT"
49 changes: 35 additions & 14 deletions src/aerie_cli/aerie_client.py
Original file line number Diff line number Diff line change
@@ -823,14 +823,15 @@ def create_expansion_rule(
return data["id"]

def create_expansion_set(
self, command_dictionary_id: int, model_id: int, expansion_ids: List[int]
self, command_dictionary_id: int, model_id: int, expansion_ids: List[int], name: str
) -> int:
"""Create an Aerie expansion set given a list of activity IDs
Args:
command_dictionary_id (int): ID of Aerie command dictionary
model_id (int): ID of Aerie mission model
expansion_ids (List[int]): List of expansion IDs to include in the set
name (str): Name of the expansion set
Returns:
int: Expansion set ID
@@ -841,11 +842,13 @@ def create_expansion_set(
$command_dictionary_id: Int!
$mission_model_id: Int!
$expansion_ids: [Int!]!
$name: String!
) {
createExpansionSet(
commandDictionaryId: $command_dictionary_id
missionModelId: $mission_model_id
expansionIds: $expansion_ids
name: $name
) {
id
}
@@ -856,6 +859,7 @@ def create_expansion_set(
command_dictionary_id=command_dictionary_id,
mission_model_id=model_id,
expansion_ids=expansion_ids,
name=name
)
return data["id"]

@@ -864,11 +868,17 @@ def list_expansion_sets(self) -> List[ExpansionSet]:
query ListExpansionSets {
expansion_set {
id
command_dict_id
created_at
updated_at
owner
updated_by
command_dict_id
expansion_rules {
id
}
description
name
mission_model_id
}
}
"""
@@ -1631,21 +1641,32 @@ def get_constraint_by_id(self, id):
def get_constraint_violations(self, plan_id):
get_violations_query = """
query ($plan_id: Int!) {
constraintResults: constraintViolations(planId: $plan_id) {
constraintId
constraintName
type
resourceIds
violations {
activityInstanceIds
windows {
start
constraintResponses: constraintViolations(planId: $plan_id) {
success
results {
constraintId
constraintName
resourceIds
type
gaps {
end
start
}
violations {
activityInstanceIds
windows {
end
start
}
}
}
gaps {
start
end
errors {
message
stack
location {
column
line
}
}
}
}
84 changes: 55 additions & 29 deletions src/aerie_cli/commands/expansion.py
Original file line number Diff line number Diff line change
@@ -281,18 +281,20 @@ def list_expansion_sets():
table = Table(
title="Expansion Sets"
)
table.add_column("Set ID", no_wrap=True)
table.add_column("Mission", no_wrap=True)
table.add_column("CMD Dict. Version", no_wrap=True)
table.add_column("ID", no_wrap=True)
table.add_column("Name", no_wrap=True)
table.add_column("Model ID", no_wrap=True)
table.add_column("CMD Dict. ID", no_wrap=True)
table.add_column("Created At", no_wrap=True)
table.add_column("CMD Dict. Version", no_wrap=True)
table.add_column("Owner", no_wrap=True)
for e_set in sets:
table.add_row(
str(e_set.id),
cmd_dicts[e_set.command_dictionary_id].mission,
cmd_dicts[e_set.command_dictionary_id].version,
str(e_set.name),
str(e_set.mission_model_id),
str(e_set.command_dictionary_id),
e_set.created_at.ctime()
cmd_dicts[e_set.command_dictionary_id].version,
e_set.owner
)

Console().print(table)
@@ -341,41 +343,65 @@ def create_expansion_set(
..., '--command-dict-id', '-d', prompt='Command Dictionary ID',
help='Command Dictionary ID'
),
name: str = typer.Option(
..., "--name", "-n", prompt="Expansion set name",
help="Expansion set name"
),
activity_types: List[str] = typer.Option(
None, '--activity-types', '-a',
help='Activity types to be included in the set'
),
rule_ids: List[int] = typer.Option(
None, '--rule-ids', '-r',
help='Expansion rules to be included in the set'
)
):
"""
Create an expansion set
Uses the newest expansion rules for each given activity type.
Filters to only use rules designated for the given mission model and
command dictionary.
Specify either a list of activity type names or rule IDs. If activity type
names are given, rules are filtered to only those designated for the given
mission model and command dictionary, then the highest rule ID is used for
each activity type named.
"""
client = CommandContext.get_client()
expansion_rules = client.get_rules_by_type()

if not activity_types:
types_str = typer.prompt('Activity Types (separate with spaces)')
activity_types = types_str.split(' ')

rule_ids = []
for at in activity_types:

try:
at_rules = expansion_rules[at]
for r in at_rules:
if not r.authoring_command_dict_id == command_dictionary_id:
at_rules.remove(r)
if not r.authoring_mission_model_id == model_id:
at_rules.remove(r)
rule_ids.append(max([r.id for r in at_rules]))
except (KeyError, ValueError):
Console().print(
f"No expansion rules for activity type: {at}", style='red')
return
if activity_types and rule_ids:
Console().print(
"Only specify either activity type name(s) or rule ID(s).", style='red')
return

if not activity_types and not rule_ids:
choice = select_from_list(
["By name", "By expansion rule ID"], "Choose how to specify rules")
if choice == "By name":
types_str = typer.prompt('Activity Types (separate with spaces)')
activity_types = types_str.split(' ')
else:
rule_ids_str = typer.prompt(
'Expansion rule IDs (separate with spaces)')
rule_ids = [int(r) for r in rule_ids_str.split(' ')]

if activity_types:

rule_ids = []
for at in activity_types:

try:
at_rules = expansion_rules[at]
for r in at_rules:
if not r.authoring_command_dict_id == command_dictionary_id:
at_rules.remove(r)
if not r.authoring_mission_model_id == model_id:
at_rules.remove(r)
rule_ids.append(max([r.id for r in at_rules]))
except (KeyError, ValueError):
Console().print(
f"No expansion rules for activity type: {at}", style='red')
return

set_id = client.create_expansion_set(
command_dictionary_id, model_id, rule_ids)
command_dictionary_id, model_id, rule_ids, name)
Console().print(f"Created expansion set: {set_id}")
Loading

0 comments on commit ca9e426

Please sign in to comment.