Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
4e12e1d
Changed S3Utils, S3MessageAdapter classes' constructors(adjusted docu…
Apr 13, 2021
38e0299
Merge branch 'master' into 1500-fix-unit-tests
Apr 15, 2021
47d9d33
1500-WebPublisher adjusted some documentation wording and added test_…
Apr 15, 2021
85a9096
1500-Adjusted documentation indentation in WebPublisher
Apr 15, 2021
85ada22
1500-Changed CsbExtractor class constructor(adjusted documentation) t…
Apr 16, 2021
15cfaa3
1500-Added unit tests for WebPublisher. Made sure using autospec=True
Apr 19, 2021
1e629ab
1500-Changed KafkaConsumer class constructors(adjusted documentation)…
Apr 28, 2021
b63bfe8
1500-Adjusted KafkaConsumer create_consumer to not do duplicate code,…
Apr 28, 2021
74e7f6f
1500-Added __init__.py to tests directory so was discoverable/module.
Apr 28, 2021
a07e642
1500-in KafkaConsumer renamed variables so tad more generic. Makes it…
Apr 28, 2021
da934c4
1500-Fixed KafkaConsumerTest (thought intellij refactor of var name w…
Apr 28, 2021
92e12c9
1500-KafkaConsumer consolidated config for deserializer.
Apr 28, 2021
ba17408
1500-Changed KafkaPublisher class constructors(adjusted documentation…
Apr 28, 2021
392788a
1500-Changed KafkaConsumerTest(s) to have vars named exp where it mak…
Apr 29, 2021
3426472
1500-KafkaConsumerTest improved the formatting of dicts, tested ret…
May 4, 2021
47c9dce
1500-Changed/added to KafkaPublisherTest(s).
May 4, 2021
921490a
1500-In KafkaPublisher cleaned up documentation, added method to cons…
May 4, 2021
a337c39
1500-Adjusted csb config variable name from file_identifier_prefix to…
May 4, 2021
5aab6d6
1500-Fixed lack of carriage returnin S3Utils for legibility.
May 4, 2021
5975e1d
1500-Changed SqsConsumer class constructor to take dictionary with ex…
May 7, 2021
204a2bd
1500-Decided to put "connect" back into SqsConsumer. Adjusted input p…
May 7, 2021
47b3e5b
1500-Fixed some bugs in SqsConsumer.
May 7, 2021
b2143ae
1500-Due to changing SqsConsumer class constructor to take dictionary…
May 7, 2021
11f8845
1500-fixed bug in tests/utils of message missing a carriage return. J…
May 11, 2021
9048e53
1500-Added logging to SqsHandlers and log_level method parameter. Adj…
May 11, 2021
5e0d3ba
1500-Added tests to SqsHandlersTest and removed config usage.
May 11, 2021
918c378
1500-Fixed SqsConsumerTest due to parameters into CB changing. skippe…
May 11, 2021
3f39966
1500-Removed unused conf variable.
May 11, 2021
4cffc38
1500-Removed unused var conf from classes.
May 11, 2021
8280a37
1500-Changed mock tests to not load configs but use mock data.
May 11, 2021
c16302e
1500-refactored S3Utils connect to take in type parameter instead of …
May 11, 2021
f8c5bd0
1500-Changed moto dependency to moto[all] because of some issues with…
May 11, 2021
ecfec1e
1500-added tests for different connect types for S3Utils
May 11, 2021
e4c7fb4
1500-Changed class constructors checking extra arguments and logging …
May 11, 2021
f5370ea
1500-Moved unit tests to tests/unit and integration tests to tests/in…
May 11, 2021
c93bab2
1500-Fixed one of the test_S3Utils tests that was commented out. Remo…
May 12, 2021
32a300a
1500-Updated python-client requirements boto3. Seems to be using an o…
May 12, 2021
a3f6e96
1500-Updated python-client requirements botocore to 1.20.71 due to co…
May 12, 2021
8fca7a9
1500-Changed circleci config for python client to try and update boto
May 12, 2021
bd38748
1500-added region_name to S3Utils connect for session. Suspect it was…
May 12, 2021
6a101f8
1500-Changing python-client circleci config to see if need to tell it…
May 12, 2021
927fb7e
1500-updated python-client requirements to install boto
May 12, 2021
12374a0
1500-Changed python-client integration test(s) to use environment var…
May 12, 2021
eb0646d
1500-Removed redundant log_level fields in all the configs. Put into …
May 13, 2021
aa0b9a9
1500-Changed the kafka config in the scripts for collection and granu…
May 14, 2021
3b14757
1500-Changed exception message to first be a string then passed into …
May 18, 2021
ebf71ee
1500-Adjusted exception thrown in S3Utils.connect for invalid type, w…
May 18, 2021
053df05
1500-Fixed log but in SqsConsumer of microseconds process time being …
May 18, 2021
5c66efa
2500-Added SqsHandlers create_upload_handler back with tests. Didn't …
May 18, 2021
d4b2013
1500-Changed references to psi_registry_url to registry_base_url
May 19, 2021
a0711f2
1507-Added sqs_name to helm values.
May 20, 2021
77190e8
1507-fixed bug in S3Utils upload_s3 passing in wrong parameter type to
May 21, 2021
c073a2f
1507-Updated circleCI config to run/publish docker image of onestop-p…
May 28, 2021
5d3344c
1507-Copied root Dockerfile to onestop-python-client to get docker pu…
May 28, 2021
46f7fff
1507-Removed from Dockerfile copy step of module in, had trouble doin…
May 28, 2021
0166d4f
1507-Changed onestop-python-client Dockerfile to copy onestop-python-…
May 28, 2021
f3088da
1507-Add to circleCI building and publishing images of onestop-s3-han…
May 28, 2021
eaf1454
1507-Fixed booboo in circleCI of renaming build and not changing name…
May 28, 2021
ed3a93e
1507-Changed circleCI image tag to 'latest'. Need to revisit.
Jun 1, 2021
095d5fa
1507-Changed dockerfiles back (had changed it due to so problems with…
Jun 2, 2021
9d4eaba
1507-Removed onestop-python-client dockerfile, unecessary. Therefore …
Jun 2, 2021
bca1ce3
1507-added comment to sqs-to-registry dockerfile about how things get…
Jun 2, 2021
4c62de8
1507-Changed scripts/sme dockerfile to not install onestop-python-cli…
Jun 2, 2021
34ed597
1507-In helm values files changed image pullPolicy to Always because …
Jun 3, 2021
d09ad1c
1507-To helm/*/values.yaml removed unused sqs_url, added cert locatio…
Jun 4, 2021
37a65a2
1507-Set metadata_type to uppercase and adjusted the ValueError raise…
Jun 4, 2021
c3f3761
1507-Set metadata_type to uppercase and adjusted the ValueError raise…
Jun 4, 2021
2cfdcf3
1507-Added additional log statement in delete handler if record event…
Jun 4, 2021
be034ea
1507-Updated KafkaConsumer unit test to reflect change neglected to m…
Jun 4, 2021
528fa83
1507-Updated scripts to work with new class constructors that take a …
Jun 4, 2021
d43d067
1507-Updated AvroSerializer call to specify parameter name, since ord…
Jun 4, 2021
27e7d1b
1507-Updated AvroSerializer call to specify parameter name, since ord…
Jun 4, 2021
3993106
1507-Removed try/catch around code in KafkaPublisher publish_granule …
Jun 4, 2021
2ade49b
1507-Removed try/catch around code in KafkaPublisher publish_collecti…
Jun 5, 2021
9b6dc1b
1507-Updated helm/*/values.yml for Kafka brokers and schema_registry …
Jun 5, 2021
35ed0dc
1507-Changed helm/*/values file_identifier_prefix to file_id_prefix (…
Jun 7, 2021
1e76696
1507-Found bug of not updating the s3Utils connect call to new way, u…
Jun 7, 2021
ede2e55
1507-Changed bulid order in CircleCI config, seeing sme/sqs script bu…
Jun 7, 2021
6e843f0
1507-Changed circleCI config to have the onestop-python-client-build …
Jun 7, 2021
1beb0bc
1507-Changed circleci config - added colons at end of jobs that had r…
Jun 7, 2021
19dc282
1507-Making a visual change to onestop-python-client code to test new…
Jun 7, 2021
91ba8f3
1507-Changed SqsHandlers to not serialize the json payload but instea…
Jun 8, 2021
d29e7a5
1507-Changed helm*/values.yml onestop and registry urls from onestop*…
Jun 8, 2021
3beefc3
1507-Added passing in log level to callback method in KafkaConsumer. …
Jun 8, 2021
ffaf33f
1507-Removed try/finally from the KafkaConsumer.consume() since our c…
Jun 9, 2021
880b858
1507-Narrowed down try/except code in the SqsConsumer.consume() so if…
Jun 9, 2021
dd1d5f4
1507-Fixed test for a KafkaConsumer call back that now includes log l…
Jun 9, 2021
2d8025a
1507-Fixed a test missed related to commit of changed SqsHandlers to …
Jun 9, 2021
7e6b72d
1507-Updated scripts to work with new class constructors that take a …
Jun 9, 2021
0fe8853
1507 - Changed warning about extra constructor arguments to debug sta…
Jun 9, 2021
bb03a98
1507-Change all init parameters from metadata_type to their classname…
Jun 10, 2021
c34b338
1507-Added metadata_type validation to S3MessageAdapter and tests.
Jun 11, 2021
1566e1c
1507-Adjusted log messages in KafkaConsumer and KafkaPublisher create…
Jun 11, 2021
3946bf1
1507-KafkaPublisher consolidated create method's config into one spot.
Jun 11, 2021
9ce570e
1507-To the scripts readme added more information about helm, build i…
Jun 15, 2021
b79a4c0
1509-added cedar devs image into images directory for GH pages.
Jun 15, 2021
e72d96f
1509-moved public-user.md to cli docs and created main readme page fo…
Jun 17, 2021
0d782fa
1509-Removed log_level from credentials-template.yml since that isn't…
Jun 23, 2021
45bb70a
1509-In docs folder created files for onestop-python-client, helm, an…
Jun 23, 2021
7e41832
1509-Updated onestop-python-client setup with correct readme location.
Jun 23, 2021
4fe81b1
1509-Removed reading readme from onestop-python-client, wasn't being …
Jun 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 55 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
# - slack/status:
# fail_only: false

# cli build
cli-build:
executor: docker/docker
steps:
Expand All @@ -75,30 +74,55 @@ jobs:
- slack/status:
fail_only: false

# clients build
client-build:
onestop-s3-handler-build:
executor: docker/docker
steps:
- setup_remote_docker
- checkout
- docker/check
- docker/build:
path: onestop-python-client
path: scripts/sqs-to-registry
image: cedardevs/onestop-s3-handler
tag: latest
- docker/push:
image: cedardevs/onestop-s3-handler
tag: latest
- slack/status:
fail_only: false

onestop-sme-build:
executor: docker/docker
steps:
- setup_remote_docker
- checkout
- docker/check
- docker/build:
path: scripts/sme/
image: cedardevs/onestop-sme
tag: latest
- docker/push:
image: cedardevs/onestop-sme
tag: latest
- slack/status:
fail_only: false

onestop-python-client-build:
executor: docker/docker
steps:
- setup_remote_docker
- checkout
- docker/check
- docker/build:
path: ./
image: cedardevs/onestop-python-client
tag: ${CIRCLE_BRANCH}-SNAPSHOT
- run:
name: "What branch am I on now?"
command: echo $CIRCLE_BRANCH
#no need to push this image yet
tag: latest
- docker/push:
image: cedardevs/onestop-python-client
tag: ${CIRCLE_BRANCH}-SNAPSHOT
tag: latest
- slack/status:
fail_only: false
# Base test configuration for Go library tests Each distinct version should
# inherit this base, and override (at least) the container image used.

python-client-test: &python-client-test
onestop-python-client-test: &python-client-test
executor: python/default
steps: &steps
- checkout
Expand All @@ -107,10 +131,16 @@ jobs:
app-dir: ./onestop-python-client
pkg-manager: pip
- run:
name: "Run util tests"
name: "Run unit tests"
command: >
cd onestop-python-client/;
python -m unittest tests/util/*.py
python -m unittest discover -s test/unit
# This is commented out only because the OneStop we have running on cedardevs doesn't have its registry exposed. You can only reach it via sshing to another machine.
# - run:
# name: "Run integration tests"
# command: >
# cd onestop-python-client/;
# python -m unittest discover -s test/integration

orbs:
slack: circleci/[email protected]
Expand All @@ -121,9 +151,15 @@ version: 2.1
workflows:
main:
jobs:
# - "latest"
# - cli-test
# - cli-build
# - client-build
- python-client-test

- onestop-python-client-test
- onestop-python-client-build:
requires:
- onestop-python-client-test
- onestop-sme-build:
requires:
- onestop-python-client-build
- onestop-s3-handler-build:
requires:
- onestop-python-client-build
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM python:3.8

COPY ./onestop-python-client /onestop-python-client
COPY ./scripts /scripts

RUN apt-get update
RUN pip install --upgrade pip
RUN pip install ./onestop-python-client
RUN pip install -r ./onestop-python-client/requirements.txt

# Needed for scripts - do here since directory out of scope when in scripts/* dockerfiles.
# Unsure if possible this isn't latest build, like doing pip install before this is built.
RUN pip install ./onestop-python-client

#Base image stays up for dev access
CMD tail -f /dev/null
43 changes: 36 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,42 @@
</p>

## Table of contents
* [onestop-python-client](#onestop-python-client)
* [Python Scripts](#python-scripts)
* [Helm](#helm)
* [CLI](#cli)
* [Build Pipeline and Test Execution](build-pipeline)

- [Project Overview](#project-overview)
- [Navigating The Documentation](#navigating-the-documentation)
- [By User Type](#by-user-type)
- [By Project Component](#by-project-component)
- [External Documentation](#docs/cli/developer/quickstart.md)
This OneStop-clients project is a collection of clients to aid in communicating with OneStop and directly with the cloud.

## Project Overview
OneStop-clients is an open-sourced commandline interface and subject matter consumer clients ...
## [onestop-python-client](onestop-python-client)
The onestop-python-client is a tool for subject matter experts (SME) to publish and consume metadata to and from OneStop as well as directly to the cloud.
This would enable someone to feed data into OneStop, have OneStop digest it, and then read it out via a python script.

[onestop-python-client](onestop-python-client) - More details.

Additional information:
* [onestop-test-data repository readme](https://github.com/cedardevs/onestop-test-data/blob/master/README.md) - loading test data into OneStop.
* [OneStop documentation](https://cedardevs.github.io/onestop/) - OneStop documentation.

## [Python Scripts](scripts)
There are some sample python scripts that use the onestop-python-client in the scripts directory.

[python scripts](scripts) - More details.

## [Helm](helm)
There is a helm directory full of helm charts to create different kubernetes containers which each contain from this repository the onestop-python-client code and the scripts directory.
They have python installed so that a SME user could execute scripts from within.

[Helm](helm) - More details.

## [CLI](cli)
The CLI is an open-sourced commandline interface for OneStop's search API.

* [Developer Quickstart](cli/developer-quickstart)

* [Public User Quickstart](cli/public-user-quickstart)

* [SCDR Files](cli/scdr-files)

[CLI](cli) - More details.
42 changes: 42 additions & 0 deletions docs/build-pipeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<div align="center"><a href="/onestop-clients/">Documentation Home</a></div>
<hr>

# Build Pipeline and Test Execution

## Table of Contents
* [CircleCI](#circleci)
* [Building Manually](#building-manually)
* [Test Execution](#test-execution)

## CircleCI
Currently, this project uses CircleCI to build the multiple images needed. If you example the circleci configuration file you will see what tests it executes and images it builds with what tags.

## Building Manually
* If you change the onestop-python-client code then run this, from the project root:

```
docker build . -t cedardevs/onestop-python-client:latest
```

* If you modify just the scripts then run this (only need to do the one relevant for your script), from the project root:

```
docker build ./scripts/sqs-to-registry -t cedardevs/onestop-s3-handler:latest
```

```
docker build ./scripts/sme/ -t cedardevs/onestop-sme:latest
```

## Test Execution
To execute the onestop-python-client tests via python's unittest execute this from the onestop-python-client directory:

```
python3 -m unittest discover
```

If you wish to run a specific test file, here's an example:

```
python -m unittest test/unit/util/test_S3MessageAdapter.py
```
7 changes: 7 additions & 0 deletions docs/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div align="center"><a href="/onestop-clients/">Documentation Home</a></div>
<hr>

## Table of contents
* [Public User Quickstart](public-user-quickstart)
* [SCDR Files](scdr-files)
* [Developer](developer-quickstart)
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# OneStop CLI tool for developers
<div align="center"><a href="/onestop-clients/">Documentation Home</a></div>
<hr>
# OneStop CLI tool for Developers

## Table of Contents


The `onestop-cli` tool provides a convenient command line interface for the OneStop search API. This tool is partly generated from the OpenAPI spec in the search module. We have added custom middleware for convenient syntax for frequently used filters and queries.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
<div align="center"><a href="/onestop-clients/">Documentation Home</a></div>
<hr>
# OneStop CLI tool

## Table of Contents
* [OneStop Info](#onestop-info)
* [Installation](#installation)
* [Requirements](#requirements)
* [Install and run using a docker container (golang not required)](#install-and-run-using-a-docker-container-golang-not-required)
* [Download and use as Go package](#download-and-use-as-go-package)
* [Configuration](#configuration)
* [Usage](#usage)
* [Verbose](#verbose)
* [Run against a test or local API](#run-against-a-test-or-local-api)
* [Get](#get)
* [Search](#search)
* [by identifier](#by-identifier)
* [by parent identifier](#by-parent-identifier)
* [by date](#by-date)
* [by geometry](#by-geometry)
* [combinations](#combinations)

The `onestop-cli` tool provides a convenient command line interface for the OneStop search API.
There are three primary methods to search the data contained within onestop via the command line interface (CLI) tool.
If you're new to the OneStop ecosystem, you should interact with one or both of the running instances of the UI to get some familiarity with basic search features. Then if you choose to be more of a power user, we encourage you to explore the ins and outs of our API and CLI.

Read the [OneStop OpenAPI spec 2.0.0](https://app.swaggerhub.com/apis/cedardevs/one-stop_search_api/2.0.0).
Or check the [OneStop OpenAPI spec 2.4.0](https://app.swaggerhub.com/apis/cedarbot/OneStop/2.4.0).
## OneStop Info
* [OneStop OpenAPI spec 2.0.0](https://app.swaggerhub.com/apis/cedardevs/one-stop_search_api/2.0.0)
* [OneStop OpenAPI spec 2.4.0](https://app.swaggerhub.com/apis/cedarbot/OneStop/2.4.0)

## Installation

### Requirements -
### Requirements

Either golang, or docker. Direct downloads of binaries will be available in the future.

Expand Down Expand Up @@ -157,6 +179,3 @@ Longhand query, including the `--verbose` flag to provide more logging:
For complex query and filter structure, refer to the [short hand documentation](https://github.com/danielgtaylor/openapi-cli-generator/tree/master/shorthand).

Note: As it is now, you cannot combine the flags with json shorthand. e.g. This will not work - `onestop searchcollection --area="POLYGON(( 22.686768 34.051522, 30.606537 34.051522, 30.606537 41.280903, 22.686768 41.280903, 22.686768 34.051522 ))" --query="satellite" filters[]{ type:datetime, after:2017-01-01T00:00:00Z, before:2017-02-01T00:00:00Z} `

<hr>
<div align="center"><a href="/onestop/public-user">Previous</a> | <a href="#">Top of Page</a> | <a href="/onestop/public-user/cli/scdr-files">Next</a></div>
2 changes: 0 additions & 2 deletions docs/cli/public-user/scdr-files.md → docs/cli/scdr-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

## scdr-files configurations

Config locations -

Users can supply a configuration to map scdr-file type short names to OneStop IDs. See default config in [default config](cli/scdr-files-config.yaml). File can be yaml or json, but must be named "scdr-files-config" and placed in one of the following locations- project directory, current working directory, /etc/scdr-files/, or $HOME/.scdr-files.


Expand Down
43 changes: 43 additions & 0 deletions docs/helm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<div align="center"><a href="/onestop-clients/">Documentation Home</a></div>
<hr>

# Helm

## Table of Contents
* [Intro](#intro)
* [Helm Configuration](#helm-configuration)
* [Create and Start the Script Container](#create-and-start-the-script-container)

## Intro
This project has a helm directory which is set up to pull a onestop-python-client image (specified in the image section in `helm/<chart directory>/values.yml`) and create a kubernetes container with that image inside. The container should be able to communicate to the configured OneStop stack (specified in the conf section in `helm/<chart directory>/values.yml`).
It also copies the onestop-python-client and scripts directories into the container.

## Helm Configuration
The helm charts are setup to create a configuration file from the template at `helm/<chart directory>/values.yml` and copy it to `/etc/config/config.yml` within the container. You don't have to use this file but most likely one will be necessary in a location where the scripts can access it.

Please see the [onestop-python-client configuration](onestop-python-client#configuration) section for configuration information.

Please see the [scripts](scripts) documentation for information on how to pass in a configuration file via CLI and execute the scripts.

## Create and Start the Script Container
The helm install command, done from the root of this repository, will use the charts in the helm directory to create the specified container.

In this example we will create the `sme` using the helm charts and configuration information in this repo from `helm/onestop-sqs-consumer`
1. cd to the root of this project
1. `helm uninstall sme`
1. `helm install sme helm/onestop-sqs-consumer`

To check the container status execute `kubectl get pods` and look for the pod with the expected name, as defined by the `name` field in the `helm/<chart directory>/Chart.yaml`:

```
(base) ~/repo/onestop-clients 07:00 PM$ kubectl get pods
NAME READY STATUS RESTARTS AGE
sme-onestop-sqs-consumer-5c678675f7-q2s7h 0/1 Pending 0 26s
```
If it isn't in a 'Running' state within about 10 seconds then something is probably wrong. If it hasn't crashed yet (indicated by a STATUS of CrashBackLoop) then one possibility is a connection timeout trying to connect to a resource.

Once the container is running you can exec into the container (much like "sshing") via this command, use the NAME from the `kubectl get pods` command:

```
kubectl exec --stdin --tty sme-onestop-sqs-consumer-5c678675f7-q2s7h -- /bin/bash
```
Binary file added docs/images/cedar_devs_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading