Skip to content

Instantly share code, notes, and snippets.

Created November 13, 2020 14:32
What would you like to do?
prefect testing flow
import prefect
from prefect import task, Flow, Parameter, flatten, unmapped
from prefect.engine.executors import DaskExecutor
from prefect.environments import LocalEnvironment
from logger_utils import function_logger
import time
def inner():
logger = function_logger()'i am the inner function--new logger')
@task(task_run_name=lambda **kwargs: f"testing-logger-writing-logs-{kwargs['x']}-suiname")
def wlog(x):
from prefect import context
logger = context.get("logger")
logger.debug('i am the task')
# logger = prefect_logging_setup('test')'start sleep')
time.sleep(20)'done sleep')
a = list(range(10))
with Flow("logging-flow",environment=LocalEnvironment(DaskExecutor(address='tcp://'))) as flow:
# logger = prefect.utilities.logging.get_logger()
#'this log is generated in the flow')
out_task =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment