flaky-plumber-70709
06/02/2023, 8:11 PM@conda_base(disabled=True)
class CondaQFlow(FlowSpec):
@conda(libraries={'pandas':'1.5.3'})
@step
def start(self):
import pandas as pd
print(pd.__version__)
self.next(self.end)
@step
def end(self):
import pandas as pd
print(pd.__version__)
if __name__ == "__main__":
CondaQFlow()
For me this outputs 2.0.2 for both steps. If I were to specify a different pandas version in conda_base, then that version would correctly get picked up in the end step and start would output 1.5.3. I know I can get the desired behavior by putting @conda(disabled=True) at the end step but for long flows with a lot of steps my OCD gets triggered a bit by having to put @conda everywhere.
I support a few teams using metaflow and this pops up pretty frequently when onboarding new metaflowers. They expect the default behavior to be @conda(disabled=True) for steps where they don't use the decorator.flaky-plumber-70709
06/02/2023, 8:14 PMconda_basevictorious-lawyer-58417
06/04/2023, 5:04 AM--environment=conda enables @conda on all steps, so you have to disable it explicitly to expose outside packages to steps.
This is intentional - the idea with --environment=conda is to control all dependencies tightly. If it wasn't like this, every user might get a different result when they execute the flow in their environment that contains a bespoke set of packages, which could be surprising toovictorious-lawyer-58417
06/04/2023, 5:13 AM@conda_base
• Add @conda() to all steps that need the common packages. You can add additional step-level packages too.
• Leave steps that don't need the common packages without a decorator.
Now you can run/deploy the code --with conda:disabled=True - this will disable conda in all steps that don't have a decorator specified, which achieves this outcome:
They expect the default behavior to befor steps where they don't use the decorator.@conda(disabled=True)
victorious-lawyer-58417
06/04/2023, 5:14 AMexport METAFLOW_DECOSPECS=conda:disabled=Trueflaky-plumber-70709
06/04/2023, 8:20 PMMETAFLOW_DECOSPECS set and worked like a charm.flaky-plumber-70709
06/04/2023, 8:36 PM@conda, they wouldn't be able to use the internal functions. I've started the not-so-fun process of refactoring those into proper python packages so I can add tests + version/release them on an internal pypi through codeartifact (and then hopefully be able to manage things w the @pip decorator thanks to the legwork in this thread: https://outerbounds-community.slack.com/archives/C02116BBNTU/p1683579219280589)victorious-lawyer-58417
06/05/2023, 2:11 AM@condaflaky-plumber-70709
06/05/2023, 5:32 AMvictorious-lawyer-58417
06/05/2023, 5:35 AMflaky-plumber-70709
06/05/2023, 5:37 AMflaky-plumber-70709
06/05/2023, 5:39 AMMETAFLOW_ prefixed environment variables able to be set in the config.json?victorious-lawyer-58417
06/05/2023, 5:53 AM