Skip to content

Commit

Permalink
Merge pull request #58 from podaac/release/0.2.3
Browse files Browse the repository at this point in the history
* Prep 0.2.3

* /version 0.2.3rc1

* Issues/54: Handle `cumulus_meta` properly (#57)

* /version 0.3.0a0

* /version 0.3.0a1

* /version 0.3.0a2

* /version 0.3.0a3

* Fixed bug where status was not being reported to Cumulus Dashboard by adding `cumulus_meta` back into the output CMA.

---------

Co-authored-by: frankinspace <frankinspace@users.noreply.github.com>

* /version 0.2.3rc2

* Issues/55 Cache harmony client and don't validate EDL on init (#56)

* /version 0.3.0a0

* /version 0.3.0a1

* /version 0.3.0a2

* /version 0.3.0a3

* made client global

* Harmony client changed from per request and instead will be cached as global variable and will not validate auth credentials on initialization.

* fix lint

---------

Co-authored-by: frankinspace <frankinspace@users.noreply.github.com>

* /version 0.2.3rc3

* fix changelog

* /version 0.2.3rc4

* Load should validate auth from environ, default to false

---------

Co-authored-by: frankinspace <frankinspace@users.noreply.github.com>
  • Loading branch information
frankinspace and frankinspace authored Feb 12, 2025
2 parents b38f1e6 + 9f57520 commit 65c0c17
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security

## [0.2.3]
### Added
### Changed
- [issues/55](https://github.com/podaac/bignbit/issues/55): Harmony client changed from per request and instead will be cached as global variable and will not validate auth credentials on initialization.
### Deprecated
### Removed
### Fixed
- [issues/54](https://github.com/podaac/bignbit/issues/54): Fixed bug where status was not being reported to Cumulus Dashboard by adding `cumulus_meta` back into the output CMA.
### Security

## [0.2.2]
### Added
### Changed
Expand Down
21 changes: 16 additions & 5 deletions bignbit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

ED_USER = ED_PASS = None
EDL_USER_TOKEN = {}
HARMONY_CLIENT: Client or None = None

HARMONY_SHOULD_VALIDATE_AUTH = os.environ.get('HARMONY_SHOULD_VALIDATE_AUTH', default='False').upper() == 'TRUE'


def get_edl_creds() -> (str, str):
Expand Down Expand Up @@ -267,12 +270,20 @@ def get_harmony_client(environment_str: str) -> harmony.Client:
elif environment_str.upper() in ("OPS", "PROD"):
harmony_environ = Environment.PROD

harmony_client = Client(
env=harmony_environ,
auth=get_edl_creds()
)
global HARMONY_CLIENT # pylint: disable=W0603

# If we already have a client, but it's for a different environment, replace it with one configured for new environment.
if HARMONY_CLIENT and HARMONY_CLIENT.config.environment != harmony_environ:
HARMONY_CLIENT = None

if not HARMONY_CLIENT:
HARMONY_CLIENT = Client(
env=harmony_environ,
auth=get_edl_creds(),
should_validate_auth=HARMONY_SHOULD_VALIDATE_AUTH
)

return harmony_client
return HARMONY_CLIENT


def extract_mgrs_grid_code(granule_umm_json: dict) -> str:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bignbit"
version = "0.2.2"
version = "0.2.3rc5"
description = "Browse image generation and transfer"
authors = ["PO.DAAC <podaac@jpl.nasa.gov>"]
license = "Apache 2.0"
Expand Down
1 change: 1 addition & 0 deletions terraform/state_machine_definition.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@
"Type":"Pass",
"Next":"BuildImageSets",
"Parameters":{
"cumulus_meta.$": "$.cumulus_meta",
"meta": {
"buckets.$": "$.meta.buckets",
"cmr.$": "$.meta.cmr",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"cumulus_meta": {},
"meta": {
"provider": {},
"stack": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"cumulus_meta": {},
"meta": {
"provider": {},
"stack": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"cumulus_meta": {},
"meta": {
"provider": {},
"stack": {},
Expand Down

0 comments on commit 65c0c17

Please sign in to comment.