-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[components] Move global options to subcommands (#26640)
## Summary & Motivation This changes the options scheme in `dagster-dg` so that options are no longer hierarchically processed and passed down the command tree, _except_ in the special case of `dg component generate` subcommands, where global options are defined on the containing group. Now, all leaves of the tree (except for `dg component generate` subcommands) have the same set of "global options" appended to their options list. These are visually separated in the help message. We correspondingly simplify the Usage message to have a single `[OPTIONS]` input spot. There are also now fewer apparent global options because two of the old ones, `--clear-cache` and `--rebuild-component-registry`, must be executed as standalone pseudo-commands (e.g. `dg --clear-cache`) rather than used as modifiers to other commands. Before (`dg component-type info --help`): ``` Usage: dg [OPTIONS] component-type info [OPTIONS] COMPONENT_TYPE Get detailed information on a registered Dagster component type. Options: --description --generate-params-schema --component-params-schema -h, --help Show this message and exit. Options (dg): --builtin-component-lib TEXT Specify a builitin component library to use. --verbose Enable verbose output for debugging. --disable-cache Disable caching of component registry data. --clear-cache Clear the cache before running the command. --rebuild-component-registry Recompute and cache the set of available component types for the current environment. Note that this also happens automatically whenever the cache is detected to be stale. --cache-dir PATH Specify a directory to use for the cache. ``` After (`dg component-type info --help`): ``` Usage: dg component-type info [OPTIONS] COMPONENT_TYPE Get detailed information on a registered Dagster component type. Options: --description --generate-params-schema --component-params-schema -h, --help Show this message and exit. Global options: --builtin-component-lib TEXT Specify a builitin component library to use. --verbose Enable verbose output for debugging. --disable-cache Disable the cache.. --cache-dir PATH Specify a directory to use for the cache. ``` --- Before (`dg generate component dagster_components.dbt_project --help`): ``` Usage: dg [OPTIONS] component generate dagster_components.dbt_project [OPTIONS] COMPONENT_NAME Options: --json-params TEXT JSON string of component parameters. --init BOOLEAN init --project-path TEXT project_path -h, --help Show this message and exit. Options (dg): --builtin-component-lib TEXT Specify a builitin component library to use. --verbose Enable verbose output for debugging. --disable-cache Disable caching of component registry data. --clear-cache Clear the cache before running the command. --rebuild-component-registry Recompute and cache the set of available component types for the current environment. Note that this also happens automatically whenever the cache is detected to be stale. --cache-dir PATH Specify a directory to use for the cache. ``` After (`dg generate component dagster_components.dbt_project --help`): ``` Usage: dg component generate [GLOBAL OPTIONS] dagster_components.dbt_project [OPTIONS] COMPONENT_NAME Options: --json-params TEXT JSON string of component parameters. --init BOOLEAN init --project-path TEXT project_path -h, --help Show this message and exit. Global options: --builtin-component-lib TEXT Specify a builitin component library to use. --verbose Enable verbose output for debugging. --disable-cache Disable the cache.. --cache-dir PATH Specify a directory to use for the cache. ``` ## How I Tested These Changes Modified unit tests, played with it on the command line.
- Loading branch information
Showing
15 changed files
with
439 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.