Skip to content

Commit

Permalink
[CDF-23263] 🤖 Add verbose to all cmds (#1324)
Browse files Browse the repository at this point in the history
* test: extend testing

* fix: implemented emtpy

* tests: updated mocking

* fix: quote version key in location filter

* feat: added data modeling type

* tests: updated test

* tests: regen

* feat: support data modeling type

* tests: update mock lookup

* build: changelog

* fix: introduced bugs

* fix; bug bug

* fix; bug bug bug

* tests: standardize

* tests: standardize 2

* tests: set cpu and memory outside limits

* tests: try to recreate issue

* docs: documented case

* fix: redeployment issue

* feat: added warning on mistake

* style: warning message

* feat; introduce ToolkitClientConfig

* style: better return value

* refactor: renaming

* Update cognite_toolkit/_cdf_tk/client/_toolkit_client.py

* docs; better docs

* refactor: deal with special behavior

* tests: added failing test

* refactor; extending test

* fix: set correct kind file name

* fix: added missing verbose flags

* Update CHANGELOG.cdf-tk.md

Co-authored-by: Pål Rønning <[email protected]>

---------

Co-authored-by: Pål Rønning <[email protected]>
  • Loading branch information
doctrino and ronpal authored Jan 6, 2025
1 parent bca9bf9 commit 527468a
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.cdf-tk.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Changes are grouped as follows:
the required value no longer triggers a redeploy.
- `LocationFilters` now parses the `version` key of `View` and `DataModel` correctly as a string.
- `LocationFilters` now converts an empty string of `dataSetExternalId` to `0` instead of ignoring it.
- All commands now has a verbose flag `--verbose`. Not all commands have an `--verbose` output, but
error handling has a more verbose output which applies to all commands.

## [0.3.23] - 2024-12-13

Expand Down
16 changes: 16 additions & 0 deletions cognite_toolkit/_cdf_tk/apps/_auth_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ def init(
help="If you verify, and you pass this flag no changes to CDF will be made.",
),
] = False,
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""Sets the OIDC parameters required to authenticate and authorize the Cognite Toolkit in Cognite Data Fusion.
Expand Down Expand Up @@ -74,6 +82,14 @@ def verify(
"If you include this flag, the execution will stop if the user or service principal does not have the required capabilities.",
),
] = False,
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""Verify that the current user or service principal has the required capabilities to run the CDF Toolkit commands."""
cmd = AuthCommand()
Expand Down
24 changes: 24 additions & 0 deletions cognite_toolkit/_cdf_tk/apps/_modules_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ def init(
help="Clean target directory if it exists",
),
] = False,
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""Initialize or upgrade a new CDF project with templates interactively."""

Expand Down Expand Up @@ -100,6 +108,14 @@ def add(
help="Path to project directory with the modules. This is used to search for available functions.",
),
] = CDF_TOML.cdf.default_organization_dir,
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""Add one or more new module(s) to the project."""
cmd = ModulesCommand()
Expand Down Expand Up @@ -179,6 +195,14 @@ def list(
help="Build environment to use.",
),
] = CDF_TOML.cdf.default_env,
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""List all available modules in the project."""
cmd = ModulesCommand()
Expand Down
32 changes: 32 additions & 0 deletions cognite_toolkit/_cdf_tk/apps/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ def run_transformation(
help="External id of the transformation to run.",
),
],
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""This command will run the specified transformation using a one-time session."""
cmd = RunTransformationCommand()
Expand Down Expand Up @@ -93,6 +101,14 @@ def run_workflow(
help="Whether to wait for the workflow to complete.",
),
] = False,
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""This command will run the specified workflow."""
cmd = RunWorkflowCommand()
Expand Down Expand Up @@ -158,6 +174,14 @@ def run_local(
help="Whether to rebuild the environment before running the function.",
),
] = False,
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""This command will run the specified function locally."""
cmd = RunFunctionCommand()
Expand Down Expand Up @@ -214,6 +238,14 @@ def run_cdf(
help="Whether to wait for the function to complete.",
),
] = False,
verbose: Annotated[
bool,
typer.Option(
"--verbose",
"-v",
help="Turn on to get more verbose output when running the command",
),
] = False,
) -> None:
"""This command will run the specified function (assuming it is deployed) in CDF."""
cmd = RunFunctionCommand()
Expand Down

0 comments on commit 527468a

Please sign in to comment.