Skip to content

Commit fc3391c

Browse files
author
Daniel Hegeman
authored
Merge branch 'main' into mim/5916-get-tombstoned
2 parents 66b9cb0 + c5075ea commit fc3391c

File tree

204 files changed

+4282
-6317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+4282
-6317
lines changed

.github/workflows/build-images-and-create-deployment.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ on:
44
push:
55
branches:
66
- main
7-
- staging
87
- prod
98
repository_dispatch:
10-
types: [build-images]
9+
types: [build-images-for-staging]
1110
env:
1211
# Force using BuildKit instead of normal Docker, required so that metadata
1312
# is written/read to allow us to use layers of previous builds as cache.
@@ -16,11 +15,6 @@ env:
1615
DOCKER_REPO: ${{ secrets.ECR_REPO }}/
1716
GITHUB_BRANCH: ${{ github.event.client_payload.ref || github.ref }}
1817

19-
# add a concurrency group to prevent multiple builds from running at the same time
20-
concurrency:
21-
group: ${{ github.event.client_payload.ref || github.ref }}-environment
22-
cancel-in-progress: false
23-
2418
permissions:
2519
id-token: write
2620
contents: read

.github/workflows/deploy-happy-stack.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ name: Deploy Happy
22

33
on: deployment
44

5-
# add a concurrency group to prevent multiple builds from running at the same time
6-
concurrency:
7-
group: ${{ github.ref }}-environment
8-
cancel-in-progress: false
9-
105
env:
116
DOCKER_BUILDKIT: 1
127
COMPOSE_DOCKER_CLI_BUILD: 1

.github/workflows/push-tests.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ on:
88
branches:
99
- "main"
1010

11-
# add a concurrency group to prevent multiple builds from running at the same time
12-
concurrency:
13-
group: ${{ github.ref }}-environment
14-
cancel-in-progress: false
15-
1611
env:
1712
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1813
DEPLOYMENT_STAGE: test

.github/workflows/test-receiving-repository-dispatch.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/test-sending-repository-dispatch.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/test-workflow-run-after-push-tests-pass.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/trigger-release-candidate-build-and-deploy.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
name: Trigger release candidate build and deploy
22

33
on:
4-
push:
4+
workflow_run:
5+
workflows:
6+
- "Push Tests"
7+
types:
8+
- completed
59
branches:
610
- main
711

812
jobs:
9-
continuous_deploy_to_staging:
13+
deploy_to_stage_env_on_test_pass_on_main:
1014
runs-on: ubuntu-latest
15+
# deployment to staging is only triggered if dependent workflow ("Push Tests")
16+
# pass successfully
17+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1118
steps:
1219
- name: Checkout main branch
1320
uses: actions/checkout@v2
@@ -44,5 +51,15 @@ jobs:
4451
uses: peter-evans/repository-dispatch@v2
4552
with:
4653
token: ${{ secrets.GITHUB_TOKEN }}
47-
event-type: build-images
54+
event-type: build-images-for-staging
4855
client-payload: '{"ref": "refs/heads/staging"}'
56+
57+
- name: Send slack notification if main not merged into staging
58+
if: failure()
59+
uses: 8398a7/action-slack@v3
60+
with:
61+
status: ${{ job.status }}
62+
fields: repo,commit,author,eventName,workflow,job,mention
63+
mention: "here"
64+
env:
65+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

