Skip to content

Commit

Permalink
Check if paramfile is None
Browse files Browse the repository at this point in the history
  • Loading branch information
equinor-ruaj committed Oct 15, 2024
1 parent c7c24df commit 5601b1a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/fmu/sumo/uploader/_upload_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,19 @@ def _upload_files(

paramfile = get_parameter_file(parameters_path, config_path)
# Check if the parameters file does not exist or if it has changed
query = f"fmu.case.uuid:{sumo_parent_id} AND fmu.realization.uuid:{realization_id} AND data.content:parameters"
search_res = sumoclient.get(
"/search", {"$query": query, "$select": "_sumo.blob_md5"}
).json()
if (
search_res["hits"]["total"]["value"] == 0
or search_res["hits"]["hits"][0]["_source"]["_sumo"][
"blob_md5"
]
!= paramfile.metadata["_sumo"]["blob_md5"]
):
files.append(paramfile)
if paramfile is not None:
query = f"fmu.case.uuid:{sumo_parent_id} AND fmu.realization.uuid:{realization_id} AND data.content:parameters"
search_res = sumoclient.get(
"/search", {"$query": query, "$select": "_sumo.blob_md5"}
).json()
if (
search_res["hits"]["total"]["value"] == 0
or search_res["hits"]["hits"][0]["_source"]["_sumo"][
"blob_md5"
]
!= paramfile.metadata["_sumo"]["blob_md5"]
):
files.append(paramfile)

break

Expand Down

0 comments on commit 5601b1a

Please sign in to comment.