-
Notifications
You must be signed in to change notification settings - Fork 8
/
delete_everything.py
49 lines (33 loc) · 1.3 KB
/
delete_everything.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import glob
import os
import pandas as pd
from xchem_db.models import *
soakdb_rows = SoakdbFiles.objects.all()
for row in soakdb_rows:
path = str(row.filename + '_' + str(row.modification_date) + '.transferred')
if not os.path.isfile(path):
print(path)
else:
os.remove(path)
list_of_files = glob.glob('logs/search_paths_*')
latest_file = max(list_of_files, key=os.path.getctime)
search_paths = [path for path in pd.DataFrame.from_csv(latest_file)['search_path']]
for path in search_paths:
if os.path.isfile(os.path.join(path, 'transfer_pandda_data.done')):
os.remove(os.path.join(path, 'transfer_pandda_data.done'))
files_to_check = glob.glob(os.path.join(path, '*201806*'))
for f in files_to_check:
if 'txt' in f:
os.remove(f)
pandda_runs = PanddaRun.objects.all()
logfiles = [run.pandda_log for run in pandda_runs]
for logfile in logfiles:
if os.path.isfile(logfile + '.run.done'):
print(str(logfile + '.run.done'))
os.remove(logfile + '.run.done')
if os.path.isfile(logfile + '.events.done'):
print(str(logfile + '.events.done'))
os.remove(logfile + '.events.done')
if os.path.isfile(logfile + '.sites.done'):
print(str(logfile + '.sites.done'))
os.remove(logfile + '.sites.done')