Skip to content

Commit 7cdabae

Browse files
committed
refactor: remove logs
1 parent 2d1fbb9 commit 7cdabae

2 files changed

Lines changed: 4 additions & 21 deletions

File tree

server/workers/metrics/src/metrics.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import time
22
import json
3-
import subprocess
43
import logging
4+
import subprocess
55
from common.r_wrapper import RWrapper
6-
from common.decorators import error_logging_aspect
76
from common.rate_limiter import RateLimiter
7+
from common.decorators import error_logging_aspect
8+
89

910
formatter = logging.Formatter(
1011
fmt='%(asctime)s %(levelname)-8s %(message)s',
@@ -34,8 +35,6 @@ def next_item(self):
3435

3536
@error_logging_aspect(log_level=logging.ERROR)
3637
def execute_search(self, params: dict, metadata: str) -> dict:
37-
self.logger.debug(f"execute_search function running in metrics.py")
38-
3938
command = [
4039
self.command,
4140
self.runner,
@@ -59,26 +58,14 @@ def execute_search(self, params: dict, metadata: str) -> dict:
5958
)
6059
stdout, stderr = proc.communicate(json.dumps(data))
6160

62-
# TODO: Remove after development
63-
self.logger.debug(f"Raw stdout: {stdout}")
64-
self.logger.debug(f"Raw stderr: {stderr}")
65-
6661
output = [line for line in stdout.split('\n') if line]
6762
errors = [line for line in stderr.split('\n') if line]
6863

69-
# TODO: Remove after development
70-
if not output:
71-
raise ValueError("No output received from the subprocess")
72-
if len(output) < 2:
73-
raise ValueError(f"Unexpected output format: {output}")
74-
7564
if not output:
7665
raise ValueError("No output received from the subprocess")
7766

7867
raw_metadata = json.loads(output[-2])
7968

80-
self.logger.debug(f"Raw metadata: {raw_metadata}")
81-
8269
if isinstance(raw_metadata, dict) and raw_metadata.get('status') == "error":
8370
return raw_metadata
8471

server/workers/pubmed/src/pubmed.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
2+
import logging
23
import subprocess
34
import pandas as pd
4-
import logging
55
from common.r_wrapper import RWrapper
66
from common.utils import enrich_metadata
77

@@ -44,8 +44,6 @@ def execute_search(self, params):
4444
source_for_metadata_enrichment = "crossref"
4545

4646
metadata = enrich_metadata(self.redis_store, params, metadata, source_for_metadata_enrichment)
47-
for index, row in metadata.iterrows():
48-
self.logger.debug(f"Title: {row['title']}, DOI: {row['doi']}, Citations: {row.get('citation_count', 'N/A')}")
4947

5048
text = pd.DataFrame(raw_text)
5149

@@ -64,8 +62,6 @@ def execute_search(self, params):
6462
def run(self):
6563
while True:
6664
k, params, endpoint = self.next_item()
67-
self.logger.debug(k)
68-
self.logger.debug(params)
6965
if endpoint == "search":
7066
try:
7167
res = self.execute_search(params)

0 commit comments

Comments
 (0)