Skip to content

[PR-512] Added req_id in debug mode in logger #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions clarifai/runners/models/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from clarifai_protocol import BaseRunner
from clarifai_protocol.utils.health import HealthProbeRequestHandler

from clarifai.utils.logging import logger

from ..utils.url_fetcher import ensure_urls_downloaded
from .model_class import ModelClass

Expand Down Expand Up @@ -84,6 +86,9 @@ def runner_item_predict(
ensure_urls_downloaded(request)

resp = self.model.predict_wrapper(request)
logger.debug(
f'Request_id: {request.status.req_id}, ',
)
if resp.status.code != status_code_pb2.SUCCESS:
return service_pb2.RunnerItemOutput(multi_output_response=resp)
successes = [o.status.code == status_code_pb2.SUCCESS for o in resp.outputs]
Expand Down Expand Up @@ -117,6 +122,9 @@ def runner_item_generate(
ensure_urls_downloaded(request)

for resp in self.model.generate_wrapper(request):
logger.debug(
f'Request_id: {request.status.req_id}, ',
)
if resp.status.code != status_code_pb2.SUCCESS:
yield service_pb2.RunnerItemOutput(multi_output_response=resp)
continue
Expand Down Expand Up @@ -151,6 +159,9 @@ def runner_item_stream(
) -> Iterator[service_pb2.RunnerItemOutput]:
# Call the generate() method the underlying model implements.
for resp in self.model.stream_wrapper(pmo_iterator(runner_item_iterator)):
logger.debug(
f'Request_id: {resp.status.req_id}, ',
)
if resp.status.code != status_code_pb2.SUCCESS:
yield service_pb2.RunnerItemOutput(multi_output_response=resp)
continue
Expand Down
Loading