-
Notifications
You must be signed in to change notification settings - Fork 1
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
Synchronization of Legacy Solr Registry in the new #68
Conversation
…in Opensearch, for new registry load status
@tloubrieu-jpl in the pull request description the password If so, it should be changed as soon as possible! |
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.
Some minor fixes, but definitely a security vulnerability should be addressed
src/pds/registrysweepers/legacy_registry_sync/solr_doc_export_to_opensearch.py
Outdated
Show resolved
Hide resolved
src/pds/registrysweepers/legacy_registry_sync/solr_doc_export_to_opensearch.py
Show resolved
Hide resolved
src/pds/registrysweepers/legacy_registry_sync/solr_doc_export_to_opensearch.py
Show resolved
Hide resolved
src/pds/registrysweepers/legacy_registry_sync/solr_doc_export_to_opensearch.py
Show resolved
Hide resolved
src/pds/registrysweepers/legacy_registry_sync/solr_doc_export_to_opensearch.py
Outdated
Show resolved
Hide resolved
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.
Mandatory: Branch integration tests pass
Other changes requested per granular comments.
docker/sweepers_driver.py
Outdated
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.
request refactor - rather than defining sweepers and optional sweepers, then maintaining separate execution paths for each, it is preferable to
- define a collection of sweepers (either declaratively or by declaring the always-run sweepers then conditionally mutating that collection immediately to add the desired optional sweepers)
- run a common execution path for the set of all sweepers (always + conditional), treating them alike
if that's not clear, let me know and I'll modify it first-thing Tuesday when I'm back at work - it's a quick change.
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.
request: use descriptive variable names in preference to o
, s
request: use a more idiomatic approach to the optional conditional check
- argument should set a binary flag with `action='store_true'
- conditional check should use something like
if sweeper_name in args and arg[sweeper_name] == True
(I forget the syntax for pulling variable-named args from argparser, but you get the idea)
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.
Thanks Alex, indeed I only tested with the option present.
@alexdunnjpl @nutjob4life I made updates to the PR following your comments. I applied the linter on the code and had to add comments to make the linter ignore 3 lines. I also noted that the unit tests are broken but I don't see how this pull request would have an impact on them. |
@tloubrieu-jpl I haven't looked closely at the rest yet, but L520 through L531 show the from the test details/log show the issue There should not be any changes required to the two utilities files - I'd suggest reverting those (given that they happen to be the files referred to in the failing test stage) |
Hi @alexdunnjpl , those changes were made to go through the linter ( Have you had the precommit configuration deployed in your repository (see pre-coomit commands in https://github.com/NASA-PDS/template-repo-python#installation) ? Another question, how do you run the unit tests, I mean with which command ? |
@tloubrieu-jpl both the tests and the linter are/should-be run through The tests may be run via the (somewhat unintuitively-named) The changes under The outstanding (linting) errors are as follows, and will require either installation of the library stubs, or appropriate
My precommit hook (slightly modified so that it re-runs on autofixable failure) is as follows: #!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".py$")
echo "Linting files"
tox -e lint
git add $STAGED_FILES
if [ $? -ne 0 ]
then
echo "Initial lint detected errors, re-linting to determine whether errors remain"
tox -e lint
if [ $? -ne 0 ]
then
exit 1
fi
fi
exit 0 |
@alexdunnjpl @nutjob4life I made some changes to make
Can you review these changes and validate if you are happy with them ? |
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.
Looks good after changes
Hi @nutjob4life , can you validate that your requested changes are done ? Thanks |
Good morning @tloubrieu-jpl, this all checks out 🎉 |
🗒️ Summary
A new sweeper is added.
It can be optionally launched in addition to the default sweepers with option
--legacy-sync
⚙️ Test Data and/or Report
Build the docker image.
Run on
en-delta
:Run in production:
♻️ Related Issues
Fixes #58