This is an automated email from the ASF dual-hosted git repository.

eamonford pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git


The following commit(s) were added to refs/heads/master by this push:
     new 9979ee6  SDAP-296: Make deletebyquery script work out-of-the-box in 
webapp Docker image (#112)
9979ee6 is described below

commit 9979ee63f98a81f8d5b0627ba02fb60e5bc662fa
Author: Eamon Ford <[email protected]>
AuthorDate: Wed Nov 25 10:56:15 2020 -0800

    SDAP-296: Make deletebyquery script work out-of-the-box in webapp Docker 
image (#112)
---
 docker/nexus-webapp/Dockerfile       |  7 ++++++-
 tools/deletebyquery/README.md        | 25 +++++++++++++++++++++++++
 tools/deletebyquery/deletebyquery.py | 10 ++++++----
 tools/deletebyquery/requirements.txt | 21 ---------------------
 4 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/docker/nexus-webapp/Dockerfile b/docker/nexus-webapp/Dockerfile
index 92df8d4..d789bc2 100644
--- a/docker/nexus-webapp/Dockerfile
+++ b/docker/nexus-webapp/Dockerfile
@@ -82,6 +82,7 @@ RUN /tmp/install_nexusproto.sh $APACHE_NEXUSPROTO 
$APACHE_NEXUSPROTO_BRANCH
 
 COPY data-access /incubator-sdap-nexus/data-access
 COPY analysis /incubator-sdap-nexus/analysis
+COPY tools /incubator-sdap-nexus/tools
 
 WORKDIR /incubator-sdap-nexus/data-access
 RUN python setup.py install
@@ -89,7 +90,11 @@ RUN python setup.py install
 WORKDIR /incubator-sdap-nexus/analysis
 RUN python setup.py install
 
-COPY tools /incubator-sdap-nexus/tools
+WORKDIR /incubator-sdap-nexus/tools/deletebyquery
+RUN pip install -r requirements.txt
+RUN rm requirements.txt
+
+WORKDIR /incubator-sdap-nexus
 
 # Upgrade kubernetes client jar from the default version
 RUN rm /opt/spark/jars/kubernetes-client-4.1.2.jar
diff --git a/tools/deletebyquery/README.md b/tools/deletebyquery/README.md
new file mode 100644
index 0000000..97cf4db
--- /dev/null
+++ b/tools/deletebyquery/README.md
@@ -0,0 +1,25 @@
+# Deleting Datasets from SDAP
+
+## Prerequisites
+
+_If you are running the `deletebyquery.py` script from within the 
nexus-webapp-driver Docker image, the following prerequisites are not 
necessary._
+
+* Run `python setup.py install` in `incubator-sdap-nexus/data-access` 
+* Run `python setup.py install` in `incubator-sdap-nexus/analysis` 
+* Run `pip install -r requirements.txt` in 
`incubator-sdap-nexus/tools/deletebyquery`
+
+## Running the Script
+_Note: It is recommended to run this from within the nexus-webapp-driver 
Docker image._
+
+```
+python deletebyquery.py --solr <solr host>:8983 --cassandra <cassandra host> 
--cassandraUsername <cassandra username> --cassandraPassword <cassandra 
password> --query '<solr query>'
+```
+
+Run `python deletebyquery.py` without any arguments to see the full list of 
options.
+
+## Usage Example
+To delete a dataset called `my_dataset`, with SDAP deployed using the Helm 
chart, run the following from within the nexus-webapp-driver Docker image:
+```
+cd /incubator-sdap-nexus/tools/deletebyquery
+python deletebyquery.py --solr sdap-solr-svc:8983 --cassandra sdap-cassandra 
--cassandraUsername cassandra --cassandraPassword cassandra --query 
'dataset_s:"my_dataset"'
+```
\ No newline at end of file
diff --git a/tools/deletebyquery/deletebyquery.py 
b/tools/deletebyquery/deletebyquery.py
index 6e24367..8ed70dd 100644
--- a/tools/deletebyquery/deletebyquery.py
+++ b/tools/deletebyquery/deletebyquery.py
@@ -201,14 +201,15 @@ def parse_args():
 
     parser.add_argument('--collection',
                         help='The name of the SOLR collection.',
-                        required=True,
+                        required=False,
+                        default='nexustiles',
                         metavar='nexustiles')
 
     parser.add_argument('--solrIdField',
                         help='The name of the unique ID field for this 
collection.',
                         required=False,
-                        default='solr_id_s',
-                        metavar='solr_id_s')
+                        default='id',
+                        metavar='id')
 
     parser.add_argument('--cassandra',
                         help='The hostname(s) or IP(s) of the Cassandra 
server(s).',
@@ -218,7 +219,8 @@ def parse_args():
 
     parser.add_argument('-k', '--cassandraKeyspace',
                         help='The Cassandra keyspace.',
-                        required=True,
+                        default='nexustiles',
+                        required=False,
                         metavar='nexustiles')
 
     group = parser.add_mutually_exclusive_group(required=True)
diff --git a/tools/deletebyquery/requirements.txt 
b/tools/deletebyquery/requirements.txt
index dc55df7..df8a421 100644
--- a/tools/deletebyquery/requirements.txt
+++ b/tools/deletebyquery/requirements.txt
@@ -1,22 +1 @@
-appnope==0.1.0
-backports.shutil-get-terminal-size==1.0.0
-cassandra-driver==3.9.0
-decorator==4.0.11
-enum34==1.1.6
-futures==3.1.1
-ipython==5.3.0
-ipython-genutils==0.2.0
-pathlib2==2.2.1
-pexpect==4.2.1
-pickleshare==0.7.4
-prompt-toolkit==1.0.14
-ptyprocess==0.5.1
-Pygments==2.2.0
-requests==2.13.0
-scandir==1.5
-semver==2.7.6
-simplegeneric==0.8.1
-six==1.10.0
 solrcloudpy==2.4.1
-traitlets==4.3.2
-wcwidth==0.1.7

Reply via email to