comparison ega_download_streamer.xml @ 3:a1f6611f0533 draft

planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/ega_client_galaxy_wrapper commit 056cdfa2329a82d02640ccaf6364005d40decafa
author yhoogstrate
date Tue, 29 Mar 2016 07:44:25 -0400
parents 4a8332665db3
children 42fbce72bc07
comparison
equal deleted inserted replaced
2:4a8332665db3 3:a1f6611f0533
19 #set $random_request_uid = 'request_'+str($ega_file_identifier)+'_'+''.join(random.SystemRandom().choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(64)) 19 #set $random_request_uid = 'request_'+str($ega_file_identifier)+'_'+''.join(random.SystemRandom().choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(64))
20 20
21 echo \$user > credentials.txt && 21 echo \$user > credentials.txt &&
22 echo \$pass >> credentials.txt && 22 echo \$pass >> credentials.txt &&
23 23
24 echo "Creating an encryption request at server" && 24 echo "Creating an encryption request at server:" &&
25 java -jar 25
26 if java -jar
26 "\$JAVA_JAR_PATH/EgaDemoClient.jar" 27 "\$JAVA_JAR_PATH/EgaDemoClient.jar"
27 -pf "credentials.txt" 28 -pf "credentials.txt"
28 -rf "$ega_file_identifier" 29 -rf "$ega_file_identifier"
29 -re "$encryption_key" 30 -re "$encryption_key"
30 -label "${random_request_uid}" | grep -v "Login failed" && 31 -label "${random_request_uid}" | grep -v "Login failed" > request.log ; then
32
33 cat request.log &&
34 echo "" &&
35 echo "" &&
36 echo "" &&
37 echo "Downloading request:" &&
38
39 if java -jar
40 "\$JAVA_JAR_PATH/EgaDemoClient.jar"
41 -pf "credentials.txt"
42 -dr "${random_request_uid}"
43 -nt 7 > download.log ; then
44
45 cat download.log &&
46
47 ## Commands below may fail if authentication was not a success
48 ENCRYPTED_FILES_NAME=\$(grep -oE "Completed Download Target:[ ]+(.*?)\.cip" download.log | sed -r "s/^Completed Download Target:[ ]+//" ) &&
49 DECRYPTED_FILES_NAME=\${ENCRYPTED_FILES_NAME%.cip} &&
50
51 echo "" &&
52 echo "" &&
53 echo "" &&
54 echo "Decrpyting \$ENCRYPTED_FILES_NAME to \$DECRYPTED_FILES_NAME:" &&
55
56 if java -jar
57 "\$JAVA_JAR_PATH/EgaDemoClient.jar"
58 -pf credentials.txt
59 -dc "\$ENCRYPTED_FILES_NAME"
60 -dck "$encryption_key" > decrypt.log ; then
61
62 cat decrypt.log &&
63
64 if file --mime-type "\$DECRYPTED_FILES_NAME" | grep -q /gzip\$; then
65
66 echo "" &&
67 echo "" &&
68 echo "" &&
69 echo "Unpacking because it is an archive" &&
70 gunzip -cf "\$DECRYPTED_FILES_NAME" > "$output" ;
71
72 else
73 mv "\$DECRYPTED_FILES_NAME" "$output" ;
74 fi ;
75
76 else
77 echo "Error: decrypting failed:" 1>&2 &&
78 cat decrypt.log &&
79 exit 1 ;
80 fi ;
81
82 else
83 echo "Error: downloading the request failed:" 1>&2 &&
84 cat download.log &&
85 exit 1 ;
86 fi ;
31 87
32 echo "\n\n\nDownloading request" && 88 else
33 java -jar 89 echo "Error: making the request failed" 1>&2 &&
34 "\$JAVA_JAR_PATH/EgaDemoClient.jar" 90 cat request.log &&
35 -pf "credentials.txt" 91 exit 1 ;
36 -dr "${random_request_uid}" 92 fi &&
37 -nt 7 > download.log &&
38 93
39 cat download.log &&
40
41 ## Commands below may fail if authentication was not a success
42 ENCRYPTED_FILES_NAME=\$(grep -oE "Completed Download Target:[ ]+(.*?)\.cip" download.log | sed -r "s/^Completed Download Target:[ ]+//" ) &&
43 DECRYPTED_FILES_NAME=\${ENCRYPTED_FILES_NAME%.cip} &&
44
45 echo "\n\n\n Decrpyting \$ENCRYPTED_FILES_NAME to \$DECRYPTED_FILES_NAME" &&
46 java -jar
47 "\$JAVA_JAR_PATH/EgaDemoClient.jar"
48 -pf credentials.txt
49 -dc "\$ENCRYPTED_FILES_NAME"
50 -dck "$encryption_key" &&
51
52 if file --mime-type "\$DECRYPTED_FILES_NAME" | grep -q /gzip$; then
53 echo "Unpacking as well" &&
54 gunzip -cf "\$DECRYPTED_FILES_NAME" > "$output" ;
55 else
56 mv "\$DECRYPTED_FILES_NAME" "$output" ;
57 fi ;
58 94
59 echo "Cleaning up credentials" && 95 echo "Cleaning up credentials" &&
60 echo "overwriten" > "credentials.txt" && 96 echo "overwriten" > "credentials.txt" &&
61 rm "credentials.txt" 97 rm "credentials.txt"
62 ]]></command> 98 ]]></command>