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

Add Parameter File Option to run cloud CLI command #1582

Merged
merged 6 commits into from
Oct 2, 2019
Merged

Conversation

joshmeek
Copy link

@joshmeek joshmeek commented Oct 1, 2019

Thanks for contributing to Prefect!

Please describe your work and make sure your PR:

  • adds new tests (if appropriate)
  • updates CHANGELOG.md (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

Note that your PR will not be reviewed unless all three boxes are checked.

What does this PR change?

Adds a --parameters option to the prefect run cloud CLI command for flow run parameter specification. Takes in a json file of parameters to use.

I chose to go the route of providing a parameter file specification and am open to adding other methods if desired. This felt more natural.

Closes #1551

Why is this PR important?

Previously we were unable to specify parameters for this function

@joshmeek joshmeek added the component:cli Related to the Prefect CLI label Oct 1, 2019
@codecov
Copy link

codecov bot commented Oct 1, 2019

Codecov Report

Merging #1582 into master will increase coverage by <.01%.
The diff coverage is 100%.

Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

Minor change requested; I'm OK with this but I'm curious about your reasoning for an actual file vs. a large string payload? E.g., if my parameter was just a table name, this feels heavy

src/prefect/cli/run.py Outdated Show resolved Hide resolved
@joshmeek
Copy link
Author

joshmeek commented Oct 2, 2019

@cicdw The other (using click) would be to pass in a string representing a json payload. I'm fine with adding it if wanted but it seemed ugly at the time

@joshmeek
Copy link
Author

joshmeek commented Oct 2, 2019

@cicdw I separated out a --parameters-file and --parameters-string option

string_params = json.loads(parameters_string)

flow_run_id = client.create_flow_run(
flow_id=flow_id, parameters={**file_params, **string_params}
Copy link
Member

Choose a reason for hiding this comment

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

Niiiice thinking

Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

Awesome

@joshmeek joshmeek merged commit 6f2c2df into master Oct 2, 2019
@joshmeek joshmeek deleted the cli_params branch October 2, 2019 16:42
zanieb pushed a commit that referenced this pull request Apr 13, 2022
…-ui/vite-2.9.1

Bump vite from 2.8.6 to 2.9.1 in /orion-ui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:cli Related to the Prefect CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Parameter Specification to run CLI command
2 participants