Skip to content

Commit

Permalink
Merge pull request #1444 from NASA-AMMOS/dev-sequencing
Browse files Browse the repository at this point in the history
Dev sequencing
  • Loading branch information
goetzrrGit authored May 16, 2024
2 parents db72e49 + b36086d commit 28adf91
Show file tree
Hide file tree
Showing 63 changed files with 2,331 additions and 1,952 deletions.
139 changes: 62 additions & 77 deletions .github/workflows/pgcmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ on:
- v*
workflow_dispatch:

env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
HASURA_GRAPHQL_ADMIN_SECRET: "${{secrets.HASURA_GRAPHQL_ADMIN_SECRET}}"
HASURA_GRAPHQL_JWT_SECRET: "${{secrets.HASURA_GRAPHQL_JWT_SECRET}}"
POSTGRES_USER: "${{secrets.POSTGRES_USER}}"
POSTGRES_PASSWORD: "${{secrets.POSTGRES_PASSWORD}}"
GATEWAY_USERNAME: "${{secrets.GATEWAY_USERNAME}}"
GATEWAY_PASSWORD: "${{secrets.GATEWAY_PASSWORD}}"
MERLIN_USERNAME: "${{secrets.MERLIN_USERNAME}}"
MERLIN_PASSWORD: "${{secrets.MERLIN_PASSWORD}}"
SCHEDULER_USERNAME: "${{secrets.SCHEDULER_USERNAME}}"
SCHEDULER_PASSWORD: "${{secrets.SCHEDULER_PASSWORD}}"
SEQUENCING_USERNAME: "${{secrets.SEQUENCING_USERNAME}}"
SEQUENCING_PASSWORD: "${{secrets.SEQUENCING_PASSWORD}}"

