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 catalog indexer worker #4330

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Add catalog indexer worker #4330

wants to merge 6 commits into from

Conversation

stacimc
Copy link
Contributor

@stacimc stacimc commented May 14, 2024

Fixes

Fixes #4147 by @stacimc

Description

TODO:

  • update description
  • add tests

Testing Instructions

just build && just up

Use elasticvue to Delete All Documents from one of your existing indices. I used audio-init-filtered. The index should now have 0 documents.

Now run just catalog/shell, and you should be able to curl the indexer worker.

# Replace the target_index name if you don't have audio-init-filtered
# Note the start_id/end_id we're using, to make it reindex only 100 records
curl -X POST -d '{"model_name": "audio", "table_name": "audio", "start_id": 0, "end_id": 100, "target_index": "audio-init-filtered"}' -H "Content-Type: application/json" 'http://catalog_indexer_worker:8003/task'

You should get back a response like:

{
  "message": "Successfully scheduled task.", 
  "task_id": "adbec2cbc93a4c2f895caf12ede3eb88", 
  "status_check": "http://catalog_indexer_worker:8003/task/adbec2cbc93a4c2f895caf12ede3eb88"
}

Now curl the status_check endpoint that was just returned:

curl 'http://catalog_indexer_worker:8003/task/adbec2cbc93a4c2f895caf12ede3eb88'

And you should see something like:

{
  "task_id": "adbec2cbc93a4c2f895caf12ede3eb88",
  "active": false,
  "model": "audio",
  "target_index": "audio-init-filtered",
  "progress": 100.0,
  "start_time": "2024-05-14 21:27:54.437745",
  "finish_time": "2024-05-14 21:27:54.575137",
  "error": false
}

In elasticvue, you should now see 100 docs in your target index.

If you used a filtered index, you can now query the API (http://localhost:50281/v1/audio) and see that the results are returned as expected. ⚠️ Important: In Elasticvue you must first refresh the index to make the documents available. Then you can inspect them in Elasticvue, or check the API. This will be handled by the DAG later.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (just catalog/generate-docs for catalog
    PRs) or the media properties generator (just catalog/generate-docs media-props
    for the catalog or just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@stacimc stacimc added 🟨 priority: medium Not blocking but should be addressed soon 🌟 goal: addition Addition of new feature 💻 aspect: code Concerns the software code in the repository 🧱 stack: api Related to the Django API 🧱 stack: ingestion server Related to the ingestion/data refresh server 🧱 stack: catalog Related to the catalog and Airflow DAGs labels May 14, 2024
@stacimc stacimc self-assigned this May 14, 2024
@stacimc stacimc mentioned this pull request May 28, 2024
13 tasks
@@ -0,0 +1,71 @@
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from ingestion_server without changes to logic.

@@ -0,0 +1,58 @@
import logging as log
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from ingestion_server without changes to logic.

@@ -0,0 +1,335 @@
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from ingestion_server without changes to logic. This provides the mappings from db record to ES document.

@@ -0,0 +1,51 @@
import logging as log
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from ingestion_server without changes to logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🌟 goal: addition Addition of new feature 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: api Related to the Django API 🧱 stack: catalog Related to the catalog and Airflow DAGs 🧱 stack: ingestion server Related to the ingestion/data refresh server
Projects
Status: 🚧 Draft
Development

Successfully merging this pull request may close these issues.

Implement new catalog indexer-worker
1 participant