Hi, what is the way to switch namespace when using...
# ask-metaflow
f
Hi, what is the way to switch namespace when using
project
and
branch
in metaflow. For more context, we access artifact generated by flow run of A in another flow B. Usually this works fine unless we want to experiment with B having a new branch. If I do nothing, I get error which I guess is because by default it's trying to use the production namespace. How can we handle it so that for new branch, it will either try to look it up in the branch specific namespace or I can do some error handling and just ignore this and use a default value of artifact from A.
Copy code
Object not in the current namespace:
1
v
namespaces are defined by tags By default,
@project
creates a branch-specific tag and a corresponding namespace and limits visibility to objects in that scope, which is why you can't access artifacts across branches by default (by design)
also
@project
creates a project-level tag of the format,
project:PROJECT_NAME
which covers all branches in that project hence you can switch to that namespace by doing
Copy code
namespace(f'project:{current.project_name}')
...after which you can access runs and artifacts across all branches in that project
let me know if that works
note that you can use that mechanism to be granular as well, as enabling access across all branches may be too broad you could limit access to a specific branch, or you can define a custom tag limiting access to a certain set of branches