metaflow icon indicating copy to clipboard operation
metaflow copied to clipboard

Pathspec to create Flow/Run/Step/Task/DataArtifact is not validated

Open romain-intel opened this issue 3 years ago • 2 comments

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.

romain-intel avatar Feb 13 '22 00:02 romain-intel

Working on this@romain-intel

soma2000-lang avatar Feb 19 '22 04:02 soma2000-lang

Awesome! Thanks so much.

romain-intel avatar Feb 19 '22 17:02 romain-intel

@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!

bsridatta avatar Apr 01 '23 20:04 bsridatta

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.

romain-intel avatar Apr 02 '23 02:04 romain-intel

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

bsridatta avatar Apr 02 '23 08:04 bsridatta