Skip to content

Commit

Permalink
Fix static checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana committed Nov 28, 2024
1 parent 2d7cdc2 commit 866cbc9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
1 change: 0 additions & 1 deletion ray_provider/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from ray.job_submission import JobStatus

TERMINAL_JOB_STATUSES = {JobStatus.SUCCEEDED, JobStatus.STOPPED, JobStatus.FAILED}

24 changes: 19 additions & 5 deletions tests/test_triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 866cbc9

Please sign in to comment.