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

feat: continue export in a new job after minutes-limit is reached #185

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

shadinaif
Copy link
Collaborator

@shadinaif shadinaif commented Jan 22, 2025

feat: continue export in a new job after minutes-limit is reached

The problem is that the new behavior of celery after the upgrade is to restart tasks automatically after 60 minutes. Many export tasks require more than an hour to finish. Therefore, we implement a continuing mechanism that creates a continue-job after a configured number of minutes and then terminates the current one.

Here is the flow:

  • Export-Task created by the export API
  • The Export-Task creates a celery-task to process the export
  • Celery starts the celery-task
  • The celery-task continually checks for elapsed time since the start of itself
  • If minutes-limit is reached (which is 5 minutes by default):
    • The celery-task uploads the collected data to S3 in a partial file
    • The celery-task initiates a new celery-task with a mark that identifies the continuing point
    • The celery-task stops
    • Celery starts the new celery-task
  • If the data is fully collected:
    • If this is a continuation celery-task:
      • The celery-task uploads the collected data to S3 in a partial file
      • The celery-task downloads all partial files into a single local file
      • The celery-task uploads the local file to S3 as the final exported file
      • The celery-task deletes all partial files from S3
    • If this is the first celery-task:
      • The celery-task uploads the collected data to S3 as the final exported file
    • The celery-task marks the Export-Task as completed

@shadinaif shadinaif force-pushed the shadinaif/split-export branch 3 times, most recently from 4791be2 to 44731b6 Compare January 27, 2025 07:57
@shadinaif shadinaif marked this pull request as ready for review January 27, 2025 07:59
@shadinaif shadinaif force-pushed the shadinaif/split-export branch 9 times, most recently from 19fbb5c to 9548788 Compare January 28, 2025 16:10
@shadinaif shadinaif force-pushed the shadinaif/split-export branch from 9548788 to a07544a Compare January 28, 2025 17:10
@shadinaif shadinaif merged commit 5a7c284 into main Jan 28, 2025
4 checks passed
@shadinaif shadinaif deleted the shadinaif/split-export branch January 28, 2025 17:15
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