@@ -57,10 +57,12 @@ sites_with_open_transfers = []
5757records = collections .defaultdict (set )
5858
5959sites_ongoings = []
60- sites_total = []
61- sites_copied = []
62- sites_total_stuck = []
63- sites_copied_stuck = []
60+ sites_total = [] # only requests with copied != total
61+ sites_copied = [] # only requests with copied != total
62+ sites_total_stuck = [] # only datasets with copied != total
63+ sites_copied_stuck = [] # only datasets with copied != total
64+ sites_total_ongoing = [] # only datasets with copied != total
65+ sites_copied_ongoing = [] # only datasets with copied != total
6466
6567# Get all sites with ongoing transfers
6668
@@ -124,10 +126,12 @@ def exec_get(sitename):
124126 debug_counter = 0
125127
126128 ongoings = []
127- site_total = 0
128- site_copied = 0
129- site_total_stuck = 0
130- site_copied_stuck = 0
129+ site_total = 0 # request level
130+ site_copied = 0 # request level
131+ site_total_stuck = 0 # dataset level
132+ site_copied_stuck = 0 # dataset level
133+ site_total_ongoing = 0 # dataset level
134+ site_copied_ongoing = 0 # dataset level
131135
132136 rrd_filepath = rrd_dir + '/' + sitename
133137
@@ -154,6 +158,9 @@ def exec_get(sitename):
154158 request_total = 0
155159 request_copied = 0
156160
161+ if len (status ) == 0 :
162+ record .completed = 1 #old transfer. seems to not exist anymore.
163+
157164 for (site , dataset ), (total , copied , last_update ) in status .items ():
158165
159166 #print dataset
@@ -203,6 +210,8 @@ def exec_get(sitename):
203210 ongoings .append ([request_id ,dataset ,copied ,total ,is_stuck ])
204211 site_total_stuck += is_stuck * total
205212 site_copied_stuck += is_stuck * copied
213+ site_total_ongoing += total
214+ site_copied_ongoing += copied
206215 rrdtool .update (rrd_file , '%d:%d:%d' % (timestamp , copied , total ))
207216 else :
208217 try :
@@ -225,6 +234,8 @@ def exec_get(sitename):
225234 sites_copied .append ([sitename ,site_copied ])
226235 sites_total_stuck .append ([sitename ,site_total_stuck ])
227236 sites_copied_stuck .append ([sitename ,site_copied_stuck ])
237+ sites_total_ongoing .append ([sitename ,site_total_ongoing ])
238+ sites_copied_ongoing .append ([sitename ,site_copied_ongoing ])
228239
229240 with open ("%s/filelist.txt" % rrd_filepath , "w" ) as csvfilelist :
230241 fieldnames = ["id" ,"name" ,"copied" ,"total" ,"stuck" ]
@@ -234,7 +245,7 @@ def exec_get(sitename):
234245 writer .writerow ({"id" : ongoing [0 ], "name" : ongoing [1 ], "copied" : ongoing [2 ], "total" : ongoing [3 ], "stuck" : ongoing [4 ]})
235246
236247
237- parallel_exec (exec_get , sites_with_open_transfers , num_threads = min (64 , len (sites_with_open_transfers )), print_progress = True , timeout = 12000 )
248+ parallel_exec (exec_get , sites_with_open_transfers , num_threads = min (32 , len (sites_with_open_transfers )), print_progress = True , timeout = 12000 )
238249
239250for site in sites_with_open_transfers :
240251 for record in records [site ]:
@@ -255,8 +266,8 @@ with open("%s/overview.txt" % rrd_dir, "w") as overview:
255266 for site in sites_with_open_transfers :
256267 if sum (x [1 ] for x in sites_total if x [0 ] == site ) == 0 :
257268 continue
258- writer .writerow ({"sitename" : site , "ongoing" : sum (x [1 ] for x in sites_ongoings if x [0 ] == site ), "total" : sum (x [1 ] for x in sites_total if x [0 ] == site ),
259- "copied" : sum (x [1 ] for x in sites_copied if x [0 ] == site ), "total_stuck" : sum (x [1 ] for x in sites_total_stuck if x [0 ] == site ), "copied_stuck" : sum (x [1 ] for x in sites_copied_stuck if x [0 ] == site )})
269+ writer .writerow ({"sitename" : site , "ongoing" : sum (x [1 ] for x in sites_ongoings if x [0 ] == site ), "total" : sum (x [1 ] for x in sites_total_ongoing if x [0 ] == site ),
270+ "copied" : sum (x [1 ] for x in sites_copied_ongoing if x [0 ] == site ), "total_stuck" : sum (x [1 ] for x in sites_total_stuck if x [0 ] == site ), "copied_stuck" : sum (x [1 ] for x in sites_copied_stuck if x [0 ] == site )})
260271
261272total_volume = sum ((x [1 ] for x in sites_total ))
262273copied_volume = sum ((x [1 ] for x in sites_copied ))
0 commit comments