Skip to content

Commit

Permalink
add errors
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor committed Sep 25, 2024
1 parent 4f3332e commit 18bc033
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions flytekit/clis/sdk_in_container/package.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import typing

import rich_click as click
Expand Down Expand Up @@ -131,6 +132,13 @@ def package(
"""
# Ensure that the two flags are consistent
if fast:
if "--copy" in sys.argv:
raise click.BadParameter(
click.style(
"Cannot use both --fast and --copy flags together. Please move to --copy",
fg="red",
)
)
click.secho("The --fast flag is deprecated, please use --copy all instead", fg="yellow")
copy = CopyFileDetection.ALL

Expand Down
8 changes: 8 additions & 0 deletions flytekit/clis/sdk_in_container/register.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import typing

import rich_click as click
Expand Down Expand Up @@ -169,6 +170,13 @@ def register(
# that the copy flag uses.
if non_fast:
click.secho("The --non-fast flag is deprecated, please use --copy none instead", fg="yellow")
if "--copy" in sys.argv:
raise click.BadParameter(
click.style(
"Cannot use both --non-fast and --copy flags together. Please move to --copy.",
fg="red",
)
)
copy = CopyFileDetection.NO_COPY
if copy == CopyFileDetection.NO_COPY and not version:
raise ValueError("Version is a required parameter in case --copy none is specified.")
Expand Down
7 changes: 7 additions & 0 deletions flytekit/clis/sdk_in_container/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,13 @@ def _run(*args, **kwargs):
"The --copy_all flag is now deprecated. Please use --copy all instead.",
fg="yellow",
)
if "--copy" in sys.argv:
raise click.BadParameter(
click.style(
"Cannot use both --copy-all and --copy flags together. Please move to --copy.",
fg="red",
)
)

with context_manager.FlyteContextManager.with_context(remote.context.new_builder()):
show_files = run_level_params.verbose > 0
Expand Down

0 comments on commit 18bc033

Please sign in to comment.