Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli-refactor] Standardize shared option groups (part 2) #27494

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

smackesey
Copy link
Collaborator

@smackesey smackesey commented Feb 2, 2025

Summary & Motivation

  • Eliminate the term "target" from shared option groups (e.g. @repository_target_options -> @repository_options). This was confusing since it didn't correspond to actual *Target* classes in the code.
  • @python_origin_target_options -> @python_pointer_options. "pointer" was chosen because the Python pointer options mostly correspond (and are ultimately parsed to) CodePointer objects.
  • @python_job_config_option -> @run_config_option. Another misleading name, as this was used outside the context of job config.
  • Replace some (randomly?) varying subsets of workspace-specifying options with the standard, full set of workspace-specifying options
    • e.g. dagster definitions validate accepted --workspace, --python-file, and --module-name but none of the other workspace-specifying options. There's no apparent reason for this, since the function resolves a workspace for validation. The inconsistency was likely the result of the original implementor just getting overwhelmed with the complexity of the code.
  • Consolidate the shared option groups to those we actually use: "job", "repository", "workspace", a few others.

How I Tested These Changes

Existing test suite.

@smackesey smackesey force-pushed the sean/workspace/consolidate-job-target branch from 12db08c to a5d50b1 Compare February 2, 2025 22:25
@smackesey smackesey force-pushed the sean/workspace/centralize-cli-utils branch from 740488a to bccb744 Compare February 2, 2025 22:25
@smackesey smackesey changed the title [workspace-refactor] Consolidate job_target_option funcs [cli-refactor] Consolidate job_target_option funcs Feb 3, 2025
@@ -79,7 +81,7 @@ def job_cli():
name="list",
help=f"List the jobs in a repository. {WORKSPACE_TARGET_WARNING}",
)
@job_repository_target_options
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was identical to @repository_options, so it's been deleted.

@smackesey smackesey force-pushed the sean/workspace/consolidate-job-target branch from a5d50b1 to 5d7ae2e Compare February 3, 2025 05:28
@smackesey smackesey force-pushed the sean/workspace/centralize-cli-utils branch from bccb744 to 10e3127 Compare February 3, 2025 05:28
@smackesey smackesey force-pushed the sean/workspace/centralize-cli-utils branch from 10e3127 to 0902df7 Compare February 3, 2025 13:53
@smackesey smackesey force-pushed the sean/workspace/consolidate-job-target branch from 5d7ae2e to 2ba5094 Compare February 3, 2025 13:53
Base automatically changed from sean/workspace/centralize-cli-utils to master February 3, 2025 13:53
@smackesey smackesey force-pushed the sean/workspace/consolidate-job-target branch from 2ba5094 to 5ab09e4 Compare February 3, 2025 13:59
)


@validate_command_options
Copy link
Collaborator Author

@smackesey smackesey Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[1] validate_command_options here is just an arbitrary subset of the full set of workspace options. AFAICT there is no reason for this, since we immediately resolve these options to a workspace using the common pathway inside the validate command. Therefore replace with standard workspace options.

generate_module_name_option(allow_multiple=True),
generate_working_directory_option(),
*generate_grpc_server_target_options(hidden=True),
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See [1].

@smackesey smackesey force-pushed the sean/workspace/consolidate-job-target branch from 5ab09e4 to a58be30 Compare February 3, 2025 14:39
@smackesey smackesey changed the title [cli-refactor] Consolidate job_target_option funcs [cli-refactor] Standardize shared option groups (part 2) Feb 3, 2025
@smackesey smackesey force-pushed the sean/workspace/consolidate-job-target branch from a58be30 to 9c0b023 Compare February 3, 2025 16:38
@smackesey smackesey marked this pull request as ready for review February 3, 2025 17:32
@smackesey smackesey requested a review from schrockn February 3, 2025 17:33
Comment on lines 256 to 257
if kwargs.get("empty_workspace"):
args.extend("--empty-workspace")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args.extend() is being called with a string argument, which Python will iterate through character-by-character. To properly add the flag as a single argument, use either args.extend(['--empty-workspace']) or args.extend(('--empty-workspace',)).

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@smackesey smackesey force-pushed the sean/workspace/consolidate-job-target branch 2 times, most recently from 0b89790 to 97522d5 Compare February 3, 2025 18:43
Copy link
Collaborator Author

smackesey commented Feb 3, 2025

Merge activity

  • Feb 3, 6:19 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Feb 3, 6:19 PM EST: Graphite rebased this pull request as part of a merge.
  • Feb 3, 6:20 PM EST: A user merged this pull request with Graphite.

@smackesey smackesey force-pushed the sean/workspace/consolidate-job-target branch from 97522d5 to 175147a Compare February 3, 2025 23:19
@smackesey smackesey merged commit ce0ca17 into master Feb 3, 2025
3 of 4 checks passed
@smackesey smackesey deleted the sean/workspace/consolidate-job-target branch February 3, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants