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

IndexJob lifecycle #1697

Open
lukavdplas opened this issue Nov 8, 2024 · 0 comments
Open

IndexJob lifecycle #1697

lukavdplas opened this issue Nov 8, 2024 · 0 comments
Assignees

Comments

@lukavdplas
Copy link
Contributor

Part of #1007

After #1696, there should be an IndexJob that records indexing tasks, but is essentially just a log.

Refactor the indexing functionality so it is centred around the lifecycle of an IndexJob. More concretely, allow administrators to create jobs in the admin site that will actually be run.

  • You can create a new IndexJob using the admin site. This just creates the object with status "pending".
  • Using an admin action, you can start a pending job. I-analyzer will use celery to execute the job asynchronously. Status is updated to "in progress".
  • You can interrupt a job using a Django admin action. This kills the task in celery and sets the status to "aborted".
  • When the celery task completes or fails, the status is updated to "complete" or "error".

CLI

It's possible to keep the index and alias commands function as they do now. Under the hood, those commands would need to:

  • Create an IndexJob that describes the action (this should already be implemented in IndexJob model #1696)
  • Immediately start the job, and run the celery task synchronously.

Alternatively, you could rework the command line interface to be parallel to the admin actions. So you use index and alias to create the IndexJob without running it. Then you could add commands to view, start, and stop index jobs. (But you could also create a job in the command line and then start it from the admin site, or vice versa.)

@lukavdplas lukavdplas self-assigned this Nov 14, 2024
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

No branches or pull requests

1 participant