From 866cbc95f159a517e540a4abf2f863c4a396da30 Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Thu, 28 Nov 2024 12:21:37 +0000 Subject: [PATCH] Fix static checks --- ray_provider/constants.py | 1 - tests/test_triggers.py | 24 +++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ray_provider/constants.py b/ray_provider/constants.py index 3242e4a..9e37f6a 100644 --- a/ray_provider/constants.py +++ b/ray_provider/constants.py @@ -1,4 +1,3 @@ from ray.job_submission import JobStatus TERMINAL_JOB_STATUSES = {JobStatus.SUCCEEDED, JobStatus.STOPPED, JobStatus.FAILED} - diff --git a/tests/test_triggers.py b/tests/test_triggers.py index 86cc383..fff3fee 100644 --- a/tests/test_triggers.py +++ b/tests/test_triggers.py @@ -43,7 +43,10 @@ async def test_run_no_job_id(self, mock_hook, mock_job_status): ) @pytest.mark.asyncio - @patch("ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", side_effect=[JobStatus.RUNNING, JobStatus.SUCCEEDED]) + @patch( + "ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", + side_effect=[JobStatus.RUNNING, JobStatus.SUCCEEDED], + ) @patch("ray_provider.triggers.RayJobTrigger.hook") async def test_run_job_succeeded(self, mock_hook, mock_job_status): trigger = RayJobTrigger( @@ -65,7 +68,10 @@ async def test_run_job_succeeded(self, mock_hook, mock_job_status): ) @pytest.mark.asyncio - @patch("ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", side_effect=[JobStatus.RUNNING, JobStatus.STOPPED]) + @patch( + "ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", + side_effect=[JobStatus.RUNNING, JobStatus.STOPPED], + ) @patch("ray_provider.triggers.RayJobTrigger.hook") async def test_run_job_stopped(self, mock_hook, mock_job_status, trigger): generator = trigger.run() @@ -80,7 +86,9 @@ async def test_run_job_stopped(self, mock_hook, mock_job_status, trigger): ) @pytest.mark.asyncio - @patch("ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", side_effect=[JobStatus.RUNNING, JobStatus.FAILED]) + @patch( + "ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", side_effect=[JobStatus.RUNNING, JobStatus.FAILED] + ) @patch("ray_provider.triggers.RayJobTrigger.hook") async def test_run_job_failed(self, mock_hook, mock_job_status, trigger): generator = trigger.run() @@ -95,7 +103,10 @@ async def test_run_job_failed(self, mock_hook, mock_job_status, trigger): ) @pytest.mark.asyncio - @patch("ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", side_effect=[JobStatus.RUNNING, JobStatus.SUCCEEDED]) + @patch( + "ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", + side_effect=[JobStatus.RUNNING, JobStatus.SUCCEEDED], + ) @patch("ray_provider.triggers.RayJobTrigger.hook") @patch("ray_provider.triggers.RayJobTrigger._stream_logs") async def test_run_with_log_streaming(self, mock_stream_logs, mock_hook, mock_job_status, trigger): @@ -180,7 +191,10 @@ async def test_cleanup_without_cluster_yaml(self, mock_log_info): @pytest.mark.asyncio @patch("asyncio.sleep", new_callable=AsyncMock) - @patch("ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", side_effect=[JobStatus.RUNNING, JobStatus.RUNNING, JobStatus.SUCCEEDED]) + @patch( + "ray_provider.triggers.RayJobTrigger.hook.get_ray_job_status", + side_effect=[JobStatus.RUNNING, JobStatus.RUNNING, JobStatus.SUCCEEDED], + ) @patch("ray_provider.triggers.RayJobTrigger.hook") async def test_poll_status(self, mock_hook, mock_job_status, mock_sleep, trigger): await trigger._poll_status()