-
Notifications
You must be signed in to change notification settings - Fork 3
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 model #1699
IndexJob model #1699
Conversation
remove tasks method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really clean, concise, clear. Good work. Feel free to merge after resolving, or substantiated ignoring, my comments.
backend/es/es_index.py
Outdated
if rollover and not prod: | ||
logger.warning( | ||
'rollover flag is set but prod flag not set -- no effect') | ||
# tasks below are added in order of execution for readability |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If/else monstrosity :(
I would cut the below part up into separate utility functions (one for each toplevel if/else
) with some documentation on what decision is made here.
Add an
IndexJob
model to track indexing commands -> close #1696The
IndexJob
describes a set of index-related tasks. (E.g. create new index for a corpus, populate it with documents, and update the alias.) Tasks are broken up intoIndexTask
models.At this point, the
IndexJob
is essentially a log for theindex
andalias
commands; you can't create a job and then run it. Also, the model does not include status tracking. I'll tackle these in #1697Functions related to indexing commands are refactored. The
index
andalias
now create anIndexJob
to describe the command, and then callperform_indexing(job)
to run it. This makes up the most hefty changes in code, as it separates "figuring out what to do" from actually doing it.There is a new
indexing
app which contains indexing-related models. This was to keepmodels.py
from becoming too bloated. Functions and commands related to indexing should probably be moved to this app eventually, but I did not do that here.The
index
andalias
commands still work as before, with a few slight changes toindex
:--add
, like you would in production mode. Runningpython manage.py index mycorpus
when the index already exists will raise an error, unless you use--delete
or--add
.--update
no longer excludes the option to use--rollover.
(the crowd goes wild)Small addition:
min_date
/max_date
in a Python corpus definition as adate
type instead ofdatetime
. Though individual corpora may still implementsources()
in a way that doesn't support this.Deployment configuration
The
'indexing'
app must be added in the project settings.