Skip to content

Commit

Permalink
Remove automatically deleting indices for orphaned jobs (#2038)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2ecbfed)

# Conflicts:
#	connectors/services/job_cleanup.py
#	tests/services/test_job_cleanup.py
  • Loading branch information
sphilipse committed Jan 9, 2024
1 parent 4112857 commit b091583
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
3 changes: 0 additions & 3 deletions connectors/services/job_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ async def _process_orphaned_jobs(self):
logger.debug("No orphaned jobs found, skipping cleaning")
return

# delete content indices in case they are re-created by sync job
if len(content_indices) > 0:
await self.sync_job_index.delete_indices(indices=list(content_indices))
result = await self.sync_job_index.delete_jobs(job_ids=job_ids)
if len(result["failures"]) > 0:
logger.error(f"Error found when deleting jobs: {result['failures']}")
Expand Down
3 changes: 0 additions & 3 deletions tests/services/test_job_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def mock_sync_job(sync_job_id="1", connector_id="1", index_name="index_name"):

@pytest.mark.asyncio
@patch("connectors.protocol.SyncJobIndex.delete_jobs")
@patch("connectors.protocol.SyncJobIndex.delete_indices")
@patch("connectors.protocol.SyncJobIndex.idle_jobs")
@patch("connectors.protocol.SyncJobIndex.orphaned_jobs")
@patch("connectors.protocol.ConnectorIndex.fetch_by_id")
Expand All @@ -59,7 +58,6 @@ async def test_cleanup_jobs(
connector_fetch_by_id,
orphaned_jobs,
idle_jobs,
delete_indices,
delete_jobs,
):
existing_index_name = "foo"
Expand All @@ -77,7 +75,6 @@ async def test_cleanup_jobs(

await create_and_run_service(JobCleanUpService, config=CONFIG, stop_after=0.1)

delete_indices.assert_called_with(indices=[to_be_deleted_index_name])
delete_jobs.assert_called_with(job_ids=[sync_job.id, another_sync_job.id])
sync_job.fail.assert_called_with(IDLE_JOB_ERROR)
connector.sync_done.assert_called_with(job=sync_job)

0 comments on commit b091583

Please sign in to comment.