Skip to content

Commit

Permalink
Adds who to run steps for operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrDzurb committed Sep 9, 2023
1 parent a3911e8 commit 585abad
Show file tree
Hide file tree
Showing 17 changed files with 467 additions and 61 deletions.
2 changes: 1 addition & 1 deletion ads/opctl/operator/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## ML Operator
-----------------------
--------------

Welcome to ML operators. This readme will contain the instructions helping to configure and dispatch operators.
48 changes: 27 additions & 21 deletions ads/opctl/operator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def list(debug: bool, **kwargs: Dict[str, Any]) -> None:


@commands.command()
@click.option("--debug", "-d", help="Set debug mode", is_flag=True, default=False)
@click.option("--debug", "-d", help="Set debug mode.", is_flag=True, default=False)
@click.option(
"--name",
"-n",
type=click.Choice(__operators__),
help="The name of the operator",
help="The name of the operator.",
required=True,
)
def info(debug: bool, **kwargs: Dict[str, Any]) -> None:
Expand All @@ -58,10 +58,10 @@ def info(debug: bool, **kwargs: Dict[str, Any]) -> None:
"--name",
"-n",
type=click.Choice(__operators__),
help="The name of the operator",
help="The name of the operator.",
required=True,
)
@click.option("--debug", "-d", help="Set debug mode", is_flag=True, default=False)
@click.option("--debug", "-d", help="Set debug mode.", is_flag=True, default=False)
@click.option(
"--output",
help=f"The folder name to save the resulting specification templates.",
Expand All @@ -71,13 +71,13 @@ def info(debug: bool, **kwargs: Dict[str, Any]) -> None:
@click.option(
"--overwrite",
"-o",
help="Overwrite result file if it already exists",
help="Overwrite result file if it already exists.",
is_flag=True,
default=False,
)
@click.option(
"--ads-config",
help="The folder where the ADS opctl config located",
help="The folder where the ADS opctl config located.",
required=False,
default=None,
)
Expand All @@ -87,7 +87,7 @@ def init(debug: bool, **kwargs: Dict[str, Any]) -> None:


@commands.command()
@click.option("--debug", "-d", help="Set debug mode", is_flag=True, default=False)
@click.option("--debug", "-d", help="Set debug mode.", is_flag=True, default=False)
@click.help_option("--help", "-h")
@click.option(
"--gpu",
Expand All @@ -110,11 +110,17 @@ def init(debug: bool, **kwargs: Dict[str, Any]) -> None:
@click.option(
"--image",
"-i",
help="The image name. By default the operator name will be used.",
help="The image name. By default the operator's name will be used.",
default=None,
required=False,
)
@click.option("--tag", "-t", help="The image tag.", required=False, default=None)
@click.option(
"--tag",
"-t",
help="The image tag. " "By default the operator's version will be used.",
required=False,
default=None,
)
@click.option(
"--rebuild-base-image",
"-r",
Expand All @@ -129,14 +135,14 @@ def build_image(debug: bool, **kwargs: Dict[str, Any]) -> None:

@commands.command()
@click.argument("image")
@click.option("--debug", "-d", help="Set debug mode", is_flag=True, default=False)
@click.option("--debug", "-d", help="Set debug mode.", is_flag=True, default=False)
@click.help_option("--help", "-h")
@click.option(
"--registry", "-r", help="Registry to publish to", required=False, default=None
"--registry", "-r", help="Registry to publish to.", required=False, default=None
)
@click.option(
"--ads-config",
help="The folder where the ADS opctl config located",
help="The folder where the ADS opctl config located.",
required=False,
default=None,
)
Expand All @@ -146,30 +152,30 @@ def publish_image(debug, **kwargs):


@commands.command(hidden=True)
@click.option("--debug", "-d", help="Set debug mode", is_flag=True, default=False)
@click.option("--debug", "-d", help="Set debug mode.", is_flag=True, default=False)
@click.option(
"--name",
"-n",
type=click.Choice(__operators__),
help="The name of the operator",
help="The name of the operator.",
required=True,
)
@click.option(
"--overwrite",
"-o",
help="Overwrite result file if it already exists",
help="Overwrite result file if it already exists.",
is_flag=True,
default=False,
)
@click.option(
"--ads-config",
help="The folder where the ADS opctl config located",
help="The folder where the ADS opctl config located.",
required=False,
default=None,
)
@click.option(
"--output",
help=f"The folder to save the resulting specification template YAML",
help=f"The folder to save the resulting specification template YAML.",
required=False,
default=None,
)
Expand All @@ -180,7 +186,7 @@ def create(debug: bool, **kwargs: Dict[str, Any]) -> None:

@commands.command()
@click.help_option("--help", "-h")
@click.option("--debug", "-d", help="Set debug mode", is_flag=True, default=False)
@click.option("--debug", "-d", help="Set debug mode.", is_flag=True, default=False)
@click.option(
"--file", "-f", help="The path to resource YAML file.", required=True, default=None
)
Expand Down Expand Up @@ -224,7 +230,7 @@ def verify(debug: bool, **kwargs: Dict[str, Any]) -> None:


@commands.command()
@click.option("--debug", "-d", help="Set debug mode", is_flag=True, default=False)
@click.option("--debug", "-d", help="Set debug mode.", is_flag=True, default=False)
@click.help_option("--help", "-h")
@click.option(
"--name",
Expand All @@ -249,13 +255,13 @@ def verify(debug: bool, **kwargs: Dict[str, Any]) -> None:
@click.option(
"--overwrite",
"-o",
help="Overwrite conda environment if it already exists",
help="Overwrite conda environment if it already exists.",
is_flag=True,
default=False,
)
@click.option(
"--ads-config",
help="The folder where the ADS opctl config located",
help="The folder where the ADS opctl config located.",
required=False,
default=None,
)
Expand Down
2 changes: 1 addition & 1 deletion ads/opctl/operator/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

def list() -> None:
"""Prints the list of the registered service operators."""
logger.info(
print(
tabulate(
(
{
Expand Down
6 changes: 4 additions & 2 deletions ads/opctl/operator/lowcode/forecast/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from ads.opctl import logger


def operate(operator_config: ForecastOperatorConfig) -> None:
"""Runs the forecasting operator."""
ForecastOperatorModelFactory.get_model(operator_config).generate_report()
Expand All @@ -22,5 +23,6 @@ def verify(spec: Dict) -> bool:
msg_header = (
f"{'*' * 50} The operator config has been successfully verified {'*' * 50}"
)
logger.info(operator.to_yaml())
logger.info("*" * len(msg_header))
print(msg_header)
print(operator.to_yaml())
print("*" * len(msg_header))
Loading

0 comments on commit 585abad

Please sign in to comment.