A relatively straight forward question: how can we...
# ask-the-community
l
A relatively straight forward question: how can we add a timeout on a task and let a corresponding map_task succeed? 🧵
What I have tried:
Copy code
@task(timeout=10)
def task1(a: int):
    time.sleep(a)

@workflow
def my_workflow():
    result = map_task(task1, min_success_ratio=0.0)(a=[1,2,10,11,12])
However the map_task fails with a timeout as
[1/1] currentAttempt done. Last Error: USER::task execution timeout [10s] expired
n
Hi Len, what behavior are you expecting?
l
Great question. I would like the set of tasks to complete even when an input might trigger compute that lasts longer than the timeout allowed.
And specifically, I would expect result to be of length 2
I am not sure if that most recent expectation ^ is reasonable or not.
n
so timeout is the maximum amount of time a task can run before timing out… is there a reason you don’t want to increase the timeout?
or do you want the map task to pass through failing tasks and return the succeeded tasks?
l
I would like it to only return succeeded tasks.
n
you can specify
min_success_ratio
in the map_task definition to say what percentage of tasks within the maptask would count as an overall success
l
My particular use case: • I have three tasks (each of which I am profiling different nearest neighbors search frameworks) • I have a product of inputs, some of which will cause certain tasks to take forever, but other tasks will finish in a reasonable amount of time (gpu enabled)
@Niels Bantilan I have tried that as shown in my snippet above, but the overall map_task fails.
n
hmm, this seems like a bug @Eduardo Apolinario (eapolinario) @Yee @Kevin Su
l
OK, I’ll try to make an actual mre. Note that I tried timeout locally and it seems ignored.
n
unless maptask
min_success_ratio
only considers exceptions raised within the actual task and not timed out tasks…
l
That is my guess tbh
n
are you running these locally btw?
l
I started locally, but timeout didn’t seem to do anything so I started developing remotely and fast registering.
That is where I saw the first error that the map_task failed
n
okay, just making sure you’re seeing this on an actual Flyte cluster
e
@Len Strnad, mind opening a github issue? This is bug in the current implementation of map tasks.
l
Thanks all! I appreciate the attention on this. 🙏
n
@Ariel Kaspit