Loading transfer_service/cleaner.py +10 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,13 @@ dbConn = DbConnector(params["user"], params["db"], 1, 1) params = config.loadSection("cleanup") maxDays = params.getint("max_days") maxSeconds = params.getint("max_seconds") if maxDays <= 0 and maxSeconds < 30: maxDays = 0 maxSeconds = 30 fileList = dbConn.getNodesToBeDeleted() basePaths = [] Loading @@ -28,15 +35,13 @@ for row in fileList: phyDeletedTstamp = row["phy_deleted_on"] nodeId = row["node_id"] delta = cTime - dTime if delta.seconds > 30 and phyDeletedTstamp is None: print(filePath + '\n') if delta.days >= maxDays and delta.seconds > maxSeconds and phyDeletedTstamp is None: os.remove(filePath) print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' ' + filePath) dbConn.setPhyDeletedOn(nodeId) if basePath not in basePaths: basePaths.append(basePath) print() dirList = [] for basePath in basePaths: for root, dir, files in os.walk(basePath, topdown = False): Loading @@ -44,8 +49,8 @@ for basePath in basePaths: dirList.append(root) for dir in dirList: print(dir + '\n') os.rmdir(dir) print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' ' + dir) # 1) delete files # 2) check for empty dirs and delete them if different from rootPath (second step), then update the db transfer_service/config/vos_ts.conf +6 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,12 @@ max_terminated_jobs = 8 ; job queues (do NOT set to zero), default is 15 s exec_wait_time = 15 [cleanup] ; Physically delete from disk all nodes previously deleted by the user via ui ; 'max_days' days and 'max_seconds' seconds ago (if any) max_days = 0 max_seconds = 30 #################### # Storage settings # Loading Loading
transfer_service/cleaner.py +10 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,13 @@ dbConn = DbConnector(params["user"], params["db"], 1, 1) params = config.loadSection("cleanup") maxDays = params.getint("max_days") maxSeconds = params.getint("max_seconds") if maxDays <= 0 and maxSeconds < 30: maxDays = 0 maxSeconds = 30 fileList = dbConn.getNodesToBeDeleted() basePaths = [] Loading @@ -28,15 +35,13 @@ for row in fileList: phyDeletedTstamp = row["phy_deleted_on"] nodeId = row["node_id"] delta = cTime - dTime if delta.seconds > 30 and phyDeletedTstamp is None: print(filePath + '\n') if delta.days >= maxDays and delta.seconds > maxSeconds and phyDeletedTstamp is None: os.remove(filePath) print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' ' + filePath) dbConn.setPhyDeletedOn(nodeId) if basePath not in basePaths: basePaths.append(basePath) print() dirList = [] for basePath in basePaths: for root, dir, files in os.walk(basePath, topdown = False): Loading @@ -44,8 +49,8 @@ for basePath in basePaths: dirList.append(root) for dir in dirList: print(dir + '\n') os.rmdir(dir) print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' ' + dir) # 1) delete files # 2) check for empty dirs and delete them if different from rootPath (second step), then update the db
transfer_service/config/vos_ts.conf +6 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,12 @@ max_terminated_jobs = 8 ; job queues (do NOT set to zero), default is 15 s exec_wait_time = 15 [cleanup] ; Physically delete from disk all nodes previously deleted by the user via ui ; 'max_days' days and 'max_seconds' seconds ago (if any) max_days = 0 max_seconds = 30 #################### # Storage settings # Loading