Skip to content

Add script to retry failed ingestion job#1927

Open
vish-cs wants to merge 1 commit intodatacommonsorg:masterfrom
vish-cs:rollback
Open

Add script to retry failed ingestion job#1927
vish-cs wants to merge 1 commit intodatacommonsorg:masterfrom
vish-cs:rollback

Conversation

@vish-cs
Copy link
Contributor

@vish-cs vish-cs commented Mar 23, 2026

Added a script that identifies failed imports within a specific Dataflow job,
reverts the failed imports in the Spanner database to their last known
good version, resets any 'PENDING' imports back to 'STAGING', and
optionally retriggers the Spanner ingestion workflow.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a crucial automation script designed to enhance the resilience of Dataflow ingestion pipelines. By automatically detecting failed imports, rolling back their state in Spanner to a consistent previous version, and resetting pending jobs, the script significantly reduces manual intervention required for recovery. This ensures that ingestion workflows can self-correct and resume processing efficiently after transient failures, improving overall data reliability and operational efficiency.

Highlights

  • New Script for Dataflow Ingestion Retries: A new Python script, retry_failed_ingestion.py, has been added to automate the process of retrying failed Dataflow ingestion jobs.
  • Failed Import Identification: The script identifies specific imports that failed during a Dataflow job by parsing job messages and parameters, including cases where the job failed globally.
  • Spanner Database Rollback: It reverts failed imports in the Spanner database to their last known good version and updates their status to 'STAGING', preventing infinite retry loops for recently reverted imports.
  • Pending Import Reset: All imports stuck in a 'PENDING' state within Spanner are reset to 'STAGING' to ensure they are re-processed.
  • Workflow Retriggering: The script can optionally retrigger the Spanner ingestion workflow, passing an is_retry=True argument, to initiate a new attempt for the affected imports.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new script to automate the process of retrying failed Dataflow ingestion jobs. The script is well-structured, using functions to isolate responsibilities like identifying failed imports, reverting them in Spanner, and retriggering the workflow.

My review focuses on a critical issue in the revert_import function where it fails to return the transaction's status, which disables the infinite-loop protection mechanism.

I've provided a detailed comment with a code suggestion for this point.

@vish-cs vish-cs requested a review from ajaits March 23, 2026 17:18
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.

1 participant