diff --git a/settings.toml b/settings.toml index 0dd7968..f84d438 100644 --- a/settings.toml +++ b/settings.toml @@ -4,4 +4,3 @@ sqlite_db = "sqlite:///backend.db" n_workers = 1 [indirect_gwas] -batch_size = 10000 diff --git a/src/webgwas_backend/config.py b/src/webgwas_backend/config.py index b068fbf..f4ac0cb 100644 --- a/src/webgwas_backend/config.py +++ b/src/webgwas_backend/config.py @@ -4,12 +4,12 @@ from typing import Any from dynaconf import Dynaconf -from pydantic import BaseModel, Field +from pydantic import BaseModel from pydantic_settings import BaseSettings class IndirectGWASSettings(BaseModel): - batch_size: int = Field(10000, description="Batch size (in variants)") + pass class Settings(BaseSettings): diff --git a/src/webgwas_backend/igwas_handler.py b/src/webgwas_backend/igwas_handler.py index 034c6cc..f3e41bd 100644 --- a/src/webgwas_backend/igwas_handler.py +++ b/src/webgwas_backend/igwas_handler.py @@ -49,7 +49,7 @@ def get_igwas_coef(request: WebGWASRequestID) -> Series: def handle_igwas( - request: WebGWASRequestID, dry_run: bool, s3_bucket: str, batch_size: int + request: WebGWASRequestID, dry_run: bool, s3_bucket: str ) -> WebGWASResult: beta_series = get_igwas_coef(request) cov_path = pathlib.Path(request.cohort.root_directory).joinpath( @@ -69,7 +69,6 @@ def handle_igwas( gwas_result_path=gwas_path.as_posix(), output_file_path=output_file_path.as_posix(), num_covar=request.cohort.num_covar, - batch_size=batch_size, ) except Exception as e: raise HTTPException( diff --git a/src/webgwas_backend/test_main.py b/src/webgwas_backend/test_main.py index 1273744..6e6672c 100644 --- a/src/webgwas_backend/test_main.py +++ b/src/webgwas_backend/test_main.py @@ -135,7 +135,7 @@ def client(): s3_bucket="TEST", sqlite_db=":memory:", n_workers=2, - indirect_gwas=IndirectGWASSettings(batch_size=10000), + indirect_gwas=IndirectGWASSettings(), ) worker = TestWorker(settings) diff --git a/src/webgwas_backend/worker.py b/src/webgwas_backend/worker.py index 200ceb1..557d069 100644 --- a/src/webgwas_backend/worker.py +++ b/src/webgwas_backend/worker.py @@ -15,7 +15,6 @@ class Worker: def __init__(self, settings: Settings): self.s3_dry_run = settings.dry_run self.s3_bucket = settings.s3_bucket - self.batch_size = settings.indirect_gwas.batch_size self.manager = Manager() self.lock = self.manager.Lock() @@ -30,16 +29,13 @@ def submit(self, request: WebGWASRequestID): request, self.s3_dry_run, self.s3_bucket, - self.batch_size, ) logger.info(f"Queued request: {request.id}") @staticmethod - def handle_request( - request: WebGWASRequestID, dry_run: bool, s3_bucket: str, batch_size: int - ): + def handle_request(request: WebGWASRequestID, dry_run: bool, s3_bucket: str): try: - return handle_igwas(request, dry_run, s3_bucket, batch_size) + return handle_igwas(request, dry_run, s3_bucket) except Exception as e: return WebGWASResult( request_id=request.id, status="error", error_msg=f"{e}" @@ -67,14 +63,11 @@ class TestWorker(Worker): def __init__(self, settings: Settings): self.s3_dry_run = settings.dry_run self.s3_bucket = settings.s3_bucket - self.batch_size = settings.indirect_gwas.batch_size self.id_to_result: dict[str, WebGWASResult] = {} def submit(self, request: WebGWASRequestID): logger.info(f"Submitting request: {request}") - result = self.handle_request( - request, self.s3_dry_run, self.s3_bucket, self.batch_size - ) + result = self.handle_request(request, self.s3_dry_run, self.s3_bucket) self.id_to_result[request.id] = result logger.info(f"Queued request: {request.id}")