Browse Source

bug fix: atting file count to folders

Steve Nyemba 4 years ago
parent
commit
7151ee4726
2 changed files with 3 additions and 1 deletions
  1. 2 0
      smart/folder/__init__.py
  2. 1 1
      smart/top/__init__.py

+ 2 - 0
smart/folder/__init__.py

@@ -52,7 +52,9 @@ def read(**args):
             rows = util.content(rows)
 
         r = dict(r, **rows)
+    N = 0 if not os.path.exists(args['path']) else len( os.listdir(args['path']))
     r['path'] = args['path']
+    r['files']= N
     r['name'] = args['path'].split(os.sep)[-1:][0]
     r['node'] = os.uname()[1]
     r['date'] = datetime.datetime.now().strftime('%m-%d-%Y')

+ 1 - 1
smart/top/__init__.py

@@ -96,7 +96,7 @@ def read(**args) :
                 tmp = df[df.name == name.strip()]
                 if not tmp.shape[0] :
                     tmp = {"pid":None,"user":None,"mem":0,"cpu":0,"status":"-100","started":None,"name":name,"cmd":None,"args":None,"date":d,"time":t,"node":n}
-                r = r.append(tmp)
+                r = r.append(tmp,ignore_index=True)
 
         df = r
         #