add logging
This commit is contained in:
parent
41d4934cc1
commit
4d93c22bd2
@ -23,7 +23,7 @@ IMAGE_CONFIG = Config(CONFIG_FILE)
|
|||||||
LOG_FORMAT = "%(asctime)s [%(levelname)s] - [%(filename)s -> %(funcName)s() -> %(lineno)s] : %(message)s"
|
LOG_FORMAT = "%(asctime)s [%(levelname)s] - [%(filename)s -> %(funcName)s() -> %(lineno)s] : %(message)s"
|
||||||
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
|
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger("main")
|
||||||
logger.setLevel("DEBUG")
|
logger.setLevel("DEBUG")
|
||||||
|
|
||||||
stream_handler = logging.StreamHandler(sys.stdout)
|
stream_handler = logging.StreamHandler(sys.stdout)
|
||||||
@ -49,6 +49,7 @@ def process_request(request_message):
|
|||||||
bucket = PYINFRA_CONFIG.storage_bucket
|
bucket = PYINFRA_CONFIG.storage_bucket
|
||||||
storage = get_storage(PYINFRA_CONFIG)
|
storage = get_storage(PYINFRA_CONFIG)
|
||||||
|
|
||||||
|
logger.debug("loading model pipeline")
|
||||||
pipeline = load_pipeline(verbose=IMAGE_CONFIG.service.verbose, batch_size=IMAGE_CONFIG.service.batch_size)
|
pipeline = load_pipeline(verbose=IMAGE_CONFIG.service.verbose, batch_size=IMAGE_CONFIG.service.batch_size)
|
||||||
|
|
||||||
if storage.exists(bucket, target_file_name):
|
if storage.exists(bucket, target_file_name):
|
||||||
@ -66,6 +67,7 @@ def process_request(request_message):
|
|||||||
classifications_cv = []
|
classifications_cv = []
|
||||||
|
|
||||||
result = {**request_message, "data": classifications, "dataCV": classifications_cv}
|
result = {**request_message, "data": classifications, "dataCV": classifications_cv}
|
||||||
|
logger.debug("returning/storing results:\n\t%s", result)
|
||||||
storage_bytes = gzip.compress(json.dumps(result).encode("utf-8"))
|
storage_bytes = gzip.compress(json.dumps(result).encode("utf-8"))
|
||||||
storage.put_object(bucket, response_file_name, storage_bytes)
|
storage.put_object(bucket, response_file_name, storage_bytes)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user