Skip to content

Logging config from within task function #629

Answered by rsokl
dkajtoch asked this question in Q&A
Discussion options

You must be logged in to vote

You might also consider using zen's pre_call argument. This accepts a function that is passed the full config before calling the main task function that you are using:

def log_config(cfg): ...
def main_fn(x, y, z): ...

task_function = zen(main_fn, pre_call=log_config)

The advantage to this is that you don't need to modify main_fn's signature/body to add logging and you can use log_config across applications.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@rsokl
Comment options

Answer selected by rsokl
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants