Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove automatically deleting indices for orphaned jobs #2038

Merged
merged 3 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions connectors/services/job_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,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.es_management_client.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.es.management_client.ESManagementClient.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)
Loading