Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/data/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def global_metadata(self) -> dict: # noqa: PLR0915
metadata["comment"] = (
f"MBARI Dorado-class AUV data produced from calibrated data"
f" with execution of '{self.commandline}' at {iso_now} on"
f" host {gethostname()}. Software available at"
f" host {actual_hostname}. Software available at"
f" 'https://github.com/mbari-org/auv-python'"
)
elif log_file:
Expand All @@ -214,7 +214,7 @@ def global_metadata(self) -> dict: # noqa: PLR0915
metadata["comment"] = (
f"MBARI LRAUV-class AUV data produced from logged data"
f" with execution of '{self.commandline}' at {iso_now} on"
f" host {gethostname()}. Software available at"
f" host {actual_hostname}. Software available at"
f" 'https://github.com/mbari-org/auv-python'"
)
if matches:
Expand Down
4 changes: 3 additions & 1 deletion src/data/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,8 @@ def global_metadata(self):
if "pytest" in sys.modules:
self.logger.debug("Skipping dynamic metadata generation (running under pytest)")
return {}
# Try to get actual host name, fall back to container name
actual_hostname = os.getenv("HOST_NAME", gethostname())

iso_now = datetime.now(tz=UTC).isoformat() + "Z"

Expand Down Expand Up @@ -705,7 +707,7 @@ def global_metadata(self):
metadata["comment"] = (
f"MBARI Dorado-class AUV data produced from original data"
f" with execution of '{self.commandline}'' at {iso_now} on"
f" host {gethostname()}. Software available at"
f" host {actual_hostname}. Software available at"
f" 'https://github.com/mbari-org/auv-python'"
)

Expand Down
6 changes: 5 additions & 1 deletion src/data/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import json # noqa: I001
import logging
import os
import sys
import time
from datetime import UTC
Expand Down Expand Up @@ -122,6 +123,9 @@ def global_metadata(self):
"""
from datetime import datetime

# Try to get actual host name, fall back to container name
actual_hostname = os.getenv("HOST_NAME", gethostname())

iso_now = datetime.now(tz=UTC).isoformat() + "Z"

metadata = {}
Expand Down Expand Up @@ -175,7 +179,7 @@ def global_metadata(self):
metadata["comment"] = (
f"MBARI Long Range AUV data produced from original data"
f" with execution of '{self.commandline}'' at {iso_now} on"
f" host {gethostname()}. Software available at"
f" host {actual_hostname}. Software available at"
f" 'https://github.com/mbari-org/auv-python'"
)

Expand Down
4 changes: 3 additions & 1 deletion src/data/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,12 +780,14 @@ def process_mission(self, mission: str, src_dir: str = "") -> None: # noqa: C90
f"{FAILED} program specified in dorado_info.py. Not processing {mission}"
)
raise FailedMission(error_message)
# Try to get actual host name, fall back to container name
actual_hostname = os.getenv("HOST_NAME", gethostname())
self.logger.info(
"Processing %s mission %s by user %s on host %s",
program,
mission,
getuser(),
gethostname(),
actual_hostname,
)
except KeyError:
error_message = f"{mission} not in dorado_info"
Expand Down
9 changes: 8 additions & 1 deletion src/data/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
__copyright__ = "Copyright 2021, Monterey Bay Aquarium Research Institute"

import logging # noqa: I001
import os
import re
import sys
import time
Expand Down Expand Up @@ -105,6 +106,8 @@ def _build_global_metadata(self) -> None:
# Skip dynamic metadata during testing to ensure reproducible results
if "pytest" in sys.modules:
return {}
# Try to get actual host name, fall back to container name
actual_hostname = os.getenv("HOST_NAME", gethostname())
repo = git.Repo(search_parent_directories=True)
try:
gitcommit = repo.head.object.hexsha
Expand Down Expand Up @@ -166,7 +169,7 @@ def _build_global_metadata(self) -> None:
self.metadata["source"] = (
f"MBARI Dorado-class AUV data produced from {from_data}"
f" with execution of '{self.commandline}' at {iso_now} on"
f" host {gethostname()} using git commit {gitcommit} from"
f" host {actual_hostname} using git commit {gitcommit} from"
f" software at 'https://github.com/mbari-org/auv-python'"
)
self.metadata["summary"] = (
Expand Down Expand Up @@ -333,6 +336,10 @@ def lrauv_global_metadata(self) -> dict:
f". Processing log file: {BASE_LRAUV_WEB}/"
f"{self.log_file.replace('.nc4', '_processing.log')}"
)
# Remove mention of original sampling intervals from summary
self.metadata["summary"] = self.metadata["summary"].replace(
" with measurements at original sampling intervals", ""
)

# Preserve comment from align.nc if available, otherwise use default
if "comment" in self.ds.attrs:
Expand Down