Jackson Nguyen
02/22/2025, 12:05 AMMarvin
02/22/2025, 12:05 AMflow
, task
, and others. Here's the Prefect API documentation for more information.
It seems you're using PyO3 for Python/Rust integration and prefer an imperative programming style, which might mean you're looking for a more programmatic solution. Unfortunately, without altering the Prefect core behavior, the workaround I mentioned is your best bet.Jackson Nguyen
02/22/2025, 12:09 AMMarvin
02/22/2025, 12:10 AMJackson Nguyen
02/22/2025, 12:20 AMMarvin
02/22/2025, 12:21 AMDEBUG
to capture detailed logs, including errors. You can set this using environment variables or the Prefect CLI:
bash
prefect config set PREFECT_LOGGING_LEVEL=DEBUG
This setting will propagate from the worker environment to the flow run environment.
2. Custom Logging for Pydantic: If your Pydantic model raises validation errors, you can catch these exceptions and log them manually using Prefect's logging utilities. Here's a conceptual example:
python
from prefect import flow, get_run_logger
from pydantic import BaseModel, ValidationError
class MyModel(BaseModel):
param1: int
param2: str
@flow
def my_flow(params: dict):
logger = get_run_logger()
try:
validated_params = MyModel(**params)
except ValidationError as e:
logger.error(f"Validation error: {e}")
raise
# Example usage
my_flow({"param1": "not an int", "param2": "a string"})
3. Check Worker Logs: If your flow and task logs are empty, there might be an infrastructure issue that prevented logging. Check your worker logs for more details.
For more information on troubleshooting and managing Prefect logs, you can refer to the Prefect troubleshooting documentation.