metaflow
metaflow copied to clipboard
Pathspec to create Flow/Run/Step/Task/DataArtifact is not validated
Currently, you can do something like this: Task(Flow/RunID/StepName) and this will not result in an error but then the resulting Task object behaves in a bizarre manner where things like t.data will work but t.data.my_artifact will not for example.
We should validate the format of the pathspec passed in to each object and verify that the following are the only possible cases:
- Metaflow()
- Flow('MyFlow')
- Run('MyFlow/1')
- Step('MyFlow/1/start')
- Task('MyFlow/1/start/1')
- DataArtifact('MyFlow/1/start/1/name')
We should make sure that MyFlow and MyFlow/ behave similarly for example though.
Working on this@romain-intel
Awesome! Thanks so much.
@romain-intel Is this issue still valid? Was trying to have a look and
Task("MovieStatsFlow/1680379703087709/start")
resulted in an error
KeyError: 'task_id'
Please let me know. Thanks!
I haven't checked recently. Did you try things like:
Run("MovieStatsFlow/123/start/")
Step("MovieStatsFlow/123/start/456")
Task("MovieStatsFlow/123/start/")
and other combos (basically with and without the trailing / and too short or too long. I suspect some combinations that are invalid are still working.
Got it, Passing a step to a run works, task to a step works, which is not expected and should be disabled. Thanks for the clarification, this is indeed confusing for new developers. I am picking up another ticket and will get to this after that, thank you!
In [19]: Run("HelloFlow/1/start/")
Out[19]: Run('HelloFlow/1/start/')
In [20]: Step("HelloFlow/1/start/2")
Out[20]: Step('HelloFlow/1/start/2')
In [21]: Task("HelloFlow/1/start/")
---------------------------------------------------------------------------
MetaflowNotFound Traceback (most recent call last)
...
MetaflowNotFound: Task('HelloFlow/1/start/') does not exist