Skip to content

Commit ade0b99

Browse files
authored
Fix issue with cards when .metaflow exists in a *parent* directory (#2641)
1 parent 8484f72 commit ade0b99

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

metaflow/plugins/cards/card_datastore.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
"""
2-
3-
"""
4-
51
from collections import namedtuple
62
from io import BytesIO
73
import os
@@ -67,20 +63,18 @@ def get_storage_root(cls, storage_type):
6763
result = CARD_LOCALROOT
6864
if result is None:
6965
current_path = os.getcwd()
70-
check_dir = os.path.join(current_path, DATASTORE_LOCAL_DIR, CARD_SUFFIX)
66+
check_dir = os.path.join(current_path, DATASTORE_LOCAL_DIR)
7167
check_dir = os.path.realpath(check_dir)
7268
orig_path = check_dir
7369
while not os.path.isdir(check_dir):
7470
new_path = os.path.dirname(current_path)
7571
if new_path == current_path:
76-
break # We are no longer making upward progress
72+
# No longer making upward progress so we
73+
# return the top level path
74+
return os.path.join(orig_path, CARD_SUFFIX)
7775
current_path = new_path
78-
check_dir = os.path.join(
79-
current_path, DATASTORE_LOCAL_DIR, CARD_SUFFIX
80-
)
81-
result = orig_path
82-
83-
return result
76+
check_dir = os.path.join(current_path, DATASTORE_LOCAL_DIR)
77+
return os.path.join(check_dir, CARD_SUFFIX)
8478
else:
8579
# Let's make it obvious we need to update this block for each new datastore backend...
8680
raise NotImplementedError(

0 commit comments

Comments
 (0)