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

Stateful ingestion #381

Merged
merged 3 commits into from
Nov 27, 2024
Merged

Stateful ingestion #381

merged 3 commits into from
Nov 27, 2024

Conversation

LavMatt
Copy link
Contributor

@LavMatt LavMatt commented Nov 27, 2024

This PR enables stateful ingestion in the custom ingestion source we've written for justice-data.

This means it will soft-delete entities that are not in the data for ingestion in any latest run when compared to the previous run.

We currently delete all justice-data before each ingestion but this is a better approach.

datahub guidance: https://datahubproject.io/docs/metadata-ingestion/docs/dev_guides/add_stateful_ingestion_to_source/

I tested this by not excluding any ids and then reingesting and then adding the exclusions back in for another ingestion, this is logged by the source report (and the entities are removed from datahub)

[2024-11-27 15:09:24,213] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,jin-prison-population-age)
[2024-11-27 15:09:24,214] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,jin-legal-aid-total-expenditure)
[2024-11-27 15:09:24,214] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,mi015b)
[2024-11-27 15:09:24,214] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:corpGroup:crosscuttingperformanceenquiries
[2024-11-27 15:09:24,215] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,court-number-of-receipts-rape)
[2024-11-27 15:09:24,215] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,jin-prison-ownership)
[2024-11-27 15:09:24,215] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,mi014)
[2024-11-27 15:09:24,215] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,jin-prison-population-offence)
[2024-11-27 15:09:24,216] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,mi015a)
[2024-11-27 15:09:24,216] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,mi016)
[2024-11-27 15:09:24,216] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,entry-to-completion-crown-mean-all)
[2024-11-27 15:09:24,216] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,jin-prison-type)
[2024-11-27 15:09:24,216] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,mi017a)
[2024-11-27 15:09:24,217] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,mi017b)
[2024-11-27 15:09:24,217] INFO     {datahub.ingestion.source.state.stale_entity_removal_handler:216} - Soft-deleting stale entity - urn:li:chart:(justice-data,jin-prison-population-sex)

We should look to implement the same across our other custom ingestion sources.

@LavMatt LavMatt marked this pull request as ready for review November 27, 2024 15:25
Copy link
Contributor

@MatMoore MatMoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍🏻

@LavMatt LavMatt merged commit c4d7299 into main Nov 27, 2024
3 checks passed
@LavMatt LavMatt deleted the stateful-ingestion branch November 27, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants