Skip to content

Commit

Permalink
fix: default to env logger (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
chamini2 authored Sep 18, 2024
1 parent 509b139 commit 47c4a1b
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/isolate/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,17 +323,14 @@ def Submit(
request: definitions.SubmitRequest,
context: ServicerContext,
) -> definitions.SubmitResponse:
logger_labels = request.metadata.logger_labels
if not logger_labels:
logger_labels_dict = {}
else:
logger_labels_dict = dict(logger_labels)

try:
logger = IsolateLogger.with_env_expanded(logger_labels_dict)
except BaseException:
# Ignore the error if the logger couldn't be created.
logger = ENV_LOGGER
logger = ENV_LOGGER
if request.metadata.logger_labels:
logger_labels_dict = dict(request.metadata.logger_labels)
try:
logger = IsolateLogger.with_env_expanded(logger_labels_dict)
except BaseException:
# Ignore the error if the logger couldn't be created.
pass

task = RunTask(request=request.function, logger=logger)
task.future = RUNNER_THREAD_POOL.submit(self._run_task_in_background, task)
Expand Down

0 comments on commit 47c4a1b

Please sign in to comment.