Skip to content

Commit

Permalink
CMR-8107: Updated README.
Browse files Browse the repository at this point in the history
  • Loading branch information
ygliuvt committed Aug 11, 2022
1 parent b0fa5f7 commit 7a86798
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 6 additions & 0 deletions bootstrap-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,14 @@ Operator can use the `start_index` parameter to index concepts with sequence num

### Bulk index concepts newer than a given date-time

For all providers and all system concepts:

curl -i -XPOST http://localhost:3006/bulk_index/after_date_time?date_time=2015-02-02T10:00:00Z"

For a given list of providers (use provider `CMR` to index all system concepts):

curl -i -XPOST -H "Content-Type: application/json" -d '{"provider_ids": ["PROV1" "PROV2" "CMR"]}' http://localhost:3006/bulk_index/after_date_time?date_time=2015-02-02T10:00:00Z"

### Bulk index all system concepts (tags/acls/access-groups)

curl -i -XPOST http://localhost:3006/bulk_index/system_concepts
Expand Down
16 changes: 10 additions & 6 deletions bootstrap-app/src/cmr/bootstrap/data/bulk_index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@
[cmr.oracle.connection :as oc]
[cmr.transmit.config :as transmit-config]))

(def ^:private system-concept-provider
"Provider name for indexing system concepts"
"CMR")

(def ^:private elastic-http-try-count->wait-before-retry-time
"A map of of the previous number of tries to communicate with Elasticsearch over http to the amount
of time to wait before retrying an http request. Will stop retrying if the number of requests
exceeds what is configured here. Bulk indexing is expected to succeed everytime so this is fairly
aggressive about retrying and waiting a "
aggressive about retrying and waiting."
{1 100
2 1000
;; 10 seconds
Expand Down Expand Up @@ -204,7 +208,7 @@
"Bulk index tags, acls, and access-groups."
[system start-index]
(let [db (helper/get-metadata-db-db system)
provider {:provider-id "CMR"}
provider {:provider-id system-concept-provider}
total (apply + (for [concept-type [:tag :acl :access-group]
:let [params {:concept-type concept-type
:provider-id (:provider-id provider)}
Expand Down Expand Up @@ -278,7 +282,7 @@
[system date-time]
(let [system-concept-response-map (for [concept-type [:tag :acl :access-group]]
(fetch-and-index-new-concepts
system {:provider-id "CMR"} concept-type date-time))
system {:provider-id system-concept-provider} concept-type date-time))
max-revision-date (apply util/max-compare
(map :max-revision-date system-concept-response-map))
system-concept-count (reduce + (map :num-indexed system-concept-response-map))]
Expand All @@ -291,7 +295,7 @@
(info (format "Indexing concepts with revision-date later than [%s] for provider [%s] started."
date-time
provider-id))
(if (= "CMR" provider-id)
(if (= system-concept-provider provider-id)
(let [{:keys [num-indexed]} (index-system-concepts-after-datetime system date-time)]
(info (format "Indexed %d system concepts." num-indexed)))

Expand All @@ -313,9 +317,9 @@
date-time
provider-ids))
(let [has-cmr-provider? (or (empty? provider-ids)
(some #{"CMR"} provider-ids))
(some #{system-concept-provider} provider-ids))
providers (if (seq provider-ids)
(map #(helper/get-provider system %) (remove #(= "CMR" %) provider-ids))
(map #(helper/get-provider system %) (remove #(= system-concept-provider %) provider-ids))
;; all providers
(helper/get-providers system))
provider-response-map (for [provider providers
Expand Down

0 comments on commit 7a86798

Please sign in to comment.