annotate main.py @ 2:0641ea2f75b1 draft

"planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
author rhohensinner
date Fri, 02 Jul 2021 09:40:25 +0000
parents 19c1cecdfdfd
children d2be2eb8350f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
1 ___author___ = "Richard Hohensinner"
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
2 ___created___ = "04.02.2021"
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
3 ___last_modified___ = "20.05.2021"
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
4
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
5 # general imports
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
6 import os, sys, json
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
7 import irods_upload
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
8
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
9 from shutil import copyfile
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
10 from datetime import datetime
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
11
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
12 # irods-client imports
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
13 from irods.session import iRODSSession
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
14 from irods.models import Collection, DataObject
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
15 from irods.query import SpecificQuery
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
16
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
17 # Tkinter imports
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
18 from tkinter import messagebox, Label, Button, Entry, Listbox, Tk, PhotoImage, Grid
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
19
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
20 # global variables
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
21 session = None
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
22 file_path_list = []
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
23 selected_file = ""
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
24 session_success = False
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
25 selection_success = False
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
26 iRODSCredentials = {"host": "", "port": "", "user": "", "pw": "", "zone": ""}
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
27
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
28
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
29 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
30 # Main function of the iRODS tools
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
31 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
32 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
33 # JSON Object params (argv[1])
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
34 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
35 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
36 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
37 def main():
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
38
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
39 # check input parameters
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
40 if len(sys.argv) == 2:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
41 params = json.loads(sys.argv[1])
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
42 else:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
43 raise Exception("Invalid Parameters submitted!")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
44
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
45 tool_type = params["tool_type"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
46
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
47 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
48 if params["tool_type"] != "up" and params["tool_type"] != "down":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
49 raise Exception("Invalid tool-type parameter submitted!")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
50 except:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
51 raise Exception("No tool-type parameter submitted!")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
52 is_download_call = True
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
53 if tool_type == "up":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
54 is_download_call = False
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
55
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
56 # check params for integrity
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
57 result_string, params_faulty = check_params(params)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
58
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
59 if params_faulty:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
60 raise Exception(result_string)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
61
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
62 global iRODSCredentials, session_success, selected_file, selection_success
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
63 iRODSCredentials["host"] = params["irods_host"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
64 iRODSCredentials["port"] = params["irods_port"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
65 iRODSCredentials["zone"] = params["irods_zone"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
66
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
67 # create login window
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
68 ## make_login_window(params)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
69 iRODSCredentials["user"] = params["irods_user"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
70 iRODSCredentials["pw"] = params["irods_password"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
71
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
72 host = iRODSCredentials["host"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
73 port = iRODSCredentials["port"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
74 user = iRODSCredentials["user"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
75 password = iRODSCredentials["pw"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
76 zone = iRODSCredentials["zone"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
77
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
78 iRODSsession = get_iRODS_connection(host=host, port=port, user=user, password=password, zone=zone)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
79 global session, session_success
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
80 try:
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
81 coll = iRODSsession.collections.get("/" + zone + "/" + "home" + "/" + user)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
82 except Exception:
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
83 raise Exception("Invalid Login")
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
84
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
85 if coll:
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
86 session = iRODSsession
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
87 session_success = True
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
88
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
89
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
90 # check tool settings and start tool execution
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
91 if session_success:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
92 # initialize download tool
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
93 if params["tool_type"] == "down":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
94
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
95 selected_file = params["file_path"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
96 params["user"] = iRODSCredentials["pw"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
97 params["password"] = iRODSCredentials["user"]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
98 # start download routine
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
99 handle_download_call(params)
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
100
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
101 # initialize upload tool
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
102 elif params["tool_type"] == "up":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
103
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
104 if session_success:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
105 params["user"] = iRODSCredentials["pw"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
106 params["password"] = iRODSCredentials["user"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
107 # start upload routine
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
108 handle_upload_call(params)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
109 else:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
110 raise Exception("Logging into iRODS failed")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
111 else:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
112 raise Exception("Logging into iRODS failed")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
113 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
114
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
115
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
116 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
117 # Login Window class for Tkinter
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
118 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
119 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
120 # Tk Window win
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
121 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
122 # (sets global variables iRODSCredentials, session and session_success)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
123 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
124 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
125 class LoginWindow:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
126 def __init__(self, win):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
127 self.window = win
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
128 self.lbl1 = Label(win, text='iRODS Username:')
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
129 self.lbl2 = Label(win, text='iRODS Password:')
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
130 self.t1 = Entry(bd=3)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
131 self.t2 = Entry(show="*")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
132 self.b1 = Button(win, text='Login', command=self.login)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
133
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
134 self.window.grid()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
135 Grid.rowconfigure(self.window, 0, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
136 Grid.rowconfigure(self.window, 1, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
137 Grid.rowconfigure(self.window, 2, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
138 Grid.rowconfigure(self.window, 3, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
139 Grid.rowconfigure(self.window, 4, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
140 Grid.columnconfigure(self.window, 0, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
141
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
142 self.lbl1.grid(row=0, column=0, padx="20", pady="1", sticky="w")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
143 self.t1.grid(row=1, column=0, padx="10", pady="1", sticky="nsew")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
144 self.lbl2.grid(row=2, column=0, padx="20", pady="1", sticky="w")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
145 self.t2.grid(row=3, column=0, padx="10", pady="1", sticky="nsew")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
146 self.b1.grid(row=4, column=0, padx="50", pady="10", sticky="nsew")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
147
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
148 def login(self):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
149 global iRODSCredentials
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
150 user = str(self.t1.get())
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
151 password = str(self.t2.get())
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
152 if user == "" or password == "":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
153 self.window.iconify()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
154 messagebox.showerror("Error", "Username or Password empty!")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
155 self.window.deiconify()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
156 return
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
157 else:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
158 iRODSCredentials["user"] = user
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
159 iRODSCredentials["pw"] = password
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
160
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
161 get_irods_session(self.window)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
162 if not session_success:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
163 return
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
164
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
165 self.window.destroy()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
166 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
167
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
168
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
169 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
170 # File Selection Window class for Tkinter
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
171 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
172 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
173 # Tk Window win
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
174 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
175 # (sets global variables selected_file and selection_success)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
176 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
177 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
178 class FileSelectWindow:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
179 def __init__(self, win):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
180 global session, iRODSCredentials
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
181 self.session = session
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
182 self.window = win
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
183 self.b1 = Button(win, text='Select', command=self.select)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
184 self.lb1 = Listbox(win)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
185
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
186 self.window.grid()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
187 Grid.rowconfigure(self.window, 0, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
188 Grid.rowconfigure(self.window, 1, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
189 Grid.columnconfigure(self.window, 0, weight=1)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
190
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
191 self.lb1.grid(row=0, column=0, padx="20", pady="1", sticky="nswe")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
192 self.b1.grid(row=1, column=0, padx="50", pady="1", sticky="ew")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
193
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
194 coll = session.collections.get("/" + iRODSCredentials["zone"] + "/" + "home" + "/" + iRODSCredentials["user"])
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
195 file_list = []
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
196
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
197 self.get_files_from_collections(coll, file_list)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
198
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
199 for counter in range(len(file_list)):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
200 self.lb1.insert(counter, file_list[counter])
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
201
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
202 def get_files_from_collections(self, coll, file_list):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
203 for obj in coll.data_objects:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
204 file_list.append(obj.path)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
205
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
206 for col in coll.subcollections:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
207 self.get_files_from_collections(col, file_list)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
208
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
209 def select(self):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
210 global session, selected_file, selection_success
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
211 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
212 selection = self.lb1.get(self.lb1.curselection())
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
213 except:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
214 self.window.iconify()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
215 messagebox.showerror("Error", "No file selected!")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
216 self.window.deiconify()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
217 return
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
218
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
219 selected_file = selection
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
220 selection_success = True
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
221 self.window.destroy()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
222 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
223
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
224
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
225 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
226 # Creates an iRODS session and sets the global session variable
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
227 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
228 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
229 # Tk Window window
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
230 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
231 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
232 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
233 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
234 def get_irods_session(window):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
235 global iRODSCredentials
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
236 host = iRODSCredentials["host"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
237 port = iRODSCredentials["port"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
238 user = iRODSCredentials["user"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
239 password = iRODSCredentials["pw"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
240 zone = iRODSCredentials["zone"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
241
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
242 iRODSsession = get_iRODS_connection(host=host, port=port, user=user, password=password, zone=zone)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
243 global session, session_success
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
244 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
245 coll = iRODSsession.collections.get("/" + zone + "/" + "home" + "/" + user)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
246 except Exception:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
247 window.iconify()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
248 messagebox.showerror("Error", "Invalid Authentification")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
249 window.deiconify()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
250 return
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
251
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
252 if coll:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
253 session = iRODSsession
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
254 session_success = True
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
255 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
256
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
257
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
258 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
259 # Helper function to initialize Login Window classes and Tk windows
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
260 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
261 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
262 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
263 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
264 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
265 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
266 def make_login_window(params):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
267 #get login icon
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
268 log_img = ""
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
269 for dirpath, dirnames, filenames in os.walk(params["galaxy_root"]):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
270 for fn in filenames:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
271 if fn == "irods_galaxy_login.png":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
272 log_img = os.path.join(dirpath, fn)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
273 if log_img != "":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
274 break
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
275 if log_img != "":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
276 break
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
277 # print(log_img)
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
278
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
279 window = Tk()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
280 LoginWindow(window)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
281 window.title('iRODS Login')
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
282 window.geometry("450x225+10+10")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
283 window.minsize(450, 225)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
284 window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file=log_img))
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
285 # alternative options:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
286 # window.iconphoto(False, PhotoImage(file='/path/to/ico/icon.png'))
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
287 # window.iconbitmap("/home/richard/git/galaxy_irods_tools/login.ico")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
288 window.mainloop()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
289 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
290
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
291
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
292 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
293 # Helper function to initialize File Selection Window classes and Tk windows
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
294 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
295 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
296 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
297 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
298 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
299 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
300 def make_file_select_window():
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
301 window = Tk()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
302 FileSelectWindow(window)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
303 window.title('iRODS File Select')
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
304 window.geometry("450x225+10+10")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
305 window.minsize(450, 225)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
306 window.mainloop()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
307 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
308
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
309
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
310 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
311 # Checks whether arguments are valid and returns true/false depending on params
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
312 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
313 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
314 # Dict params
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
315 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
316 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
317 # String res_string
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
318 # Bool res_bool
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
319 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
320 def check_params(params):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
321 res_string = ""
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
322 res_bool = False
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
323
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
324 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
325 if params["irods_host"] == "":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
326 res_string += "Host empty!\n"
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
327 res_bool = True
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
328 if params["irods_port"] == "":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
329 res_string += "Port empty!\n"
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
330 res_bool = True
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
331 if params["irods_zone"] == "":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
332 res_string += "Zone empty!\n"
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
333 res_bool = True
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
334 ##if params["selection_type"] == "path" and params["file_path"] == "":
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
335 ## res_string += "Missing file path!\n"
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
336 ## res_bool = True
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
337 except:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
338 raise Exception("Invalid/Missing Parameters")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
339
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
340 return res_string, res_bool
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
341 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
342
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
343
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
344 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
345 # Function to handle iRODS download calls
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
346 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
347 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
348 # Dict params
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
349 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
350 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
351 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
352 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
353 def handle_download_call(params):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
354
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
355 global session, selected_file
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
356
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
357 # check if /ZONE/USER/...FILE... pattern is valid
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
358 if len(selected_file.split("/")) < 2:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
359 raise Exception("Path to file is not valid in iRODS")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
360
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
361 file_list = []
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
362
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
363 # check if file is a directory
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
364 if "." not in selected_file:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
365 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
366 coll = session.collections.get(selected_file)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
367 for file in coll.data_objects:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
368 file_list.append(file.path)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
369 except:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
370 raise Exception("Invalid directory path specified!")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
371 else:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
372 file_list.append(selected_file)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
373
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
374 # get registry file
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
375 reg_file = ""
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
376 for dirpath, dirnames, filenames in os.walk(params["galaxy_root"]):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
377 for fn in filenames:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
378 if fn == "irods_galaxy_registry.xml":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
379 reg_file = os.path.join(dirpath, fn)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
380 if reg_file != "":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
381 break
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
382 if reg_file != "":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
383 break
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
384
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
385 # print(file_list)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
386 # print(os.getcwd())
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
387
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
388 # handle download for all files in file_list
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
389 for f in file_list:
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
390
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
391 file_to_get = f
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
392
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
393 # handle path and file name
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
394 name_file_to_get = file_to_get.split("/")[-1]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
395 path_file_to_get = "/".join(file_to_get.split("/")[0:len(file_to_get.split("/")) - 1])
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
396
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
397 # check iRODS filesystem
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
398 check_iRODS_destination(session, path_file_to_get, name_file_to_get)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
399
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
400 # get file object from iRODS
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
401 iRODS_file_object = session.data_objects.get(path_file_to_get + "/" + name_file_to_get)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
402 input_file = iRODS_file_object.open("r+")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
403 output_file = open(name_file_to_get, "wb")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
404 output_file.write(input_file.read())
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
405 #input_file.seek(0,0)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
406 #print(input_file.read().decode("utf-8"))
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
407 #temp = open("/home/richard/test.txt", "w")
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
408 #input_file.seek(0,0)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
409 #temp.write(input_file.read().decode("utf-8"))
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
410
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
411 input_file.close()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
412 output_file.close()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
413
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
414 abs_file_path = os.path.abspath(name_file_to_get)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
415
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
416 file_type = str(name_file_to_get.split(".")[-1])
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
417
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
418 file_content = {"uuid": None,
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
419 "file_type": "auto",
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
420 "space_to_tab": False,
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
421 "dbkey": "?",
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
422 "to_posix_lines": True,
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
423 "ext": file_type,
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
424 "path": abs_file_path,
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
425 "in_place": True,
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
426 "dataset_id": params["job_id"],
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
427 "type": "file",
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
428 "is_binary": False,
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
429 "link_data_only": "copy_files",
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
430 "name": name_file_to_get
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
431 }
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
432
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
433 with open("temporal.json", "w") as fileParams:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
434 fileParams.write(json.dumps(file_content))
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
435 fileParams.close()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
436
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
437 # load file into Galaxy by using the integrated upload tool - Preparation
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
438 python_command = params["galaxy_root"] + "/tools/data_source/upload.py"
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
439 arg1 = params["galaxy_root"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
440 arg2 = params["galaxy_datatypes"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
441 arg3 = os.path.abspath(fileParams.name)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
442 arg4 = params["job_id"] + ":" + params["out_dir"] + ":" + params["out_file"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
443
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
444 # copy sample registry.xml to working directory
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
445 copyfile(reg_file, params["galaxy_datatypes"])
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
446
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
447 # activate environment for new process call and call the python upload command either both with
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
448 #sys.path.append(params["galaxy_root"] + "/lib")
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
449 #os.system("python -c \'import sys;sys.path.append(\"" + params["galaxy_root"] + "/lib\")\'" + "&& python3 " +
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
450 # python_command + " " + arg1 + " " + arg2 + " " + arg3 + " " + arg4)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
451
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
452 # get upload file
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
453 upload_file = ""
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
454 for dirpath, dirnames, filenames in os.walk(params["galaxy_root"]):
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
455 for fn in filenames:
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
456 if fn == "irods_upload.py":
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
457 upload_file = os.path.join(dirpath, fn)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
458 if upload_file != "":
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
459 break
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
460 if upload_file != "":
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
461 break
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
462
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
463 os.system("python " + upload_file + " " + arg1 + " " + arg2 + " " + arg3 + " " + arg4)
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
464 # close connection
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
465 session.cleanup()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
466 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
467
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
468
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
469 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
470 # Function to handle iRODS upload calls
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
471 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
472 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
473 # Dict params
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
474 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
475 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
476 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
477 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
478 def handle_upload_call(params):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
479
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
480 global session, iRODSCredentials
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
481
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
482 path_to_file = params["up_file_path"]
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
483 name_of_file = params["up_file"]
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
484 #print(path_to_file)
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
485 #print(name_of_file)
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
486
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
487 coll_path = "/" + iRODSCredentials["zone"] + "/home/" + iRODSCredentials["user"] + "/galaxyupload"
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
488 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
489 coll = session.collections.get(coll_path)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
490 except:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
491 coll = session.collections.create(coll_path)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
492
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
493 now = datetime.now()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
494
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
495 # dd/mm/YY
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
496 day = now.strftime("%d%m%Y")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
497 time = now.strftime("%H%M%S")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
498
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
499 coll_path = coll_path + "/" + day
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
500
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
501 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
502 coll = session.collections.get(coll_path)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
503 except:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
504 coll = session.collections.create(coll_path)
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
505
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
506 if "/" in name_of_file:
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
507 name_of_file = name_of_file.split("/")[-1]
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
508
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
509 irods_file_name = time + "_" + name_of_file
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
510 iRODS_file_object = session.data_objects.create(coll_path + "/" + irods_file_name)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
511 iRODS_file_object = session.data_objects.get(coll_path + "/" + irods_file_name)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
512
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
513 irods_file = iRODS_file_object.open("w")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
514 galaxy_file = open(path_to_file, "rb")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
515 content = galaxy_file.read()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
516 irods_file.write(content)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
517
2
0641ea2f75b1 "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 1
diff changeset
518 print("Successfully uploaded: " + name_of_file + "\n as: " + irods_file_name)
1
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
519 # TODO can't close session without writing process finished - but reading/writing happens async.
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
520 # session.cleanup()
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
521
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
522 pass
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
523 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
524
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
525
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
526 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
527 # Function to initialize an iRODS Session - will raise an Exception if timeout is longer than 2 seconds
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
528 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
529 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
530 # String host
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
531 # String port
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
532 # String user
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
533 # String password
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
534 # String zone
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
535 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
536 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
537 # iRODSSession-object session
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
538 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
539 def get_iRODS_connection(host, port, user, password, zone):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
540
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
541 # initialize timeout checker - fires after 2 secs
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
542 import signal
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
543 signal.signal(signal.SIGALRM, timeout_checker)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
544 signal.alarm(2)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
545
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
546 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
547 session = iRODSSession(host=host, port=port, user=user, password=password, zone=zone)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
548 except Exception:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
549 raise Exception("There was a timeout creating the iRODS session")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
550
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
551 # void/reset alarm
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
552 signal.alarm(0)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
553
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
554 return session
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
555 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
556
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
557
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
558 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
559 # Helper function to raise timeout exception when SIGALRM fires
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
560 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
561 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
562 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
563 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
564 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
565 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
566 def timeout_checker():
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
567
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
568 raise Exception("iRODS session timeout")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
569 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
570
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
571
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
572 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
573 # Function to check if file exists in iRODS
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
574 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
575 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
576 # String path
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
577 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
578 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
579 # Bool ret_bool
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
580 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
581 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
582 def check_if_file_exists(path):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
583
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
584 if os.path.isfile(path):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
585 ret_bool = True
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
586 else:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
587 ret_bool = False
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
588
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
589 return ret_bool
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
590 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
591
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
592
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
593 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
594 # Function to check iRODS destination
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
595 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
596 # IN:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
597 # iRODSSession-object session
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
598 # String path
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
599 # String name
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
600 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
601 # OUT:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
602 # Bool ret_bool
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
603 #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
604 ########################################################################################################################
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
605 def check_iRODS_destination(session, path, name):
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
606
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
607 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
608 session.collections.get(path.rstrip("/"))
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
609 except Exception:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
610 raise Exception("Collection doesn't exist in iRODS file system")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
611
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
612 try:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
613 session.data_objects.get(path.rstrip("/") + "/" + name)
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
614 except Exception:
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
615 raise Exception("File doesn't exist in iRODS file system")
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
616 # -------------------------------------------------------------------------------------------------------------------- #
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
617
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
618
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
619 if __name__ == "__main__":
19c1cecdfdfd "planemo upload commit b2a00d9c24285fef0fb131d1832ecf4c337e5038-dirty"
rhohensinner
parents: 0
diff changeset
620 main()