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

Improved logging on missing experiments #721

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Changes from 1 commit
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
54 changes: 48 additions & 6 deletions viewer/target_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ def _check_file_hash(
if file_hash and file_hash != calculate_sha256(file_path):
logfunc(key, f"Invalid hash for file {filename}")
else:
logger.debug("missing file: %s", file_path)
logfunc(
key,
f"{key} referenced in {METADATA_FILE}: {obj_identifier} but not found in archive",
Expand Down Expand Up @@ -2015,9 +2016,30 @@ def process_bundle(self):
f"{val.instance.canon_site.canon_site_num}"
+ f"{next(numerators[val.instance.canon_site.canon_site_num])}"
)
so_list = [
site_observation_objects[k].instance for k in val.index_data["members"]
]

so_list = []
for k in val.index_data["members"]:
try:
so_list.append(site_observation_objects[k].instance)
except KeyError as exc:
# this is something that started happening, people
# removing experiments. check if exists:
# the key looks something like A71EV2A-x4922/A/201/5
exp_code = k.split("/")[0]
if exp_code not in experiment_objects.keys():
# this is the root cause, that's the situation
# that's been happening
self.report.log(
logging.ERROR,
f"Experiment {exp_code} missing from {METADATA_FILE}",
)
else:
# this has not, handling it just in case
self.report.log(
logging.ERROR,
f"SiteObservation {k} missing from {METADATA_FILE}",
)

# tag = val.instance.name.split('+')[0]
tag = val.instance.name
try:
Expand Down Expand Up @@ -2132,9 +2154,29 @@ def process_bundle(self):
f"F{val.instance.xtalform.xtalform_num}"
+ f"{val.instance.xtalform_site_num}"
)
so_list = [
site_observation_objects[k].instance for k in val.index_data["residues"]
]

so_list = []
for k in val.index_data["residues"]:
try:
so_list.append(site_observation_objects[k].instance)
except KeyError as exc:
# this is something that started happening, people
# removing experiments. check if exists:
# the key looks something like A71EV2A-x4922/A/201/5
exp_code = k.split("/")[0]
if exp_code not in experiment_objects.keys():
# this is the root cause, that's the situation
# that's been happening
self.report.log(
logging.ERROR,
f"Experiment {exp_code} missing from {METADATA_FILE}",
)
else:
# this has not, handling it just in case
self.report.log(
logging.ERROR,
f"SiteObservation {k} missing from {METADATA_FILE}",
)
tag = val.versioned_key
try:
# remove protein name and 'x'
Expand Down