Hi! Question about caching - here all tasks have f...
# ask-community
k
Hi! Question about caching - here all tasks have finished, but only one has "duration". Does it mean that all the task that finished, are in one of the successful state, but don't have "duration" were read from cache?
k
Hey @Krzysztof Nawara, will ask the team tom (and also the other question)
Hey @Krzysztof Nawara, it looks like for this one that the ones without duration were read from the cache as they have no Start Time so we can’t calculate a duration. I think you can also verify this behavior if you run the Flow with debug level logs.
k
How do I run flow with debug-level logs? I set export PREFECT__LOGGING__LEVEL=DEBUG for the terminal from which I'm running
prefect server start
but it doesn't seem to be enough. Do I need to specify it for agent/flow when submitting/ both?
k
The agent logs and flow logs are separate. I think it’ll be easier to do it from the run config like
LocalRun(env={"PREFECT__LOGGING__LEVEL": "DEBUG"})
for the Flow side, and for the agent it would be
prefect agent local start --log-level=DEBUG
. It’s a bit harder if you are using the Python interface to spin up the agent. You need to modify the
config.toml
with:
Copy code
[cloud.agent]
level = "debug"
Yes that environment variable needs to be on the machine that is running the Flow (not on the serve machine)
k
Okay, so to be able to see DEBUG level logs in Prefect UI it's enough to set _export PREFECT__LOGGING__LEVEL=DEBUG_ for my Python script which will be submitting (calling flow.submit()) flow? And then that version of a flow will always be executed with DEBUG logging?
k
A bit unclear what you’re asking. The environment variable
PREFECT___LOGGING___LEVEL
needs to be on the agent that is executing the Flow. If you export it and register on a different machine, that environment variable will not be registered along with your Flow. The way to attach it to you Flow through be through the RunConfig like
LocalRun(env={"PREFECT__LOGGING__LEVEL": "DEBUG"})
, which would then set the environment variable when you run your flow.
k
Okay, I tried setting the env variable for the flow, let me try with the RunConfig
Works now, thanks. It seems that adding --log-level=DEBUG to agent doesn't work, it needs to have export PREFECT__LOGGING__LEVEL=DEBUG defined
k
I think the
log-level
flag is not available for all types of agents.