Tom Jordahl
09/13/2024, 1:55 PMNate
09/13/2024, 2:19 PMNate
09/13/2024, 2:19 PMTom Jordahl
09/13/2024, 2:21 PMTom Jordahl
09/13/2024, 2:21 PMNate
09/13/2024, 2:22 PMNate
09/13/2024, 2:24 PMTom Jordahl
09/13/2024, 2:24 PMNate
09/13/2024, 2:24 PMTom Jordahl
09/13/2024, 2:24 PM<br>
tag would workTom Jordahl
09/13/2024, 2:25 PMNate
09/13/2024, 2:31 PMfrom pydantic import BaseModel
from prefect import flow
class BadParams(BaseModel):
"""This is a realllllly long description that should be rendered as markdown
Attributes:
a: This is a really long description that should be rendered as markdown
b: This is a really long description that should be rendered as markdown
c: This is a really long description that should be rendered as markdown
x: This is a really long description that should be rendered as markdown
y: This is a really long description that should be rendered as markdown
z: This is a really long description that should be rendered as markdown
"""
a: int
b: int
c: int
x: int
y: int
z: int
@flow
def bad_params_render(params: BadParams):
pass
if __name__ == "__main__":
bad_params_render.serve()
Tom Jordahl
09/13/2024, 2:32 PMNate
09/13/2024, 2:32 PMNate
09/13/2024, 2:32 PMTom Jordahl
09/13/2024, 2:38 PMJanet Carson
09/13/2024, 4:21 PMTom Jordahl
09/13/2024, 4:21 PMNate
09/13/2024, 4:22 PMJacob Blanco
10/28/2024, 8:42 AMJacob Blanco
10/28/2024, 8:46 AMint
, but from what you're asking it seems more like you want a single parameter that requires users to choose from one of 6 predefined values and you want to document the meaning of each.
Which is correct? Because if it's the former then you can try:
class BadParams(BaseModel):
"""This is a realllllly long description that should be rendered as markdown"""
a: int = Field(description="This is a really long description that should be rendered.")
b: int = Field(description="This is a really long description that should be rendered.")
c: int = Field(description="This is a really long description that should be rendered.")
x: int = Field(description="This is a really long description that should be rendered.")
y: int = Field(description="This is a really long description that should be rendered.")
z: int = Field(description="This is a really long description that should be rendered.")
Then the descriptions will be rendered just below the parameter name like this (excuse my ASCII art) in the UI:
> A
> This is a really long description that should be rendered.
> [ input box ]Tom Jordahl
10/28/2024, 2:38 PMJacob Blanco
10/29/2024, 12:24 AMNate
10/29/2024, 1:20 AMNate
10/29/2024, 1:20 AMJacob Blanco
10/29/2024, 1:23 AMTom Jordahl
10/29/2024, 2:52 PMclass DataProcessingStage(Enum):
"""Input parameters for the data processing pipeline.
## *possible pipeline stage values:*
Each stage represents a distinct processing phase:
- RAW_INGESTION: Initial data load from source systems
- CLEAN: Apply data cleaning and validation rules
...
"""
RAW_INGESTION = "raw_ingestion"
CLEAN = "clean"
TRANSFORM = "transform"
AGGREGATE = "aggregate"
EXPORT = "export"
Can I do this? Can I use markdown in Prefect 2.x or is this a 3.x feature?Nate
10/29/2024, 3:09 PMTom Jordahl
10/29/2024, 3:10 PMTom Jordahl
10/29/2024, 6:43 PMNate
10/29/2024, 6:44 PMTom Jordahl
10/29/2024, 6:44 PMTom Jordahl
10/29/2024, 6:45 PM@flow
def harvest(
argument1: DataBricksHarvestDataSetIdentifier,
target_identifier: TargetIdentifier,
)
Tom Jordahl
10/29/2024, 6:46 PMclass TargetIdentifier(Enum):
"""
The list of target identifiers.
*Environments*:
- DEV: Development environment
Jacob Blanco
10/30/2024, 6:41 AMclass ReusableJobParameters(pydantic.BaseModel):
target_identifier: TargetIdentifier = pydantic.Field(description="Your description of options here")
Then use the model in your flows.
@flow
def flow_using_target_identifier(
argument1: DataBricksHarvestDataSetIdentifier,
target_parameters: ReusableJobParameters
):
# Some flow code that uses `target_parameters.target_identifier`
This will include parameter level documentation in any flow that uses the enum this way and you can include additional standard parameters as well.