Hi, Is it possible to access a flow run's logs through prefect python code?
a
Anna Geller
10/28/2021, 9:17 PM
the easiest is when you trigger your flow from the CLI
Copy code
prefect run --id flow-uuid --watch
h
Harish
10/28/2021, 9:19 PM
Thanks! let me try this..
k
Kevin Kho
10/28/2021, 9:40 PM
Hey @Harish, are you trying to run this in a notebook? or through a Python script?
h
Harish
10/28/2021, 9:44 PM
I was trying to access logs to a previous run, but the above command run a flow instead. Yes its run as a python code.
k
Kevin Kho
10/28/2021, 9:47 PM
You can try hitting the GraphQL API with something like this for the flow run
Copy code
query {
flow_run{
logs {
message
}
}
}
upvote 1
👀 1
h
Harish
10/28/2021, 9:47 PM
I was also thinking of switching to writing logs to a file rather than logging in Prefect as it can only keep 2 weeks of history. Do you know if there is an easy to switch it in Prefect?
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.