Skip to content

Blocks Catalog

Below is a list of Blocks available for registration in prefect-shell.

To register blocks in this module to view and edit them on Prefect Cloud:

prefect block register -m prefect_shell
Note, to use the load method on Blocks, you must already have a block document saved through code or saved through the UI.

Commands Module


A block representing a shell operation, containing multiple commands.

For long-lasting operations, use the trigger method and utilize the block as a context manager for automatic closure of processes when context is exited. If not, manually call the close method to close processes.

For short-lasting operations, use the run method. Context is automatically managed with this method.

To load the ShellOperation:

from prefect import flow
from prefect_shell.commands import ShellOperation

def my_flow():
    my_block = ShellOperation.load("block-name")

For additional examples, check out the Commands Module under Examples Catalog.