Add an option to process only last rows #159
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
Related to https://github.com/mitodl/hq/issues/4550 and https://github.com/mitodl/hq/issues/4503
Description (What does it do?)
This PR attempts to reduce the time the task is running and to prevent unnecessary reprocessing of the whole sheet, since it is only getting longer.
Add a log info message to state which rows got processed.
How can this be tested?
You would need to set up google sheets to run locally. Follow the instructions here.
Here is the list of vars that you need set in your .env file in your local mitxonline:
To test the changes of google sheets in your mitxonline instance you would need to :
pants package ::
cp dist/mitol-django-google-sheets-2023.12.19.1.tar.gz ../mitxonline
COPY . /app
beforeRUN poetry install
docker-compose build
When your task is running successfully you should see logs about the rows that are being processed, "Going to process the sheet starting with row 6"
"Ignored rows in Enrollment Change Request sheet (Refunds): [6, 7, 8]"
"Processed rows with errors in Enrollment Change Request sheet (Refunds): [6, 7, 8]"
Try setting
MITOL_GOOGLE_SHEETS_PROCESS_ONLY_LAST_ROWS_NUM=2
in your .env file, then clear all the errors from the sheet and wait the task to run again. It should process only the last 2 rows. By default it is set to 30 rows. If the number of filled out rows is less theMITOL_GOOGLE_SHEETS_PROCESS_ONLY_LAST_ROWS_NUM
it will process all rows.