MikeT
08/30/2024, 5:01 PMprint
with @flow(log_prints=True)
and using the get_run_logger()
object and using that, but no matter what I never see anything in the logs in the UI. I can see the prints coming through in the worker stdout but just can't manage to get anything to show in the UI besides the "Opening process" and "Submission completed" (screenshot attached).
My task and flow definition is below (leaving out the agent definitions)... wondering if anyone has tips on how to get some of these to show up in the UI logs.MikeT
08/30/2024, 5:03 PMMikeT
08/30/2024, 5:03 PM@flow(log_prints=True)
)MikeT
08/30/2024, 5:12 PMMikeT
09/04/2024, 12:15 AMNate
09/04/2024, 12:50 AMNate
09/04/2024, 12:51 AMprefect config view
show for you?MikeT
09/04/2024, 12:53 AMMikeT
09/04/2024, 12:53 AM❯ prefect config view
PREFECT_PROFILE='ephemeral'
PREFECT_API_URL='<http://0.0.0.0:4200/api>' (from profile)
PREFECT_SERVER_ALLOW_EPHEMERAL_MODE='True' (from profile)
MikeT
09/04/2024, 12:54 AMservices:
db:
image: postgres:latest
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: yourTopSecretPassword
POSTGRES_DB: prefect
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
prefect:
image: prefecthq/prefect:3.0.0rc20-python3.11-conda
depends_on:
- db
environment:
PREFECT_API_DATABASE_CONNECTION_URL: "<postgresql+asyncpg://postgres:yourTopSecretPassword@db:5432/prefect>"
PREFECT_API_URL: "<http://localhost:4200/api>"
PREFECT_SERVER_API_HOST: "0.0.0.0"
ports:
- "4200:4200"
command: prefect server start
volumes:
postgres_data:
Nate
09/04/2024, 1:06 AMfrom prefect import flow
@flow(log_prints=True)
def f(): print('hi')
f()
does that log show up in the UI for you?MikeT
09/04/2024, 1:35 AMNate
09/04/2024, 3:01 AMNate
09/04/2024, 3:38 AMPREFECT_LOGGING_LEVEL=INFO
where you're running controlflow
https://github.com/PrefectHQ/ControlFlow/blob/main/src/controlflow/settings.py#L98-L102Nate
09/04/2024, 3:45 AMcontrolflow
running in a simple api
docker compose up -d --build
» curl -X POST "<http://localhost:8000/chat?message=Your%20message%20here>"
# api.py
@flow(log_prints=True)
async def handle_message(message: str):
result = await cf.run_async(
message, result_type=Annotated[str, Field(description="sPoNgEbOb MoCkInG tExT")]
)
print(result)
@app.post("/chat")
async def chat(message: str):
asyncio.create_task(handle_message(message))
return {"message": "Message received"}
MikeT
09/04/2024, 4:31 PMflow
you import from controlflow does not accept log_prints=True
. I'm wondering what the difference is between these classes and how to log with them. My environment ended up getting wonky in the process of testing though and I need to clean wipe it and rebuild, which will also let me grab all the newest 3.0 stuff (i was using 3.0rcX builds - if that matters)Nate
09/04/2024, 4:32 PMNate
09/04/2024, 4:34 PMMikeT
09/04/2024, 4:35 PMMikeT
09/04/2024, 4:35 PMMikeT
09/04/2024, 4:35 PM