.happy/terraform/envs/dev/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ module stack {
1616
batch_container_memory_limit = 28000
1717
wmg_batch_container_memory_limit = 248000
1818
wmg_desired_vcpus = 128
19-
cg_desired_vcpus = 48
20-
cg_batch_container_memory_limit = 92000
19+
cg_desired_vcpus = 128
20+
cg_batch_container_memory_limit = 248000
2121
backend_memory = 8192
2222
frontend_memory = 4096
2323
backend_instance_count = 4

.happy/terraform/envs/prod/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ module stack {
1616
batch_container_memory_limit = 63500
1717
wmg_batch_container_memory_limit = 248000
1818
wmg_desired_vcpus = 128
19-
cg_desired_vcpus = 48
20-
cg_batch_container_memory_limit = 92000
19+
cg_desired_vcpus = 128
20+
cg_batch_container_memory_limit = 248000
2121
backend_memory = 30 * 1024
2222
frontend_memory = 4096
2323
backend_instance_count = 6

.happy/terraform/envs/stage/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ module stack {
1616
batch_container_memory_limit = 63500
1717
wmg_batch_container_memory_limit = 248000
1818
wmg_desired_vcpus = 128
19-
cg_batch_container_memory_limit = 92000
20-
cg_desired_vcpus = 48
19+
cg_batch_container_memory_limit = 248000
20+
cg_desired_vcpus = 128
2121
backend_memory = 8192
2222
frontend_memory = 4096
2323
backend_instance_count = 4

.happy/terraform/modules/schema_migration/main.tf

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,59 @@ resource aws_batch_job_definition schema_migrations {
113113
})
114114
}
115115

116+
resource aws_batch_job_definition pubish_revisions {
117+
type = "container"
118+
name = "dp-${var.deployment_stage}-${var.custom_stack_name}-${local.name}-publish-revisions"
119+
container_properties = jsonencode({
120+
command = ["python3",
121+
"-m",
122+
"backend.layers.processing.publish_revisions",
123+
],
124+
jobRoleArn= var.batch_role_arn,
125+
image= var.image,
126+
environment= [
127+
{
128+
name= "ARTIFACT_BUCKET",
129+
value= var.artifact_bucket
130+
},
131+
{
132+
name= "DEPLOYMENT_STAGE",
133+
value= var.deployment_stage
134+
},
135+
{
136+
name= "AWS_DEFAULT_REGION",
137+
value= data.aws_region.current.name
138+
},
139+
{
140+
name= "REMOTE_DEV_PREFIX",
141+
value= var.remote_dev_prefix
142+
},
143+
{
144+
name= "DATASETS_BUCKET",
145+
value= var.datasets_bucket
146+
},
147+
],
148+
resourceRequirements = [
149+
{
150+
type= "VCPU",
151+
Value="2"
152+
},
153+
{
154+
Type="MEMORY",
155+
Value = "4096"
156+
}
157+
]
158+
logConfiguration= {
159+
logDriver= "awslogs",
160+
options= {
161+
awslogs-group= aws_cloudwatch_log_group.batch_cloud_watch_logs_group.id,
162+
awslogs-region= data.aws_region.current.name
163+
}
164+
}
165+
})
166+
}
167+
168+
116169
resource aws_sfn_state_machine sfn_schema_migration {
117170
name = "dp-${var.deployment_stage}-${var.custom_stack_name}-${local.name}-sfn"
118171
role_arn = var.sfn_role_arn

.happy/terraform/modules/sfn/main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ resource "aws_sfn_state_machine" "state_machine" {
5858
},
5959
{
6060
"Name": "DATASET_ID",
61-
"Value.$": "$.dataset_id"
61+
"Value.$": "$.dataset_id"
62+
},
63+
{
64+
"Name": "COLLECTION_ID",
65+
"Value.$": "$.collection_id"
6266
},
6367
{
6468
"Name": "STEP_NAME",

Dockerfile.wmg_pipeline

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ ADD backend/wmg/__init__.py backend/wmg/__init__.py
1919
ADD backend/wmg/config.py backend/wmg/config.py
2020
ADD backend/wmg/data backend/wmg/data
2121
ADD backend/wmg/pipeline backend/wmg/pipeline
22+
ADD backend/wmg/api backend/wmg/api
23+
ADD backend/cellguide/pipeline backend/cellguide/pipeline
2224
ADD backend/layers backend/layers
2325
ADD backend/common backend/common
2426

@@ -29,4 +31,4 @@ LABEL commit=${HAPPY_COMMIT}
2931
ENV COMMIT_SHA=${HAPPY_COMMIT}
3032
ENV COMMIT_BRANCH=${HAPPY_BRANCH}
3133

32-
CMD ["python3", "-m", "backend.wmg.pipeline.cube_pipeline"]
34+
CMD ["python3", "-m", "backend.wmg.pipeline"]

backend/cellguide/pipeline/computational_marker_genes/__init__.py

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import logging
22

3-
from backend.cellguide.pipeline.computational_marker_genes.computational_markers import MarkerGenesCalculator
4-
from backend.cellguide.pipeline.computational_marker_genes.constants import MARKER_SCORE_THRESHOLD
3+
from backend.cellguide.pipeline.computational_marker_genes.computational_markers import (
4+
MARKER_SCORE_THRESHOLD,
5+
MarkerGenesCalculator,
6+
)
57
from backend.cellguide.pipeline.constants import COMPUTATIONAL_MARKER_GENES_FOLDERNAME, MARKER_GENE_PRESENCE_FILENAME
68
from backend.cellguide.pipeline.ontology_tree import get_ontology_tree_builder
79
from backend.cellguide.pipeline.ontology_tree.tree_builder import OntologyTreeBuilder
@@ -61,6 +63,29 @@ def get_computational_marker_genes(*, snapshot: WmgSnapshot, ontology_tree: Onto
6163
else:
6264
marker_genes[key] = marker_genes_per_tissue[key]
6365

66+
# convert all groupby_dims IDs to labels as required by CellGuide
67+
organism_id_to_name = {k: v for d in snapshot.primary_filter_dimensions["organism_terms"] for k, v in d.items()}
68+
tissue_id_to_name = {
69+
k: v
70+
for organism in snapshot.primary_filter_dimensions["tissue_terms"]
71+
for i in snapshot.primary_filter_dimensions["tissue_terms"][organism]
72+
for k, v in i.items()
73+
}
74+
for _, marker_gene_stats_list in marker_genes.items():
75+
for marker_gene_stats in marker_gene_stats_list:
76+
groupby_dims = marker_gene_stats.groupby_dims
77+
groupby_terms = list(groupby_dims.keys())
78+
groupby_term_labels = [term.rsplit("_", 1)[0] + "_label" for term in groupby_terms]
79+
groupby_dims_new = dict(zip(groupby_term_labels, (groupby_dims[term] for term in groupby_terms)))
80+
81+
for key in groupby_dims_new:
82+
if key == "tissue_ontology_term_label":
83+
groupby_dims_new[key] = tissue_id_to_name.get(groupby_dims_new[key], groupby_dims_new[key])
84+
elif key == "organism_ontology_term_label":
85+
groupby_dims_new[key] = organism_id_to_name.get(groupby_dims_new[key], groupby_dims_new[key])
86+
87+
marker_gene_stats.groupby_dims = groupby_dims_new
88+
6489
reformatted_marker_genes = {}
6590
for cell_type_id, marker_gene_stats_list in marker_genes.items():
6691
for marker_gene_stats in marker_gene_stats_list:
@@ -87,11 +112,11 @@ def get_computational_marker_genes(*, snapshot: WmgSnapshot, ontology_tree: Onto
87112
)
88113
reformatted_marker_genes[symbol][organism][tissue].append(data)
89114

90-
# assert that cell types do not appear multiple times in each gene, tissue, organism
91-
for symbol in reformatted_marker_genes:
92-
for organism in reformatted_marker_genes[symbol]:
93-
for tissue in reformatted_marker_genes[symbol][organism]:
94-
cell_type_ids = [i["cell_type_id"] for i in reformatted_marker_genes[symbol][organism][tissue]]
95-
assert len(cell_type_ids) == len(list(set(cell_type_ids)))
115+
# # assert that cell types do not appear multiple times in each gene, tissue, organism
116+
# for symbol in reformatted_marker_genes:
117+
# for organism in reformatted_marker_genes[symbol]:
118+
# for tissue in reformatted_marker_genes[symbol][organism]:
119+
# cell_type_ids = [i["cell_type_id"] for i in reformatted_marker_genes[symbol][organism][tissue]]
120+
# assert len(cell_type_ids) == len(list(set(cell_type_ids)))
96121

97122
return marker_genes, reformatted_marker_genes

0 commit comments

Comments
 (0)