jobs:
dump-db-base:
runs-on: ubuntu-latest
Expand All @@ -28,16 +44,24 @@ jobs:
- name: Clone PGCMP
uses: actions/checkout@v4
with:
repository: cbbrowne/pgcmp
repository: NASA-AMMOS/pgcmp
path: pgcmp
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup Postgres Client (psql)
# ubuntu-latest does not currently have psql-16 in its apt library, so we cannot just run
# sudo apt update && sudo apt-get install --yes postgresql-client-16
# Current instructions are from https://www.postgresql.org/download/linux/ubuntu/
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
sudo apt update
sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update
sudo apt -y install postgresql-client-16
- name: Setup Hasura CLI
run: sudo curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
- name: Start Postgres
Expand All @@ -46,28 +70,10 @@ jobs:
docker compose up -d postgres hasura
docker images
docker ps -a
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
POSTGRES_USER: "${{secrets.POSTGRES_USER}}"
POSTGRES_PASSWORD: "${{secrets.POSTGRES_PASSWORD}}"
GATEWAY_USERNAME: "${{secrets.GATEWAY_USERNAME}}"
GATEWAY_PASSWORD: "${{secrets.GATEWAY_PASSWORD}}"
MERLIN_USERNAME: "${{secrets.MERLIN_USERNAME}}"
MERLIN_PASSWORD: "${{secrets.MERLIN_PASSWORD}}"
SCHEDULER_USERNAME: "${{secrets.SCHEDULER_USERNAME}}"
SCHEDULER_PASSWORD: "${{secrets.SCHEDULER_PASSWORD}}"
SEQUENCING_USERNAME: "${{secrets.SEQUENCING_USERNAME}}"
SEQUENCING_PASSWORD: "${{secrets.SEQUENCING_PASSWORD}}"
HASURA_GRAPHQL_ADMIN_SECRET: "${{secrets.HASURA_GRAPHQL_ADMIN_SECRET}}"
HASURA_GRAPHQL_JWT_SECRET: "${{secrets.HASURA_GRAPHQL_JWT_SECRET}}"
- name: Sleep for 1 Minute
run: sleep 60s
shell: bash
- name: Dump v2.8.0 Database
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
run: |
mkdir pgdumpV2_8_0
PGURI=postgres://"${AERIE_USERNAME}":"${AERIE_PASSWORD}"@localhost:5432/aerie \
Expand All @@ -90,21 +96,6 @@ jobs:
docker compose up -d postgres hasura
docker images
docker ps -a
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
POSTGRES_USER: "${{secrets.POSTGRES_USER}}"
POSTGRES_PASSWORD: "${{secrets.POSTGRES_PASSWORD}}"
GATEWAY_USERNAME: "${{secrets.GATEWAY_USERNAME}}"
GATEWAY_PASSWORD: "${{secrets.GATEWAY_PASSWORD}}"
MERLIN_USERNAME: "${{secrets.MERLIN_USERNAME}}"
MERLIN_PASSWORD: "${{secrets.MERLIN_PASSWORD}}"
SCHEDULER_USERNAME: "${{secrets.SCHEDULER_USERNAME}}"
SCHEDULER_PASSWORD: "${{secrets.SCHEDULER_PASSWORD}}"
SEQUENCING_USERNAME: "${{secrets.SEQUENCING_USERNAME}}"
SEQUENCING_PASSWORD: "${{secrets.SEQUENCING_PASSWORD}}"
HASURA_GRAPHQL_ADMIN_SECRET: "${{secrets.HASURA_GRAPHQL_ADMIN_SECRET}}"
HASURA_GRAPHQL_JWT_SECRET: "${{secrets.HASURA_GRAPHQL_JWT_SECRET}}"
- name: Sleep for 30 seconds
run: sleep 30s
shell: bash
Expand All @@ -118,18 +109,12 @@ jobs:
python -m pip install -r requirements.txt
python aerie_db_migration.py --apply --all
cd ..
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
- name: Clone PGCMP
uses: actions/checkout@v4
with:
repository: cbbrowne/pgcmp
repository: NASA-AMMOS/pgcmp
path: pgcmp
- name: Dump Migrated Database
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
run: |
mkdir pgdumpmigrated
PGURI=postgres://"${AERIE_USERNAME}":"${AERIE_PASSWORD}"@localhost:5432/aerie \
Expand Down Expand Up @@ -162,9 +147,17 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Postgres Client (psql)
# ubuntu-latest does not currently have psql-16 in its apt library, so we cannot just run
# sudo apt update && sudo apt-get install --yes postgresql-client-16
# Current instructions are from https://www.postgresql.org/download/linux/ubuntu/
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
sudo apt update
sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update
sudo apt -y install postgresql-client-16
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand All @@ -176,33 +169,15 @@ jobs:
docker compose up -d postgres hasura
docker images
docker ps -a
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
POSTGRES_USER: "${{secrets.POSTGRES_USER}}"
POSTGRES_PASSWORD: "${{secrets.POSTGRES_PASSWORD}}"
GATEWAY_USERNAME: "${{secrets.GATEWAY_USERNAME}}"
GATEWAY_PASSWORD: "${{secrets.GATEWAY_PASSWORD}}"
MERLIN_USERNAME: "${{secrets.MERLIN_USERNAME}}"
MERLIN_PASSWORD: "${{secrets.MERLIN_PASSWORD}}"
SCHEDULER_USERNAME: "${{secrets.SCHEDULER_USERNAME}}"
SCHEDULER_PASSWORD: "${{secrets.SCHEDULER_PASSWORD}}"
SEQUENCING_USERNAME: "${{secrets.SEQUENCING_USERNAME}}"
SEQUENCING_PASSWORD: "${{secrets.SEQUENCING_PASSWORD}}"
HASURA_GRAPHQL_ADMIN_SECRET: "${{secrets.HASURA_GRAPHQL_ADMIN_SECRET}}"
HASURA_GRAPHQL_JWT_SECRET: "${{secrets.HASURA_GRAPHQL_JWT_SECRET}}"
- name: Sleep for 1 Minute
run: sleep 60s
shell: bash
- name: Clone PGCMP
uses: actions/checkout@v4
with:
repository: cbbrowne/pgcmp
repository: NASA-AMMOS/pgcmp
path: pgcmp
- name: Dump Current Database
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
run: |
mkdir pgdumpcurrent
PGURI=postgres://"${AERIE_USERNAME}":"${AERIE_PASSWORD}"@localhost:5432/aerie \
Expand All @@ -227,13 +202,7 @@ jobs:
python -m pip install -r requirements.txt
python aerie_db_migration.py --revert --all
cd ..
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
- name: Dump Migrated Database
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
run: |
mkdir pgdumpmigrateddown
PGURI=postgres://"${AERIE_USERNAME}":"${AERIE_PASSWORD}"@localhost:5432/aerie \
Expand Down Expand Up @@ -267,12 +236,20 @@ jobs:
- name: Clone PGCMP
uses: actions/checkout@v4
with:
repository: cbbrowne/pgcmp
repository: NASA-AMMOS/pgcmp
path: pgcmp
- name: Setup Postgres Client (psql)
# ubuntu-latest does not currently have psql-16 in its apt library, so we cannot just run
# sudo apt update && sudo apt-get install --yes postgresql-client-16
# Current instructions are from https://www.postgresql.org/download/linux/ubuntu/
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
sudo apt update
sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update
sudo apt -y install postgresql-client-16
- name: Start Postgres
run: docker run -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name=postgres postgres:16.2
- name: Sleep for 5 Seconds
Expand Down Expand Up @@ -320,14 +297,22 @@ jobs:
- name: Clone PGCMP
uses: actions/checkout@v4
with:
repository: cbbrowne/pgcmp
repository: NASA-AMMOS/pgcmp
path: pgcmp
- name: Setup Postgres Client (psql)
# ubuntu-latest does not currently have psql-16 in its apt library, so we cannot just run
# sudo apt update && sudo apt-get install --yes postgresql-client-16
# Current instructions are from https://www.postgresql.org/download/linux/ubuntu/
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
sudo apt update
sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update
sudo apt -y install postgresql-client-16
- name: Start Postgres
run: docker run -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name=postgres postgres:14.1
run: docker run -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name=postgres postgres:16.2
- name: Sleep for 5 Seconds
run: sleep 5s
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,35 @@ class CommandExpansionDatabaseTests {
private DatabaseTestHelper helper;
private Connection connection;

private int commandDictionaryId;
private int parcelId;

@BeforeAll
void beforeAll() throws SQLException, IOException, InterruptedException {
helper = new DatabaseTestHelper("command_expansion_test", "Command Expansion Database Tests");
connection = helper.connection();

try (final var statement = connection.createStatement()) {
final var insertDictionary = statement.executeQuery(
//language=sql
"""
insert into sequencing.command_dictionary (dictionary_path, mission,version)
values ('test-path','test-mission','1')
returning id, created_at, updated_at
""");
insertDictionary.next();
commandDictionaryId = insertDictionary.getInt("id");

final var insertParcel = statement.executeQuery(
//language=sql
"""
insert into sequencing.parcel (name, command_dictionary_id)
values ('test-parcel-name','%s')
returning id, created_at, updated_at
""".formatted(Integer.toString(commandDictionaryId)));
insertParcel.next();
parcelId = insertParcel.getInt("id");
}
}

@AfterAll
Expand All @@ -40,13 +65,14 @@ class ExpansionRuleTriggers {
@Test
void shouldModifyUpdatedAtTimeOnUpdate() throws SQLException {
try (final var statement = connection.createStatement()) {

final var insertRes = statement.executeQuery(
//language=sql
"""
insert into sequencing.expansion_rule (activity_type, expansion_logic)
values ('test-activity-type', 'test-activity-logic')
insert into sequencing.expansion_rule (activity_type, expansion_logic,parcel_id)
values ('test-activity-type', 'test-activity-logic','%s')
returning id, created_at, updated_at
""");
""".formatted(Integer.toString(parcelId)));
insertRes.next();
final var id = insertRes.getInt("id");
final var created_at = insertRes.getTimestamp("created_at");
Expand Down
38 changes: 8 additions & 30 deletions deployment/hasura/metadata/actions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ type Mutation {
}

type Mutation {
uploadDictionary(dictionary: String!): CommandDictionaryResponse
uploadDictionary(dictionary: String!, type: String!): DictionaryResponse
}

type Mutation {
addCommandExpansionTypeScript(
activityTypeName: String!
expansionLogic: String!
authoringCommandDictionaryId: Int
parcelId: Int
authoringMissionModelId: Int
): AddCommandExpansionResponse
}

type Mutation {
createExpansionSet(
commandDictionaryId: Int!,
parcelId: Int!,
missionModelId: Int!,
expansionIds: [Int!]!,
description: String,
Expand Down Expand Up @@ -138,35 +138,12 @@ type Query {
getSequenceSeqJsonBulk(inputs: [GetSequenceSeqJsonsInput!]!): [GetSeqJsonResponse!]!
}

type Query {
getUserSequenceSeqJson(commandDictionaryID: Int!, edslBody: String!): GetSeqJsonResponse!
@deprecated(reason: "Use bulk query getUserSequenceSeqJsonBulk instead")
}

input GetUserSequenceSeqJsonBulkInput {
commandDictionaryId: Int!
edslBody: String!
}

type Query {
getUserSequenceSeqJsonBulk(inputs: [GetUserSequenceSeqJsonBulkInput!]!): [GetSeqJsonResponse!]!
}

type GetSeqJsonResponse implements Fallible {
status: FallibleStatus!
errors: [UserCodeError!]!
seqJson: SequenceSeqJson
}

type Query {
getEdslForSeqJson(seqJson: SequenceSeqJson!): String!
@deprecated(reason: "Use bulk query getEdslForSeqJsonBulk instead")
}

type Query {
getEdslForSeqJsonBulk(seqJsons: [SequenceSeqJson!]!): [String!]!
}

enum MerlinSimulationStatus {
complete
failed
Expand Down Expand Up @@ -234,13 +211,14 @@ type TypescriptFile {
content: String
}

type CommandDictionaryResponse {
type DictionaryResponse {
id: Int!
command_types_typescript_path: String!
dictionary_path: String!
mission: String!
version: String!
parsed_json: CommandDictionary!
parsed_json: Dictionary!
created_at: String!
type : String!
}

type ExpansionSetResponse {
Expand Down Expand Up @@ -328,6 +306,6 @@ scalar CommandSeqJson

scalar SequenceSeqJson

scalar CommandDictionary
scalar Dictionary

scalar Any
Loading

0 comments on commit 28adf91

Please sign in to comment.