When using `Runner` is there a way to get the run'...
# ask-metaflow
p
When using
Runner
is there a way to get the run's run_id? During a run, you get it from
current.run_id
. You can use the id to get a
Run
. But once you have a
Run
, like from
Runner(...).run(...).run
, how can you get the run id?
✅ 1
g
are you trying to get the latest run id?
p
no. the run that i kicked off and blocked *on
it might not be latest
h
The Run object has two ways to get the run ID:
.id
— returns just the run ID (e.g., "12345"):
Copy code
result = runner.run(alpha=5)
  run_id = result.run.id
.pathspec
— returns the full pathspec (e.g., "MyFlow/12345"):
run_id = result.run.pathspec  # "MyFlow/12345"
So for a Runner result:
Copy code
with Runner("myflow.py") as runner:
      result = runner.run(alpha=5)
      print(result.run.id)       # "12345"
      print(result.run.pathspec) # "MyFlow/12345"
p
ah. i was looking for "run_id". and i was having local config issues to access a real Run to inspect the instance itself.
this would be great to include in the API docs: https://docs.metaflow.org/api/client#run
h
added
🙌 3