Skip to content

Commit

Permalink
Avoid keyerror when uploading data not related to a realization (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
roywilly authored Jan 22, 2024
1 parent 9e6727e commit bc2c41c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/fmu/sumo/uploader/caseondisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ def upload_parameters_txt(
print(f"CONFIG_PATH: {glob_var_path}")

fmu_id = self.fmu_case_uuid
if not "realization" in self.files[0].metadata["fmu"].keys():
logger.info("Cannot upload parameters.txt due to no realization")
return

realization_id = self.files[0].metadata["fmu"]["realization"]["uuid"]
query = f"fmu.case.uuid:{fmu_id} AND fmu.realization.uuid:{realization_id} AND data.content:parameters"

Expand Down
2 changes: 1 addition & 1 deletion src/fmu/sumo/uploader/scripts/sumo_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def sumo_upload_main(
e.upload_parameters_txt(glob_var_path=config_path)
logger.info("Upload done")
except Exception as err:
logger.warning("Problem related to Sumo upload:", err, type(err))
logger.warning(f"Problem related to Sumo upload: {err} {type(err)}")
_sumo_logger = sumo_connection.api.getLogger(
"log_2_server_sumo_upload"
)
Expand Down

0 comments on commit bc2c41c

Please sign in to comment.