Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support switching of METAFLOW_PROFILE on the fly in the client #2274

Open
tuulos opened this issue Feb 14, 2025 · 0 comments
Open

Support switching of METAFLOW_PROFILE on the fly in the client #2274

tuulos opened this issue Feb 14, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@tuulos
Copy link
Collaborator

tuulos commented Feb 14, 2025

currently, Metaflow client loads configuration based on the METAFLOW_PROFILE env var. It is not straightforward to switch between different profiles e.g. in a notebook, as it requires a hard kernel restart to reload a config with a new profile

one can work around the issue with a snippet like this

import os
from multiprocessing import Pool

def latest_run(flow_name):
    from metaflow import Flow
    return Flow(flow_name).latest_run.pathspec

def call(op, args, profile=None):
    os.environ['METAFLOW_PROFILE'] = profile
    with Pool(processes=1) as pool:
        return pool.apply(op, args)

if __name__ == '__main__':
    print(call(latest_run, ('HelloFlow',), profile='local'))
    print(call(latest_run, ('HelloFlow',), profile='mozart'))

but it'd be useful to have support for multiple profiles natively

discussion thread

@tuulos tuulos added the enhancement New feature or request label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant