Skip to content

Commit

Permalink
fix: default workflows directory (#1919)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahargl authored Sep 15, 2024
1 parent 7e9d06d commit 3ea029e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions keep/api/routes/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,19 @@ def get_random_workflow_templates(
"KEEP_WORKFLOWS_PATH",
os.path.join(os.path.dirname(__file__), "../../../examples/workflows"),
)
if not os.path.exists(default_directory):
# on the container we use the following path
fallback_directory = "/examples/workflows"
logger.warning(
f"{default_directory} does not exist, using fallback: {fallback_directory}"
)
if os.path.exists(fallback_directory):
default_directory = fallback_directory
else:
logger.error(f"Neither {default_directory} nor {fallback_directory} exist")
raise FileNotFoundError(
f"Neither {default_directory} nor {fallback_directory} exist"
)
workflows = workflowstore.get_random_workflow_templates(
tenant_id=tenant_id, workflows_dir=default_directory, limit=6
)
Expand Down

0 comments on commit 3ea029e

Please sign in to comment.