Skip to content

Commit

Permalink
Merge pull request #655 from sennetconsortium/maxsibilla/fix-metadata…
Browse files Browse the repository at this point in the history
…-write

Maxsibilla/fix metadata write
  • Loading branch information
maxsibilla authored Feb 13, 2025
2 parents f673c63 + 6ce7e7d commit e314c71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.23
1.4.24
2 changes: 1 addition & 1 deletion ingest-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.0
info:
description: |
A RESTful web service exposing calls needed for the SenNet Data Sharing Portal.
version: 1.4.23
version: 1.4.24
title: SenNet Ingest API
contact:
name: SenNet Help Desk
Expand Down
12 changes: 7 additions & 5 deletions src/routes/entity_CRUD/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,6 @@ def publish_datastage(identifier):
abort_bad_req(f"{dataset_uuid} missing contacts or contributors. Must have at least one of each")

ingest_helper = IngestFileHelper(current_app.config)
ds_path = ingest_helper.dataset_directory_absolute_path(dataset_data_access_level, dataset_group_uuid,
dataset_uuid, False)
is_component = entity_dict.get('creation_action') == 'Multi-Assay Split'

data_access_level = dataset_data_access_level
Expand All @@ -888,9 +886,6 @@ def publish_datastage(identifier):
if asset_dir_exists:
ingest_helper.relink_to_public(dataset_uuid)

acls_cmd = ingest_helper.set_dataset_permissions(dataset_uuid, dataset_group_uuid, data_access_level,
True, no_indexing_and_acls)

doi_info = None
# Generating DOI's for lab processed/derived data as well as IEC/pipeline/airflow processed/derived data).
if is_primary or has_entity_lab_processed_dataset_type:
Expand Down Expand Up @@ -962,6 +957,9 @@ def publish_datastage(identifier):
for e_id in uuids_for_public:
entity_instance.clear_cache(e_id)

# Write metadata.json into directory
ds_path = ingest_helper.dataset_directory_absolute_path(dataset_data_access_level, dataset_group_uuid,
dataset_uuid, True)
if is_primary or is_component is False:
md_file = os.path.join(ds_path, "metadata.json")
json_object = entity_json_dumps(entity, auth_tokens, EntitySdk(service_url=current_app.config['ENTITY_WEBSERVICE_URL']), True)
Expand All @@ -973,6 +971,10 @@ def publish_datastage(identifier):
logger.exception(f"Fatal error while writing md_file {md_file}; {str(e)}")
return jsonify({"error": f"{dataset_uuid} problem writing metadata.json file."}), 500

# Change the directory permissions to prevent user from writing to published folder
acls_cmd = ingest_helper.set_dataset_permissions(dataset_uuid, dataset_group_uuid, data_access_level,
True, no_indexing_and_acls)

if no_indexing_and_acls:
r_val = {'acl_cmd': acls_cmd, 'sources_for_indexing': sources_to_reindex}
else:
Expand Down

0 comments on commit e314c71

Please sign in to comment.