https://prefect.io logo
Title
b

Bryan Whiting

01/10/2023, 4:38 AM
Cross posting, thanks in advance
c

Christopher Boyd

01/10/2023, 3:19 PM
Can you elaborate with an example of what you are trying to do perhaps? Tasks and flows have separate loggers - it sounds like you dont want a logger at the task level, but you do want to log the task being called at the flow level with the task submission? could you log an f-string as you call the task?
:plus-one: 1
b

Bryan Whiting

01/12/2023, 3:38 AM
The automated logging says “created task”. When I use the “map” command, it says this hundreds of times. I’d like this specific log to say what i passed into the task.
Are “tags” the way to do this?
If this is my code:
from prefect import flow, task
@task
def print_nums(nums):
    for n in nums:
        print(n)
@task
def square_num(num):
    return num**2
@flow
def map_flow(nums):
    print_nums(nums)
    squared_nums = square_num.map(nums) 
    print_nums(squared_nums)
map_flow([1,2,3,5,8,13])
Then I’d want the logger to say “created task squared_num-98avj97 for squared_num with input 2” And the next log would say “for squared him with input 3”, and so on