You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
get_cards(pathspec_string) silently resets the global client namespace to None #3395
metaflow.cards.get_cards() calls namespace(None) when it's given a task pathspec string (metaflow/plugins/cards/card_client.py, in get_cards). The call is global and never undone, so after get_cards("MyFlow/123/start/4") the caller's namespace is None. Every later client query in that notebook or script (Flow(...).latest_run, .runs(), Run(...)) then returns objects from all namespaces instead of the one the user picked.
Repro (local metadata/datastore), after running any flow with a @card step as another user:
frommetaflowimportFlow, namespace, get_namespacefrommetaflow.cardsimportget_cardsnamespace("user:someone-else")
get_cards("CardNsFlow/<run_id>/start/1") # run owned by another userprint(get_namespace()) # -> None (expected "user:someone-else")print(Flow("CardNsFlow").latest_run) # -> Run(...) instead of MetaflowNamespaceMismatch
Expected: get_cards finds the card but leaves the caller's namespace unchanged.
Proposed fix: replace the global namespace(None) with Task(task_str, _namespace_check=False), and pass _namespace_check=False on the two origin-task lookups used for resumed runs (get_cards and card_resolver._chase_origin). Those two lookups currently depend on the global None. This matches how Task.metadata already follows origin tasks. I have a small fix with a regression test and will link a PR.
Activity