Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ehclark committed Jan 8, 2024
1 parent 97639d1 commit a098720
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/anyvar/restapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ def register_vrs_object(
tags=[EndpointTag.VARIATIONS],
)
async def annotate_vcf(
request: Request, vcf: UploadFile = File(..., description="VCF to register and annotate"),
allow_async_write: bool = Query(default=False, description="Whether to allow asynchronous write of VRS objects to database"),
request: Request,
vcf: UploadFile = File(..., description="VCF to register and annotate"),
allow_async_write: bool = Query(
default=False, description="Whether to allow asynchronous write of VRS objects to database"
),
):
"""Register alleles from a VCF and return a file annotated with VRS IDs.
Expand Down
9 changes: 6 additions & 3 deletions src/anyvar/storage/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def __delitem__(self, name: str) -> None:
def wait_for_writes(self):
"""Return true once any currently pending database modifications have been completed."""
if self.batch_thread is not None:

# short circuit if the queue is empty
with self.batch_thread.cond:
if len(self.batch_thread.pending_batch_list) == 0:
Expand All @@ -217,12 +216,16 @@ def wait_for_writes(self):
# wait for the batch to be removed from the pending queue
while True:
with self.batch_thread.cond:
if len(list(filter(lambda x: x is batch, self.batch_thread.pending_batch_list))) > 0:
if (
len(
list(filter(lambda x: x is batch, self.batch_thread.pending_batch_list))
)
> 0
):
self.batch_thread.cond.wait()
else:
break


def close(self):
"""Stop the batch thread and wait for it to complete"""
if self.batch_thread is not None:
Expand Down

0 comments on commit a098720

Please sign in to comment.