Joe Schmid
04/25/2020, 3:50 AMon_execute()
(or the existing on_start()
) called from an Environment. I can pass the environment's self.logger
-- that seems clunky, but the following doesn't seem to work:
def on_execute(parameters: Dict[str, Any], provider_kwargs: Dict[str, Any]) -> None:
logger = prefect.context.get("logger")
<http://logger.info|logger.info>("Checking Flow run parameters: {}".format(parameters))
Chris White
04/25/2020, 3:55 AMlogger = prefect.utilities.logging.get_logger("Joe's Cool Logger")
Some background / behind the scenes info here:
context
is (generally speaking) only populated by Flow / Task Runners, so there are many keys in context that only available after the Runners have been instantiated. Environments and storage are two of the only places that run code outside of these runner pipelinesJoe Schmid
04/25/2020, 3:57 AMlogger = prefect.utilities.logging.get_logger(__name__)
Chris White
04/25/2020, 3:59 AMMarvin
04/25/2020, 4:02 AM