11import time
22import json
3- import subprocess
43import logging
4+ import subprocess
55from common .r_wrapper import RWrapper
6- from common .decorators import error_logging_aspect
76from common .rate_limiter import RateLimiter
7+ from common .decorators import error_logging_aspect
8+
89
910formatter = 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
0 commit comments