Skip to content

Commit 5949823

Browse files
authored
fix(metrics): get command relax validation to allow any --metric (#334)
* fix(metrics): get command relax validation to allow any --metric * feat(metrics): setup showing custom metrics in help text * feat(metrics): list metric options in help text
1 parent 16b9e08 commit 5949823

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

gradient/cli/deployments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,9 @@ def deployment_remove_tags(id, options_file, api_key, **kwargs):
703703
"--metric",
704704
"metrics_list",
705705
multiple=True,
706-
type=ChoiceType(constants.METRICS_MAP, case_sensitive=False),
706+
type=str,
707707
default=(constants.BuiltinMetrics.cpu_percentage, constants.BuiltinMetrics.memory_usage),
708-
help="One or more metrics that you want to read. Defaults to cpuPercentage and memoryUsage",
708+
help=("One or more metrics that you want to read: {}. Defaults to cpuPercentage and memoryUsage. To view available custom metrics, use command: `gradient deployments metrics list`".format(', '.join(map(str, constants.METRICS_MAP)))),
709709
cls=common.GradientOption,
710710
)
711711
@click.option(

gradient/cli/experiments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,9 @@ def experiment_remove_tags(id, options_file, api_key, **kwargs):
861861
"--metric",
862862
"metrics_list",
863863
multiple=True,
864-
type=ChoiceType(constants.METRICS_MAP, case_sensitive=False),
864+
type=str,
865865
default=(constants.BuiltinMetrics.cpu_percentage, constants.BuiltinMetrics.memory_usage),
866-
help="One or more metrics that you want to read. Defaults to cpuPercentage and memoryUsage",
866+
help=("One or more metrics that you want to read: {}. Defaults to cpuPercentage and memoryUsage. To view available custom metrics, use command: `gradient experiments metrics list`".format(', '.join(map(str, constants.METRICS_MAP)))),
867867
cls=common.GradientOption,
868868
)
869869
@click.option(

gradient/cli/jobs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,9 @@ def job_remove_tags(id, options_file, api_key, **kwargs):
533533
"--metric",
534534
"metrics_list",
535535
multiple=True,
536-
type=ChoiceType(constants.METRICS_MAP, case_sensitive=False),
536+
type=str,
537537
default=(constants.BuiltinMetrics.cpu_percentage, constants.BuiltinMetrics.memory_usage),
538-
help="One or more metrics that you want to read. Defaults to cpuPercentage and memoryUsage",
538+
help=("One or more metrics that you want to read: {}. Defaults to cpuPercentage and memoryUsage. To view available custom metrics, use command: `gradient jobs metrics list`".format(', '.join(map(str, constants.METRICS_MAP)))),
539539
cls=common.GradientOption,
540540
)
541541
@click.option(

gradient/cli/notebooks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ def notebook_remove_tags(id, options_file, api_key, **kwargs):
381381
"--metric",
382382
"metrics_list",
383383
multiple=True,
384-
type=ChoiceType(constants.METRICS_MAP, case_sensitive=False),
384+
type=str,
385385
default=(constants.BuiltinMetrics.cpu_percentage, constants.BuiltinMetrics.memory_usage),
386-
help="One or more metrics that you want to read. Defaults to cpuPercentage and memoryUsage",
386+
help=("One or more metrics that you want to read: {}. Defaults to cpuPercentage and memoryUsage. To view available custom metrics, use command: `gradient notebooks metrics list`".format(', '.join(map(str, constants.METRICS_MAP)))),
387387
cls=common.GradientOption,
388388
)
389389
@click.option(

0 commit comments

Comments
 (0)