Skip to content

Commit

Permalink
fix: Set SKIPPED status if no sumstat files for yaml gen
Browse files Browse the repository at this point in the history
  • Loading branch information
karatugo committed Jan 2, 2025
1 parent 3f05619 commit 093ed70
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions sumstats_service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,13 @@ def convert_metadata_to_yaml(gcst_id, **kwargs):
additional_info={"exception": str(e)},
)
else:
logger.info(
f"Skipping {gcst_id=} hm: {is_harmonised_included} as it has no files."
info = f"Skipping {gcst_id=} hm: {is_harmonised_included} as it has no files."
logger.info(info)
mdb.insert_or_update_metadata_yaml_request(
gcst_id=gcst_id,
status=config.MetadataYamlStatus.SKIPPED,
is_harmonised=is_harmonised_included,
additional_info={"info": info},
)


Expand Down
1 change: 1 addition & 0 deletions sumstats_service/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,4 @@ class MetadataYamlStatus(Enum):
IN_PROGRESS = "in-progress"
COMPLETED = "completed"
FAILED = "failed"
SKIPPED = "skipped"
7 changes: 5 additions & 2 deletions sumstats_service/resources/mongo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ def insert_or_update_metadata_yaml_request(
gcst_id,
status,
is_harmonised=False,
additional_info={},
additional_info=None,
globus_endpoint_id=None,
):

if additional_info is None:
additional_info = {}

print(f"adding {gcst_id} with hm: {is_harmonised} to yaml")

update_doc = {
Expand All @@ -194,7 +197,7 @@ def insert_or_update_metadata_yaml_request(

# If status is COMPLETED, then reset attempts to 0.
# Otherwise increment attempts.
if status == config.MetadataYamlStatus.COMPLETED:
if status == config.MetadataYamlStatus.COMPLETED or status == config.MetadataYamlStatus.SKIPPED:
update_doc["$set"]["attempts"] = 0
else:
update_doc["$inc"] = {"attempts": 1}
Expand Down

0 comments on commit 093ed70

Please sign in to comment.