cold-balloon-7686
04/25/2025, 6:43 PMfrom metaflow import FlowSpec, step, NBRunner
class HelloFlow(FlowSpec):
@step
def start(self):
self.x = 1
self.next(self.end)
@step
def end(self):
self.x += 1
print("Hello world! The value of x is", self.x)
run = NBRunner(HelloFlow).nbrun(decospecs=["argo-workflows"])
• Any idea how to achieve this?
• Any idea how to default to using Argo Workflows?
Thanksbrainy-truck-72938
04/25/2025, 7:06 PMbrainy-truck-72938
04/25/2025, 7:18 PMfrom metaflow import NBDeployer, FlowSpec, step
class HelloFlow(FlowSpec):
@step
def start(self):
self.x = 1
self.next(self.end)
@step
def end(self):
self.x += 1
print("Hello world! The value of x is", self.x)
deployer = NBDeployer(HelloFlow)
then, in the next cell, you could have...
deployed_flow = deployer.argo_workflows().create()
df_name = deployed_flow.name # for later use...
triggered_run = deployed_flow.trigger()
then, you can access the Run
object with:
run_obj = triggered_run.run
more details about Run object here: https://docs.metaflow.org/api/client
also, since you have already deployed the flow, you can trigger it again as follows:
from metaflow import DeployedFlow
df = DeployedFlow.from_deployment(identifier=df_name)
triggered_run = df.trigger()
this is for the use-case when you have already deployed to argo workflows and don't want to call .create()
again but fetch the already deployed flow and just trigger it again...
(eg: from a separate notebook or terminal where you don't have access to the original deployed_flow
object)brainy-truck-72938
04/25/2025, 7:18 PMDeployer
here: https://docs.metaflow.org/api/deployerbrainy-truck-72938
04/25/2025, 7:19 PM