Skip to content

Commit

Permalink
Merge branch 'main' into test/e2e_test
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagohora authored Sep 24, 2024
2 parents 452a7f0 + 28399a4 commit b079c8a
Show file tree
Hide file tree
Showing 4 changed files with 1,424 additions and 244 deletions.
18 changes: 12 additions & 6 deletions sdks/python/src/opik/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def config_file_fullpath(self) -> pathlib.Path:
def save_to_file(self) -> None:
"""
Save configuration to a file
Raises:
OSError: If there is an issue writing to the file.
"""
config_file_content = configparser.ConfigParser()

Expand All @@ -158,12 +161,15 @@ def save_to_file(self) -> None:
if self.api_key is not None:
config_file_content["opik"]["api_key"] = self.api_key

with open(
self.config_file_fullpath, mode="w+", encoding="utf-8"
) as config_file:
config_file_content.write(config_file)

LOGGER.info(f"Saved configuration to a file: {self.config_file_fullpath}")
try:
with open(
self.config_file_fullpath, mode="w+", encoding="utf-8"
) as config_file:
config_file_content.write(config_file)
LOGGER.info(f"Configuration saved to file: {self.config_file_fullpath}")
except OSError as e:
LOGGER.error(f"Failed to save configuration: {e}")
raise


def update_session_config(key: str, value: Any) -> None:
Expand Down
Loading

0 comments on commit b079c8a

Please sign in to comment.