On passing -e pipeline.yaml
Traceback (most recent call last):
File "/Users/Edu/dev/ploomber/src/ploomber/cli/io.py", line 34, in wrapper
fn(**kwargs)
File "/Users/Edu/dev/ploomber/src/ploomber/cli/status.py", line 15, in main
dag, args = parser.load_from_entry_point_arg()
File "/Users/Edu/dev/ploomber/src/ploomber/cli/parsers.py", line 213, in load_from_entry_point_arg
entry_point = EntryPoint(self.parse_entry_point_value())
File "/Users/Edu/dev/ploomber/src/ploomber/entrypoint.py", line 19, in __init__
self.type = find_entry_point_type(value)
File "/Users/Edu/dev/ploomber/src/ploomber/entrypoint.py", line 65, in find_entry_point_type
raise ValueError(
ValueError: Could not determine the entry point type from value: 'pipeline.yaml'. Expected an existing file with extension .yaml or .yml, existing directory, glob-like pattern (i.e., *.py) or dotted path (i.e., module.sub_module.factory_function). Verify your input.
How to check if the argument "looks like" a path to a yaml file, and if so, say that the path doesn't exist. If it doesn't look like a path to a yaml, print the default error message.
My code:-
if type_:
return type_
else:
raise ValueError(
'Could not determine the entry point type from value: '
f'{entry_point!r}. Expected '
'an existing file with extension .yaml or .yml, '
'existing directory, glob-like pattern '
'(i.e., *.py) or dotted path '
'(i.e., module.sub_module.factory_function). Verify your input.')
def try_to_find_entry_point_type(entry_point):
if entry_point is None:
return None
elif '*' in entry_point:
return EntryPoint.Pattern
elif '::' in entry_point:
return EntryPoint.ModulePath
elif Path(entry_point).exists():
if Path(entry_point).is_dir():
return EntryPoint.Directory
else:
return EntryPoint.File
elif '.' in entry_point and Path(entry_point).suffix not in {
'.yaml', '.yml'
}:
return EntryPoint.DottedPath