Skip to content

Instantly share code, notes, and snippets.

@lukeorland
Created July 15, 2020 20:15
Show Gist options
  • Save lukeorland/dd0b183832aea1f2f725b596b1f095fa to your computer and use it in GitHub Desktop.
Save lukeorland/dd0b183832aea1f2f725b596b1f095fa to your computer and use it in GitHub Desktop.
import prefect
from prefect import Flow, Parameter, task
@task
def func_factory():
def func():
prefect.context.get('logger').info('this is a func')
return func
@task
def call_func(func):
prefect.context.get('logger').info(f'calling function {func.__name__}')
func()
with Flow('function_as_prefect_task_result') as flow:
new_func = func_factory()
call_func(new_func)
flow.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment