Skip to content

Commit

Permalink
Fix dataclients
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-intel committed Oct 22, 2024
1 parent 9f2ec8b commit 2508fa8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions metaflow/includefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@


# From here on out, this is the IncludeFile implementation.
_dict_dataclients = {d.TYPE: d for d in DATACLIENTS}


class IncludedFile(object):
Expand Down Expand Up @@ -160,7 +161,7 @@ def convert(self, value, param, ctx):
"IncludeFile using a direct reference to a file in cloud storage is no "
"longer supported. Contact the Metaflow team if you need this supported"
)
# if DATACLIENTS.get(path[:prefix_pos]) is None:
# if _dict_dataclients.get(path[:prefix_pos]) is None:
# self.fail(
# "IncludeFile: no handler for external file of type '%s' "
# "(given path is '%s')" % (path[:prefix_pos], path)
Expand All @@ -180,7 +181,7 @@ def convert(self, value, param, ctx):
pass
except OSError:
self.fail("IncludeFile: could not open file '%s' for reading" % path)
handler = DATACLIENTS.get(ctx.ds_type)
handler = _dict_dataclients.get(ctx.ds_type)
if handler is None:
self.fail(
"IncludeFile: no data-client for datastore of type '%s'"
Expand All @@ -206,7 +207,7 @@ def _delayed_eval_func(ctx=lambda_ctx, return_str=False):
ctx.path,
ctx.is_text,
ctx.encoding,
DATACLIENTS[ctx.handler_type],
_dict_dataclients[ctx.handler_type],
ctx.echo,
)
)
Expand Down Expand Up @@ -418,7 +419,7 @@ def _get_handler(url):
if prefix_pos < 0:
raise MetaflowException("Malformed URL: '%s'" % url)
prefix = url[:prefix_pos]
handler = DATACLIENTS.get(prefix)
handler = _dict_dataclients.get(prefix)
if handler is None:
raise MetaflowException("Could not find data client for '%s'" % prefix)
return handler
Expand Down

0 comments on commit 2508fa8

Please sign in to comment.