@@ -25,9 +25,9 @@ def dummy_backend(requests_mock) -> DummyBackend:
2525
2626class TestTaskResult :
2727 def test_default (self ):
28- result = _TaskResult (job_id = "j-123" , df_idx = 0 )
28+ result = _TaskResult (job_id = "j-123" , df_idx = 0 )
2929 assert result .job_id == "j-123"
30- assert result .df_idx == 0
30+ assert result .df_idx == 0
3131 assert result .db_update == {}
3232 assert result .stats_update == {}
3333
@@ -37,12 +37,14 @@ def test_start_success(self, dummy_backend, caplog):
3737 caplog .set_level (logging .WARNING )
3838 job = dummy_backend .connection .create_job (process_graph = {})
3939
40- task = _JobStartTask (job_id = job .job_id , df_idx = 0 , root_url = dummy_backend .connection .root_url , bearer_token = "h4ll0" )
40+ task = _JobStartTask (
41+ job_id = job .job_id , df_idx = 0 , root_url = dummy_backend .connection .root_url , bearer_token = "h4ll0"
42+ )
4143 result = task .execute ()
4244
4345 assert result == _TaskResult (
4446 job_id = "job-000" ,
45- df_idx = 0 ,
47+ df_idx = 0 ,
4648 db_update = {"status" : "queued" },
4749 stats_update = {"job start" : 1 },
4850 )
@@ -54,7 +56,9 @@ def test_start_failure(self, dummy_backend, caplog):
5456 job = dummy_backend .connection .create_job (process_graph = {})
5557 dummy_backend .setup_job_start_failure ()
5658
57- task = _JobStartTask (job_id = job .job_id , df_idx = 0 , root_url = dummy_backend .connection .root_url , bearer_token = "h4ll0" )
59+ task = _JobStartTask (
60+ job_id = job .job_id , df_idx = 0 , root_url = dummy_backend .connection .root_url , bearer_token = "h4ll0"
61+ )
5862 result = task .execute ()
5963
6064 assert result == _TaskResult (
@@ -77,8 +81,6 @@ def test_hide_token(self, serializer):
7781 assert secret not in serialized
7882
7983
80-
81-
8284class NopTask (Task ):
8385 """Do Nothing"""
8486
@@ -115,8 +117,6 @@ def execute(self) -> _TaskResult:
115117 return _TaskResult (job_id = self .job_id , df_idx = self .df_idx , db_update = {"status" : "all fine" })
116118
117119
118-
119-
120120class TestJobManagerWorkerThreadPool :
121121 @pytest .fixture
122122 def worker_pool (self ) -> Iterator [_JobManagerWorkerThreadPool ]:
@@ -154,7 +154,7 @@ def test_submit_and_process_with_error(self, worker_pool):
154154 assert results == [
155155 _TaskResult (
156156 job_id = "j-666" ,
157- df_idx = 0 ,
157+ df_idx = 0 ,
158158 db_update = {"status" : "threaded task failed" },
159159 stats_update = {"threaded task failed" : 1 },
160160 ),
@@ -171,7 +171,7 @@ def test_submit_and_process_iterative(self, worker_pool):
171171 worker_pool .submit_task (NopTask (job_id = "j-22" , df_idx = 22 ))
172172 worker_pool .submit_task (NopTask (job_id = "j-222" , df_idx = 222 ))
173173 results , remaining = worker_pool .process_futures (timeout = 1 )
174- assert results == [_TaskResult (job_id = "j-22" , df_idx = 22 ), _TaskResult (job_id = "j-222" , df_idx = 222 )]
174+ assert results == [_TaskResult (job_id = "j-22" , df_idx = 22 ), _TaskResult (job_id = "j-222" , df_idx = 222 )]
175175 assert remaining == 0
176176
177177 def test_submit_multiple_simple (self , worker_pool ):
@@ -212,7 +212,7 @@ def test_submit_multiple_blocking_and_failing(self, worker_pool):
212212 events [0 ].set ()
213213 results , remaining = worker_pool .process_futures (timeout = 0.1 )
214214 assert results == [
215- _TaskResult (job_id = "j-0" , df_idx = 0 , db_update = {"status" : "all fine" }),
215+ _TaskResult (job_id = "j-0" , df_idx = 0 , db_update = {"status" : "all fine" }),
216216 ]
217217 assert remaining == n - 1
218218
@@ -221,10 +221,13 @@ def test_submit_multiple_blocking_and_failing(self, worker_pool):
221221 events [j ].set ()
222222 results , remaining = worker_pool .process_futures (timeout = 0.1 )
223223 assert results == [
224- _TaskResult (job_id = "j-1" , df_idx = 1 , db_update = {"status" : "all fine" }),
225- _TaskResult (job_id = "j-2" , df_idx = 2 , db_update = {"status" : "all fine" }),
224+ _TaskResult (job_id = "j-1" , df_idx = 1 , db_update = {"status" : "all fine" }),
225+ _TaskResult (job_id = "j-2" , df_idx = 2 , db_update = {"status" : "all fine" }),
226226 _TaskResult (
227- job_id = "j-3" , df_idx = 3 , db_update = {"status" : "threaded task failed" }, stats_update = {"threaded task failed" : 1 }
227+ job_id = "j-3" ,
228+ df_idx = 3 ,
229+ db_update = {"status" : "threaded task failed" },
230+ stats_update = {"threaded task failed" : 1 },
228231 ),
229232 ]
230233 assert remaining == 1
@@ -234,7 +237,7 @@ def test_submit_multiple_blocking_and_failing(self, worker_pool):
234237 events [j ].set ()
235238 results , remaining = worker_pool .process_futures (timeout = 0.1 )
236239 assert results == [
237- _TaskResult (job_id = "j-4" , df_idx = 4 , db_update = {"status" : "all fine" }),
240+ _TaskResult (job_id = "j-4" , df_idx = 4 , db_update = {"status" : "all fine" }),
238241 ]
239242 assert remaining == 0
240243
@@ -260,7 +263,7 @@ def test_job_start_task(self, worker_pool, dummy_backend, caplog):
260263 assert results == [
261264 _TaskResult (
262265 job_id = "job-000" ,
263- df_idx = 0 ,
266+ df_idx = 0 ,
264267 db_update = {"status" : "queued" },
265268 stats_update = {"job start" : 1 },
266269 )
@@ -278,7 +281,9 @@ def test_job_start_task_failure(self, worker_pool, dummy_backend, caplog):
278281
279282 results , remaining = worker_pool .process_futures (timeout = 1 )
280283 assert results == [
281- _TaskResult (job_id = "job-000" , df_idx = 0 , db_update = {"status" : "start_failed" }, stats_update = {"start_job error" : 1 })
284+ _TaskResult (
285+ job_id = "job-000" , df_idx = 0 , db_update = {"status" : "start_failed" }, stats_update = {"start_job error" : 1 }
286+ )
282287 ]
283288 assert remaining == 0
284289 assert caplog .messages == [
0 commit comments