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

Introducing CLI Commands for Shell Flows #11998

Merged
merged 36 commits into from
Mar 26, 2024
Merged

Introducing CLI Commands for Shell Flows #11998

merged 36 commits into from
Mar 26, 2024

Conversation

gabcoyne
Copy link
Contributor

@gabcoyne gabcoyne commented Feb 15, 2024

Overview

This update introduces two new CLI commands, prefect command watch and prefect command serve, allowing users to monitor and serve shell commands as Prefect flows effortlessly. Additionally, we're adding a ModuleStorage class to enable module-based flow storage and enable command serving. This feature simplifies integrating shell commands with Prefect, enhancing automation and monitoring capabilities.

Example

Imagine scheduling a daily data backup with a simple shell command. With prefect command watch, you can now easily incorporate this into your Prefect workflows, monitoring its execution as part of your data pipeline.

Checklist

  • This pull request includes tests that ensure functionality works as expected.
  • This pull request is labeled with feature to highlight the new additions.

For documentation changes:

  • Adjustments to the documentation are included to guide users on how to utilize these new commands.

For new functions or classes in the Python SDK:

  • Helpful docstrings have been added to the new classes and functions for better understanding.
  • A stub page in the Python SDK docs and an entry in mkdocs.yml navigation have been prepared to introduce ModuleStorage.

Happy engineering!

Copy link

netlify bot commented Feb 15, 2024

Deploy Preview for prefect-docs-preview ready!

Name Link
🔨 Latest commit a1c25d4
🔍 Latest deploy log https://app.netlify.com/sites/prefect-docs-preview/deploys/66034ed98e43a30008f4bff6
😎 Deploy Preview https://deploy-preview-11998--prefect-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Mar 5, 2024

This pull request is stale because it has been open 14 days with no activity. To keep this pull request open remove stale label or comment.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Thomas Frederik Hoeck <44194839+thomasfrederikhoeck@users.noreply.github.com>
Co-authored-by: Thomas Frederik Hoeck <tfh@norden.com>
Co-authored-by: nate nowack <thrast36@gmail.com>
Co-authored-by: nate nowack <nate@prefect.io>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: marvin-robot <marvin-robot@users.noreply.github.com>
Co-authored-by: Chris Guidry <chris.g@prefect.io>
Co-authored-by: Chris Pickett <chris.pickett@prefect.io>
Co-authored-by: Andrew Brookins <andrew.b@prefect.io>
Co-authored-by: urimandujano <uriel@prefect.io>
Co-authored-by: Collin <collin@prefect.io>
Co-authored-by: Zach Angell <42625717+zangell44@users.noreply.github.com>
Co-authored-by: Alexander Streed <desertaxle@users.noreply.github.com>
Co-authored-by: Edward Park <ed.sh.park@gmail.com>
Co-authored-by: Serina Grill <42048900+serinamarie@users.noreply.github.com>
Co-authored-by: Jeff Hale <discdiver@users.noreply.github.com>
Co-authored-by: jakekaplan <40362401+jakekaplan@users.noreply.github.com>
Co-authored-by: Zanie Blue <zanie@prefect.io>
Co-authored-by: Kevin Grismore <146098880+kevingrismore@users.noreply.github.com>
Co-authored-by: Hamza Mogni <hamzamogni5@gmail.com>
Co-authored-by: Bill Palombi <bill@prefect.io>
Co-authored-by: Brandon Reid <brandonreidak@gmail.com>
Co-authored-by: Elad Moshe <eladm26@gmail.com>
Co-authored-by: Jessica Smith <8505845+NodeJSmith@users.noreply.github.com>
Co-authored-by: James Bourbeau <jrbourbeau@users.noreply.github.com>
Co-authored-by: Alexander Streed <alex.s@prefect.io>
Co-authored-by: Sean <64788907+seano-vs@users.noreply.github.com>
@gabcoyne gabcoyne changed the title Introducing CLI Commands for Shell Command Flows and ModuleStorage Introducing CLI Commands for Shell Flows Mar 13, 2024
@gabcoyne gabcoyne marked this pull request as ready for review March 19, 2024 16:04
@gabcoyne gabcoyne requested a review from a team as a code owner March 19, 2024 16:04
Copy link
Collaborator

