victorious-analyst-26561
12/13/2023, 4:09 PMFlowSpec
which accepts an optional parameter as follows:
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"
:
{
"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?high-scientist-77658
08/04/2025, 1:42 PM