Skip to content

Commit

Permalink
parallel queries
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Jul 5, 2024
1 parent 34f6dad commit 627b427
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 178 deletions.
5 changes: 4 additions & 1 deletion beacon/db/g_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from beacon.request.model import AlphanumericFilter, Operator, RequestParams
from beacon.db import client
import yaml
import time
from aiohttp import web


Expand Down Expand Up @@ -238,6 +239,7 @@ def apply_request_parameters(query: Dict[str, List[dict]], qparams: RequestParam


def get_variants(entry_id: Optional[str], qparams: RequestParams, dataset: str):
LOG.debug(time.time())
collection = 'g_variants'
mongo_collection = client.beacon.genomicVariations
parameters_as_filters=False
Expand Down Expand Up @@ -267,7 +269,8 @@ def get_variants(entry_id: Optional[str], qparams: RequestParams, dataset: str):
datasets_dict = yaml.safe_load(datasets_file)
#LOG.debug(query)
count, dataset_count, docs = get_docs_by_response_type(include, query, datasets_dict, dataset, limit, skip, mongo_collection, idq)
return schema, count, dataset_count, docs
LOG.debug(time.time())
return schema, count, dataset_count, docs, dataset


def get_variant_with_id(entry_id: Optional[str], qparams: RequestParams, dataset: str):
Expand Down
4 changes: 3 additions & 1 deletion beacon/db/individuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from beacon.db.utils import query_id, get_count, get_documents
from beacon.request.model import RequestParams
from beacon.db.g_variants import apply_request_parameters
import time
import yaml
from aiohttp import web

Expand All @@ -18,6 +19,7 @@ def include_resultset_responses(query: Dict[str, List[dict]], qparams: RequestPa
return query

def get_individuals(entry_id: Optional[str], qparams: RequestParams, dataset: str):
LOG.debug(time.time())
collection = 'individuals'
mongo_collection = client.beacon.individuals
parameters_as_filters=False
Expand Down Expand Up @@ -45,7 +47,7 @@ def get_individuals(entry_id: Optional[str], qparams: RequestParams, dataset: st
limit = 100
idq="id"
count, dataset_count, docs = get_docs_by_response_type(include, query, datasets_dict, dataset, limit, skip, mongo_collection, idq)
return schema, count, dataset_count, docs
return schema, count, dataset_count, docs, dataset


def get_individual_with_id(entry_id: Optional[str], qparams: RequestParams, dataset: str):
Expand Down
Loading

0 comments on commit 627b427

Please sign in to comment.