Skip to content

Commit

Permalink
Avoid touching core by special-casing JSONType
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanrebello committed Oct 10, 2023
1 parent 581cc22 commit a46965a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion metaflow/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


class JSONTypeClass(click.ParamType):
name = __name__ = "JSON"
name = "JSON"

def convert(self, value, param, ctx):
if not isinstance(value, strtype):
Expand Down
8 changes: 6 additions & 2 deletions metaflow/plugins/argo/argo_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from collections import defaultdict
from hashlib import sha1

from metaflow import current
from metaflow import current, JSONType
from metaflow.decorators import flow_decorators
from metaflow.exception import MetaflowException
from metaflow.metaflow_config import (
Expand Down Expand Up @@ -401,7 +401,11 @@ def _process_parameters(self):
)
seen.add(norm)

param_type = str(param.kwargs.get("type").__name__)
if param.kwargs.get("type") == JSONType:
# Special-case this to avoid touching core
param_type = str(param.kwargs.get("type").name)
else:
param_type = str(param.kwargs.get("type").__name__)

is_required = param.kwargs.get("required", False)
# Throw an exception if a schedule is set for a flow with required
Expand Down

0 comments on commit a46965a

Please sign in to comment.