Skip to content

Commit 7addbe4

Browse files
authored
Merge pull request #44 from broadinstitute/ew-remove-firestore-emulator
Remove Firestore emulator [SCP-1968]
2 parents 36544aa + 4371fce commit 7addbe4

File tree

12 files changed

+106
-150
lines changed

12 files changed

+106
-150
lines changed

.circleci/config.yml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,9 @@ jobs:
2020
# Download and cache dependencies
2121
- restore_cache:
2222
keys:
23-
- v2-dependencies-{{ checksum "requirements.txt" }}
23+
- v3-dependencies-{{ checksum "requirements.txt" }}
2424
# fallback to using the latest cache if no exact match is found
25-
- v2-dependencies-
26-
27-
- run:
28-
name: Install Firestore emulator
29-
command: |
30-
# Add the Cloud SDK distribution URI as a package source
31-
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
32-
33-
# Import the Google Cloud Platform public key
34-
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
35-
36-
# Enable `add-apt-repository` command
37-
sudo apt-get --yes install software-properties-common
38-
39-
# Enable installation of OpenJDK, needed by gcloud
40-
sudo add-apt-repository --yes ppa:openjdk-r/ppa
41-
42-
# Update the package list and install the Cloud SDK
43-
sudo apt-get --yes update && sudo apt-get --yes install google-cloud-sdk
44-
sudo apt-get --yes install google-cloud-sdk google-cloud-sdk-firestore-emulator
25+
- v3-dependencies-
4526

4627
- run:
4728
name: Install Python dependencies
@@ -54,14 +35,11 @@ jobs:
5435
- save_cache:
5536
paths:
5637
- ./venv
57-
key: v2-dependencies-{{ checksum "requirements.txt" }}
38+
key: v3-dependencies-{{ checksum "requirements.txt" }}
5839

5940
- run:
6041
name: Run tests
6142
command: |
62-
env
63-
gcloud beta emulators firestore start --host-port localhost:8081 &
64-
export FIRESTORE_EMULATOR_HOST=localhost:8081
6543
. venv/bin/activate
6644
cd tests
6745
pytest --cov-report=xml --cov=../ingest/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ __pycache__/
1313
*.log
1414
.DS_Store
1515
.coverage
16+
coverage.xml
17+
issues.json
1618
htmlcov/

ingest/ingest_pipeline.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,14 @@ def __init__(
7373
subsample=False,
7474
ingest_cell_metadata=False,
7575
ingest_cluster=False,
76-
db=None,
7776
**kwargs,
7877
):
7978
"""Initializes variables in ingest service."""
8079
self.file_id = file_id
8180
self.study_accession = study_accession
8281
self.matrix_file = matrix_file
8382
self.matrix_file_type = matrix_file_type
84-
if db is not None:
85-
self.db = db
86-
else:
87-
self.db = firestore.Client()
83+
self.db = firestore.Client()
8884
self.cluster_file = cluster_file
8985
self.kwargs = kwargs
9086
self.cell_metadata_file = cell_metadata_file

tests/gcp_mocks.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,10 @@ def download_to_filename(self, filename):
5353
copyfile(self.name, filename)
5454

5555
return MockStorageBlob(*args, **kwargs)
56+
57+
58+
def mock_firestore_client():
59+
"""Mocks firestore.Client() by returning nothing upon initializing client
60+
See notes in mock_load_expression_data for context.
61+
"""
62+
return

tests/gene_model_0.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{'name': 'RPP25L', 'gene_id': 'ENSG00000164967', 'source_file_type': ('Mtx',), 'cell_names': ['AACGTTGGTTAAAGTG-1'], 'expression_scores': [1.0], 'subdocument': {'cell_names': ['AACGTTGGTTAAAGTG-1'], 'expression_scores': [1.0], 'source_file_type': 'Mtx'}, 'top_level_doc': {'file_id': '1234abc', 'searchable_name': 'rpp25l', 'name': 'RPP25L',
2+
'gene_id': 'ENSG00000164967', 'study_accession': 'SCP1', 'taxon_name': 'Homo sapiens', 'taxon_common_name': 'human', 'ncbi_taxid': '9606', 'genome_assembly_accession': 'GCA_000001405.15', 'genome_annotation': 'Ensembl 94'}}

tests/mock_data/dense_matrix_19_genes_100k_cells_txt/gene_doc_0.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{'name': 'A1BG', 'gene_id': None, 'source_file_type': ('Dense',), 'cell_names': ['"Granuloma10_270"', '"Granuloma10_902"', '"Granuloma5_1043"', '"Granuloma5_316"'], 'expression_scores': [0.602, 1.934, 1.161, 0.82], 'subdocument': {'cell_names': ['"Granuloma10_270"', '"Granuloma10_902"', '"Granuloma5_1043"', '"Granuloma5_316"'], 'expression_scores': [0.602, 1.934, 1.161, 0.82], 'source_file_type': 'Dense'}, 'top_level_doc': {'file_id': '1234abc', 'searchable_name': 'a1bg', 'name': 'A1BG', 'gene_id': None, 'study_accession': 'SCP1', 'taxon_name': 'Homo sapiens', 'taxon_common_name': 'human', 'ncbi_taxid': '9606', 'genome_assembly_accession': 'GCA_000001405.15', 'genome_annotation': 'Ensembl 94'}}

tests/mock_data/loom/gene_doc_0.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{'name': 'A2M', 'gene_id': None, 'source_file_type': ('loom',), 'cell_names': ['BM01_16dpp_AAGCAGTGGTAT', 'BM01_16dpp_TAAGCAGTGGTA', 'BM01_16dpp_CTAAGCAGTGGT', 'BM01_16dpp_CGGTAAACCATT', 'BM01_16dpp_CCGAATTCACCG'], 'expression_scores': [-0.191, -0.191, 2.646, -0.191, -0.191], 'subdocument': {'cell_names': ['BM01_16dpp_AAGCAGTGGTAT', 'BM01_16dpp_TAAGCAGTGGTA', 'BM01_16dpp_CTAAGCAGTGGT', 'BM01_16dpp_CGGTAAACCATT', 'BM01_16dpp_CCGAATTCACCG'], 'expression_scores': [-0.191, -0.191, 2.646, -0.191, -0.191], 'source_file_type': 'loom'}, 'top_level_doc': {'file_id': '1234abc', 'searchable_name': 'a2m', 'name': 'A2M', 'gene_id': None, 'study_accession': 'SCP1', 'taxon_name': 'Homo Sapiens', 'taxon_common_name': 'human', 'ncbi_taxid': '9606', 'genome_assembly_accession': 'GCA_000001405.15', 'genome_annotation': 'Ensemble 94'}}

tests/mock_data/matrix_mtx/gene_doc_0.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)