Commit 515a30a6 authored by hardy's avatar hardy

fix avg file size computation when folder is empty

parent e241fb50
...@@ -72,12 +72,15 @@ class Log_Mgt: ...@@ -72,12 +72,15 @@ class Log_Mgt:
COMMAND="ls -rtl "+ self.path COMMAND="ls -rtl "+ self.path
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
result = ssh.stdout.readlines() result = ssh.stdout.readlines()
total_size=0 if len(result)>1: #at least 1 file present
for i in range(1,len(result)): total_size=0
s=result[i].decode('utf-8').rstrip() for i in range(1,len(result)):
tmp=s.split() s=result[i].decode('utf-8').rstrip()
total_size+=int(tmp[4]) #get filesize tmp=s.split()
return math.floor(total_size/(len(result)-1)) #compute average file/artifact size total_size+=int(tmp[4]) #get filesize
return math.floor(total_size/(len(result)-1)) #compute average file/artifact size
else:#empty,no files
return 0
#-----------------$ #-----------------$
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment