Skip to content

-t list.txt assigns wrong local file name to remote s3 content #2

Description

@WillForan

We get different files depending on the usage of the -t list.txt switch.

python version 2.7.5 on centOS 7.5.1804

./test_dl.bash
## With -t
('downloaded: ', 's3://NDAR_Central_2/submission_17025/t2/P0125_t2.zip')
('downloaded: ', 's3://NDAR_Central_2/submission_17025/t1/P0124_t1.zip')
 ('downloaded: ', 's3://NDAR_Central_1/submission_17020/localizers/P0125_localizers.zip')
('downloaded: ', 's3://NDAR_Central_2/submission_17025/diffusion/P0124_mr_diffusion.zip')

## Individual
('downloaded: ', 's3://NDAR_Central_2/submission_17025/t2/P0125_t2.zip')
('downloaded: ', 's3://NDAR_Central_1/submission_17020/localizers/P0125_localizers.zip')
('downloaded: ', 's3://NDAR_Central_2/submission_17025/t1/P0124_t1.zip')
('downloaded: ', 's3://NDAR_Central_2/submission_17025/diffusion/P0124_mr_diffusion.zip')

Binary files all_at_once/submission_17025/t2/P0125_t2.zip and one_at_a_time/submission_17025/t2/P0125_t2.zip differ
Binary files all_at_once/submission_17025/t1/P0124_t1.zip and one_at_a_time/submission_17025/t1/P0124_t1.zip differ
Binary files all_at_once/submission_17025/diffusion/P0124_mr_diffusion.zip and one_at_a_time/submission_17025/diffusion/P0124_mr_diffusion.zip differ
P0125_localizers.zip same in both

we were clued into this because the archive extracted names do not match the archive in the -t version. Here we were expecting t2 but got localizers when using the txt list option

$ for z in {all_at_once,one_at_a_time}/submission_17025/t2/P0125_t2.zip; do unzip -l $z|sed 5q; done                                                                                           
Archive:  all_at_once/submission_17025/t2/P0125_t2.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  10-02-2018 18:52   P0125/P0125_localizers/
        0  10-02-2018 18:52   P0125/P0125_localizers/data/

Archive:  one_at_a_time/submission_17025/t2/P0125_t2.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  10-15-2018 20:30   P0125/P0125_t2/
        0  10-15-2018 20:30   P0125/P0125_t2/data/

test_dl.bash

# setup
read u p <<<$(cat txt/cred.txt)
export PYTHONPATH="$PYTHONPATH:nda_aws_token_generator/python/" 
dl(){ python AWS-Download/awsdownload.py  -u "$u"  -p "$p" $@;}
mkdir -p all_at_once one_at_a_time

cat > list.txt <<HEREDOC
s3://NDAR_Central_2/submission_17025/t2/P0125_t2.zip
s3://NDAR_Central_1/submission_17020/localizers/P0125_localizers.zip
s3://NDAR_Central_2/submission_17025/t1/P0124_t1.zip
s3://NDAR_Central_2/submission_17025/diffusion/P0124_mr_diffusion.zip
HEREDOC

# two ways of getting files
echo "## With -t"
dl -t list.txt -d all_at_once
echo
echo "## Individual"
while read l; do dl -d one_at_a_time $l; done < list.txt

# compare
find one_at_a_time/ -iname '*zip'| while read z; do
  diff ${z/one_at_a_time/all_at_once} $z && echo "$(basename $z) same in both"
done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions