Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	pyproject.toml
  • Loading branch information
frankinspace committed Feb 12, 2025
2 parents c392534 + 7c9a2ac commit 98e62cd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 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
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 98e62cd

Please sign in to comment.