Skip to content

Commit

Permalink
Merge pull request #879 from InfuseAI/feature/sc-32247/chore-fallback…
Browse files Browse the repository at this point in the history
…-to-use-temp-folder-to-store

[Chore] sc-32247 Fallback to use temp folder to store profile.yml
  • Loading branch information
kentwelcome authored Sep 7, 2023
2 parents 47999a3 + 8fdfef8 commit e6ccc5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions piperider_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import re
import sys
import tempfile
import webbrowser
from datetime import datetime

Expand All @@ -11,6 +12,9 @@
from ruamel import yaml

PIPERIDER_USER_HOME = os.path.expanduser('~/.piperider')
if os.access(os.path.expanduser('~/'), os.W_OK) is False:
# If we can't create file in user home directory, fallback to use temp folder
PIPERIDER_USER_HOME = os.path.join(tempfile.gettempdir(), '.piperider')
PIPERIDER_USER_PROFILE = os.path.join(PIPERIDER_USER_HOME, 'profile.yml')


Expand Down
3 changes: 1 addition & 2 deletions piperider_cli/event/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from rich.console import Console
from ruamel import yaml

from piperider_cli import PIPERIDER_USER_HOME, PIPERIDER_USER_PROFILE
from piperider_cli.event.collector import Collector

PIPERIDER_USER_HOME = os.path.expanduser('~/.piperider')
PIPERIDER_USER_PROFILE = os.path.join(PIPERIDER_USER_HOME, 'profile.yml')
PIPERIDER_USER_EVENT_PATH = os.path.join(PIPERIDER_USER_HOME, '.unsend_events.json')
PIPERIDER_FLUSH_EVENTS_WHITELIST = ['init', 'run', 'generate-report', 'compare-reports']

Expand Down

0 comments on commit e6ccc5d

Please sign in to comment.