Is there a simple way to disable the `Task 'xy[z]'...
# prefect-server
t
Is there a simple way to disable the
Task 'xy[z]': Finished task run…
messages?
p
You can simply set an environment variable as per the docs, e.g.
PREFECT__LOGGING__LEVEL=WARNING
t
But doesn’t this also impact tasks? i.e:
Copy code
@task()
def test():
    <http://prefect.context.logger.info|prefect.context.logger.info>("hello")
won’t work?
k
I think there is no simple way but you might be able to do this with Python logging filters. For example (see :
Copy code
import prefect
from prefect import task, Flow, Parameter
from prefect.triggers import all_successful, any_failed, always_run, all_failed
import logging

class MyFilter(logging.Filter):
    def filter(self,record):
        return 'Task' not in record.msg

@task()
def success_handler():
    logger = prefect.context.get("logger")
    <http://logger.info|logger.info>("Handled task success")

with Flow("TestFlow") as flow:
    success_handler()

# Add the filter
logging.getLogger("prefect.TaskRunner").addFilter(MyFilter())

flow.run()
But then I think you need to store your Flow as a script for this Filter to apply.
t
Argh, yeah. This also won’t work if you’re using a remote Dask cluster I think.
Just an FYI, the messages are not entirely useful especially if you’re launching a large number of tasks. It makes it much harder to see errors or other conditions you care about
k
Will elevate the feedback and see if something can be done around this.