Marwan Sarieddine
01/21/2021, 11:08 PMcontext
object.
Is there a difference between importing the context
globally vs from within a task ?
i.e.
import prefect
@task
def t():
prefect.context.get("...")
vs
@task
def t():
import prefect
prefect.context.get("...")
Also in a good portion of the docs the context
is used as prefect.context
- is that purely for readability reasons or is there a side effect for using from prefect import context
that one should be aware of ? (My current intuition/understanding is that there shouldn't be any difference here)Zanie
import prefect
instead of doing from prefect import context
but I would have to read more about how python populates the module at import-time to know for sure.from prefect import context
Marwan Sarieddine
01/22/2021, 12:20 AMZanie
Alex Papanicolaou
01/22/2021, 1:08 AMZanie
Alex Papanicolaou
01/22/2021, 1:44 AM