File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,31 @@ def test_batched(self):
8282 self .assertEqual (len (result_lst ), 4 )
8383 self .assertTrue (t3 - t2 > t2 - t1 )
8484
85+ def test_batched_error_future (self ):
86+ with SingleNodeExecutor () as exe :
87+ t1 = time ()
88+ future_first_lst = []
89+ for i in range (10 ):
90+ if i % 3 == 0 :
91+ future_first_lst .append (exe .submit (raise_error , parameter = 0 ))
92+ else :
93+ future_first_lst .append (exe .submit (return_input_dict , i ))
94+ future_second_lst = exe .batched (future_first_lst , n = 3 )
95+
96+ future_third_lst = []
97+ for f in future_second_lst :
98+ future_third_lst .append (exe .submit (sum , f ))
99+
100+ t2 = time ()
101+ self .assertEqual (future_third_lst [0 ].result (), 7 )
102+ self .assertEqual (future_third_lst [1 ].result (), 20 )
103+ with self .assertRaises (RuntimeError ):
104+ future_third_lst [2 ].result ()
105+ with self .assertRaises (RuntimeError ):
106+ future_third_lst [3 ].result ()
107+ t3 = time ()
108+ self .assertTrue (t3 - t2 > t2 - t1 )
109+
85110 def test_batched_error (self ):
86111 with self .assertRaises (TypeError ):
87112 with SingleNodeExecutor () as exe :
You can’t perform that action at this time.
0 commit comments