Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-39089: Handle failure modes in Sasquatch Dispatch #96

Merged
merged 2 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class SasquatchDispatcher:
token: str
"""Authentication token used in communicating with the proxy server"""

namespace: str = "lsst.debug"
namespace: str = "lsst.dm"
"""The namespace in Sasquatch in which to write the uploaded metrics"""

def __post_init__(self) -> None:
Expand Down Expand Up @@ -354,7 +354,8 @@ def _handleReferencePackage(self, meta: MutableMapping, bundle: MetricMeasuremen
except ValueError:
# Could not extract package timestamp leaving empty
pass
meta["reference_package"] = ref_package
# explicit handle if None was set in the bundle for the package
meta["reference_package"] = ref_package or ""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, fields must be present in the payload even if the value is missing. An empty string is a good default value.

meta["reference_package_version"] = package_version
meta["reference_package_timestamp"] = package_timestamp

Expand Down Expand Up @@ -687,7 +688,9 @@ def dispatch(
uploadFailed.append(True)
partialUpload = True

if all(uploadFailed):
# There may be no metrics to try to upload, and thus the uploadFailed
# list may be empty, check before issuing failure
if len(uploadFailed) > 0 and all(uploadFailed):
raise SasquatchDispatchFailure("All records were unable to be uploaded.")

if partialUpload or recordsTrimmed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __init__(

self.accessToken = self.config.get("accessToken", "na")

self.namespace = self.config.get("namespace", "lsst.debug")
self.namespace = self.config.get("namespace", "lsst.dm")

self._dispatcher = SasquatchDispatcher(self.restProxyUrl, self.accessToken, self.namespace)

Expand Down