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

BUG: catch another situation where invalid manifest lines were not handled #140

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 8 additions & 1 deletion idc_index/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,11 @@ def _validate_update_manifest_and_get_download_size(
# Rename the column
manifest_df.columns = ["manifest_cp_cmd"]

# remove all rows that do not contain an S3 URL
manifest_df = manifest_df[
manifest_df["manifest_cp_cmd"].str.contains(r"s3://", na=False)
]

# create a copy of the index
index_df_copy = self.index[
[
Expand Down Expand Up @@ -916,7 +921,9 @@ def _validate_update_manifest_and_get_download_size(
REGEXP_EXTRACT(manifest_cp_cmd, '(?:.*?\\/){{3}}([^\\/?#]+)', 1) AS manifest_crdc_series_uuid,
REGEXP_REPLACE(regexp_replace(manifest_cp_cmd, 'cp ', ''), '\\s[^\\s]*$', '') AS s3_url,
FROM
manifest_df )
manifest_df
WHERE
REGEXP_REPLACE(regexp_replace(manifest_cp_cmd, 'cp ', ''), '\\s[^\\s]*$', '') IS NOT NULL)
SELECT
seriesInstanceuid,
index_crdc_series_uuid,
Expand Down
1 change: 1 addition & 0 deletions tests/study_manifest_aws.s5cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# To download the files in this manifest, first install s5cmd (https://github.com/peak/s5cmd),
# then run the following command:
# s5cmd --no-sign-request --endpoint-url https://s3.amazonaws.com run study_manifest_aws.s5cmd
study_manifest_cp_command
cp s3://idc-open-data/28621ba9-1aca-4aab-a2a1-f6d2c3e2ab19/* .
cp s3://idc-open-data/f0b76401-c6d1-4b61-a5fd-3fa596e6cc41/* .
cp s3://idc-open-data/4ea3bbe6-98da-4b92-abe6-2ee18927e3c9/* .
Loading