source: CMIP6dreqbuild/trunk/src/framework/uclean.py @ 947

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreqbuild/trunk/src/framework/uclean.py@947
Revision 947, 966 bytes checked in by mjuckes, 3 years ago (diff)

updates

RevLine 
[936]1
2import os, glob
3from dreqPy import dreq
4
5fp = '/var/www/html/dreq/u/%s.html' 
6fp = 'dreqPy/html/u/%s.html'
7
8def clean(fp='dreqPy/html/u/%s.html'):
9  fl = glob.glob( fp % '*' )
10  print len(fl)
11  dq = dreq.loadDreq(manifest='out/dreqManifest.txt')
12  nonu = set()
13  for f in fl:
14   fname = f.split('/')[-1]
15   u = fname[:-5]
16   if u not in dq.inx.uid and u[:6] != 'charme':
17     nonu.add(u)
18     os.unlink(fp % u )
19  print len( nonu )
20
21
22def cleanx(fp='/var/www/html/dreq/data/tabs02/%s'):
23  fl = glob.glob( fp % '*' )
24  fl2 = glob.glob( 'dreqPy/xls/*' )
25  ss = set()
26  for f in fl2:
27    fname = f.split('/')[-1]
28    ss.add(fname)
29  print len(fl)
30  nonu = set()
31  for f in fl:
32   fname = f.split('/')[-1]
33   if fname not in ss:
34     nonu.add(fname)
35     os.unlink(fp % fname )
36  print len( nonu )
37
38
39if __name__ == '__main__':
40  import sys
41  if len(sys.argv) == 1:
42    cleanx()
[942]43    clean( '/var/www/html/dreq/u/%s.html' )
[947]44    clean( '/var/www/f/u/%s.html' )
[936]45    clean()
Note: See TracBrowser for help on using the repository browser.