Skip to content

Commit

Permalink
Fix writing trace data to local disk with podman compose up (#245)
Browse files Browse the repository at this point in the history
Signed-off-by: John Matthews <[email protected]>
  • Loading branch information
jwmatthews authored Jul 23, 2024
1 parent be0a3e8 commit 0ba9e33
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions kai/trace.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import json
import logging
import os
from time import localtime, strftime
from typing import Any

from langchain.schema.messages import BaseMessage

from kai.kai_logging import process_log_dir_replacements
from kai.models.kai_config import KaiConfig

log = logging.getLogger(__name__)


def enabled_check(func):
def wrapper(obj, *args, **kwargs):
Expand Down Expand Up @@ -49,10 +53,9 @@ def __init__(
self.time_start = -1
self.time_end = -1

# TODO: Specify trace directory in config
self.top_trace_dir = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "../logs/trace"
)
# We use the same parent directory of logging for trace data
log_dir = process_log_dir_replacements(self.config.log_dir)
self.top_trace_dir = os.path.join(log_dir, "trace")

self.trace_dir = os.path.join(
self.top_trace_dir, model_id, application_name, file_name, batch_mode
Expand Down

0 comments on commit 0ba9e33

Please sign in to comment.