Skip to content

Conversation

@mbertrand
Copy link
Member

@mbertrand mbertrand commented Sep 27, 2024

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/5615

Description (What does it do?)

  • Retry subtasks on SystemExit
  • Refactor task options
  • In docker, tasks only seem to be retried after a shutdown if there is one celery command issued instead of 2, so adjusted the docker-compose command for celery startup.

How can this be tested?

Testing works best if you have lots of courses and contentfiles ingested, otherwise the indexing task might finish before the celery worker stops. You could try running the folliowing after setting OLL_ settings to the same as RC, and also SKIP_TIKA=True to speed things up a bit:

./manage.py backpopulate_oll_data
./manage.py backpopulate_oll_files

Alternately, you could add some sleep(10) calls within the indexing subtask functions to slow them down.

Open 3 terminals:

  • Terminal 1: docker compose up
  • Terminal 2: when ready, ./manage.py recreate_index --all
  • Terminal 3: Once you start seeing a bunch of recreate_index subtasks running like index_learning_resources, run docker compose stop celery. Wait until you see that celery has exited in terminal 1. Then run docker compose up celery
  • Once celery has restarted, the recreate_index tasks should resume, and eventually the task in terminal 2 should complete successfully.

Additional Context

@mbertrand mbertrand force-pushed the mb/task_retry_sysexit_2 branch 2 times, most recently from e6eb39d to 320df92 Compare September 30, 2024 21:10
@mbertrand mbertrand force-pushed the mb/task_retry_sysexit_2 branch from 1927749 to fdb93cf Compare October 1, 2024 14:49
@mbertrand mbertrand added Needs Review An open Pull Request that is ready for review and removed Work in Progress labels Oct 1, 2024
@shanbady shanbady self-assigned this Oct 1, 2024
@shanbady shanbady self-requested a review October 1, 2024 15:24
Copy link
Contributor

@shanbady shanbady left a comment

Choose a reason for hiding this comment

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

This appears to work well! I tried breaking it in various ways and couldn't.

@shanbady shanbady added Waiting on author and removed Needs Review An open Pull Request that is ready for review labels Oct 1, 2024
@mbertrand mbertrand merged commit 44221ac into main Oct 1, 2024
10 checks passed
@odlbot odlbot mentioned this pull request Oct 1, 2024
3 tasks
@mbertrand mbertrand deleted the mb/task_retry_sysexit_2 branch October 23, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants