in GenAIFlow.py [0:0]
def params_to_args(self):
"""
Converts the metaflow arguments (passed to a metaflow job) to commandline arguments
to be interpreted by legacy argparse command line code.
This should be called at the class level. Note that '-' arg names aren't supported
in Metaflow and are automatically converted to '_' in the Metaflow UI. They are
converted back to '-' here.
Also note that 0 value params are omitted, so items with non-zero defaults are not
fully supported in some situations.
"""
args = []
for name, value in self.__class__.__dict__.items():
if name.startswith(MF_ARG_MULTI_PREFIX):
vv = getattr(self, name)
if vv not in (None, 0, '', False):
args.append(f"--{name[len(MF_ARG_MULTI_PREFIX):].replace('_', '-')}")
items = str(vv).split(",")
for item in items:
args.append(item)
if name.startswith(MF_ARG_PREFIX):
vv = getattr(self, name)
if vv not in (None, 0, '', False):
args.append(f"--{name[len(MF_ARG_PREFIX):].replace('_', '-')}")
if str(vv) != 'True':
args.append(str(vv))
return args