Hola, good folk of Metaflow :wave: I'm having an ...
# ask-metaflow
v
Hola, good folk of Metaflow 👋 I'm having an issue in running `FlowSpec`s in Argo Workflows. Any pointers on what I'm missing or how to deal with this would be much appreciated! 🙏 • I've defined a
FlowSpec
which accepts an optional parameter as follows:
Copy code
class TestFlow(FlowSpec):
    only_sites = Parameter(
        "only-sites",
        default=None,
        type=str,
        help="Comma-separated list of sites to test (e.g. 'id_1.geojson,id_2.geojson')",
    )
    ...
• Subsequent code inspects the type of this parameter - where the value is
None
, we need certain behaviour. • This Flow works fine when executed locally: the
self.only_sites
attribute is set to
None
, as expected. • When run in Argo Workflows, however, the behaviour is different. • In particular, the WorkflowTemplate has an
only_sites
parameter which is a string value of
"null"
:
Copy code
{
  "name": "only-sites",
  "value": "null",
  "description": "Comma-separated list of sites to test (e.g. 'id_1.geojson,id_2.geojson')"
}
• This is then passed to the resulting Workflow, which causes unexpected behaviour within the Flow for users that do not pass any value for this parameter. I'd really rather not need to add
if self.only_sites is None or self.only_sites == "null"
throughout my code to handle this difference in behaviour between environments. What more elegant ways are there for handling this?
👀 1
h
I just stumbled on this same issue, does anyone know if there is a built in way to handle a default None for metaflow running on argo?