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

Add Functionality to Stop a Running Job on the Harvest Job Page #4897

Open
Jin-Sun-tts opened this issue Sep 19, 2024 · 1 comment
Open

Add Functionality to Stop a Running Job on the Harvest Job Page #4897

Jin-Sun-tts opened this issue Sep 19, 2024 · 1 comment
Labels
Discuss H2.0/Harvest-Flask Front-end webapp & APIs

Comments

@Jin-Sun-tts
Copy link
Contributor

User Story

Implement a feature on the Harvest Job Page that allows users to stop a running job. Upon cancelling, the backend should handle job cancellation by updating the job's status in the HarvestDB job table and associated error table, marking the job as 'error'.

Acceptance Criteria

Frontend:

  • Add a "Stop Job" button to the Harvest Job Page.
  • The button should be disabled for completed or already stopped jobs.
  • A confirmation modal should appear when the "Stop Job" button is clicked, asking the user to confirm the cancellation.

Backend:

  • On job cancellation, update the job's status in the harvest_job table to "error".
  • Update any relevant entries in the job_error table.
  • Ensure that any running processes tied to the job are properly terminated.
  • Return appropriate success or error responses to the frontend.

Testing:

  • Write unit and integration tests to verify that stopping a job updates both the job and error tables.
  • Ensure edge cases are tested (e.g., stopping already completed jobs, handling database errors).
@Jin-Sun-tts Jin-Sun-tts added the H2.0/Harvest-Flask Front-end webapp & APIs label Sep 19, 2024
@Bagesary Bagesary moved this to H2.0 Backlog in data.gov team board Sep 19, 2024
@btylerburton btylerburton moved this from H2.0 Backlog to 📥 Queue in data.gov team board Oct 10, 2024
@btylerburton
Copy link
Contributor

We rewrite this to account for the gap created by marking jobs complete when they are in mid-run.

My thinking is instead of doing complicated calculations to update current job progress, we:

  • mark the job COMPLETE
  • whenever a new job runs it will cleanse the DB of any records that do not have a CKAN_ID, which means they didn't sync.
  • This should account for any cases where the job doesn't terminate on its own

We should discuss this as a team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discuss H2.0/Harvest-Flask Front-end webapp & APIs
Projects
Status: 📥 Queue
Development

No branches or pull requests

2 participants