@zzstoatzz zzstoatzz left a comment

Choose a reason for hiding this comment

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

nice!

what do you think about adding a small bit of docs on this?

src/prefect/cli/shell.py Outdated Show resolved Hide resolved
src/prefect/cli/shell.py Outdated Show resolved Hide resolved
src/prefect/cli/shell.py Outdated Show resolved Hide resolved
tests/cli/test_shell.py Outdated Show resolved Hide resolved
src/prefect/cli/shell.py Outdated Show resolved Hide resolved
src/prefect/cli/shell.py Outdated Show resolved Hide resolved
src/prefect/cli/shell.py Show resolved Hide resolved
src/prefect/cli/shell.py Outdated Show resolved Hide resolved
src/prefect/cli/shell.py Show resolved Hide resolved
src/prefect/cli/shell.py Outdated Show resolved Hide resolved
@serinamarie serinamarie added the enhancement An improvement of an existing feature label Mar 20, 2024
Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

It'd be great to see one test ensuring this CLI integrates with the runner correctly. It should be sufficient to mock out Runner and check that Runner.start is called with the expected arguments.

src/prefect/cli/shell.py Outdated Show resolved Hide resolved
@gabcoyne gabcoyne requested a review from a team as a code owner March 21, 2024 14:43
@gabcoyne gabcoyne enabled auto-merge (squash) March 26, 2024 22:58
Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

LGTM!

@gabcoyne gabcoyne merged commit 8c87076 into main Mar 26, 2024
46 checks passed
@gabcoyne gabcoyne deleted the feature/script-watch branch March 26, 2024 23:21
serinamarie added a commit that referenced this pull request Apr 5, 2024
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Thomas Frederik Hoeck <44194839+thomasfrederikhoeck@users.noreply.github.com>
Co-authored-by: Thomas Frederik Hoeck <tfh@norden.com>
Co-authored-by: nate nowack <thrast36@gmail.com>
Co-authored-by: nate nowack <nate@prefect.io>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: marvin-robot <marvin-robot@users.noreply.github.com>
Co-authored-by: Chris Guidry <chris.g@prefect.io>
Co-authored-by: Chris Pickett <chris.pickett@prefect.io>
Co-authored-by: Andrew Brookins <andrew.b@prefect.io>
Co-authored-by: urimandujano <uriel@prefect.io>
Co-authored-by: Collin <collin@prefect.io>
Co-authored-by: Zach Angell <42625717+zangell44@users.noreply.github.com>
Co-authored-by: Alexander Streed <desertaxle@users.noreply.github.com>
Co-authored-by: Edward Park <ed.sh.park@gmail.com>
Co-authored-by: Serina Grill <42048900+serinamarie@users.noreply.github.com>
Co-authored-by: Jeff Hale <discdiver@users.noreply.github.com>
Co-authored-by: jakekaplan <40362401+jakekaplan@users.noreply.github.com>
Co-authored-by: Zanie Blue <zanie@prefect.io>
Co-authored-by: Kevin Grismore <146098880+kevingrismore@users.noreply.github.com>
Co-authored-by: Hamza Mogni <hamzamogni5@gmail.com>
Co-authored-by: Bill Palombi <bill@prefect.io>
Co-authored-by: Brandon Reid <brandonreidak@gmail.com>
Co-authored-by: Elad Moshe <eladm26@gmail.com>
Co-authored-by: Jessica Smith <8505845+NodeJSmith@users.noreply.github.com>
Co-authored-by: James Bourbeau <jrbourbeau@users.noreply.github.com>
Co-authored-by: Alexander Streed <alex.s@prefect.io>
Co-authored-by: Sean <64788907+seano-vs@users.noreply.github.com>
Co-authored-by: Nicholas Brown <znicholasbrown@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants