rda-python-metrics 1.0.10__tar.gz → 1.0.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rda-python-metrics might be problematic. Click here for more details.
- {rda_python_metrics-1.0.10/src/rda_python_metrics.egg-info → rda_python_metrics-1.0.12}/PKG-INFO +1 -1
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/pyproject.toml +1 -1
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcdgusage.py +87 -55
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12/src/rda_python_metrics.egg-info}/PKG-INFO +1 -1
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/LICENSE +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/MANIFEST.in +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/README.md +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/setup.cfg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/PgIPInfo.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/PgView.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/__init__.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillawsusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillawsusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcdgusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcodusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcodusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcountry.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillendtime.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillglobususage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillglobususage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillipinfo.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillipinfo.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filloneorder.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filloneorder.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillosdfusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillosdfusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillrdadb.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillrdadb.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filltdsusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filltdsusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filluser.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filluser.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/logarch.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/logarch.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/pgperson.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/pgsyspath.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/pgusername.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewallusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewallusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewcheckusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewcheckusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewcodusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewcodusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewordusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewordusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewrqstusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewrqstusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewtdsusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewtdsusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewwebfile.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewwebfile.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewwebusage.py +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewwebusage.usg +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics.egg-info/SOURCES.txt +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics.egg-info/dependency_links.txt +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics.egg-info/entry_points.txt +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics.egg-info/requires.txt +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics.egg-info/top_level.txt +0 -0
- {rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/tests/test_metrics.py +0 -0
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcdgusage.py
RENAMED
|
@@ -16,6 +16,7 @@ import sys
|
|
|
16
16
|
import re
|
|
17
17
|
import glob
|
|
18
18
|
from os import path as op
|
|
19
|
+
from time import time as tm
|
|
19
20
|
from rda_python_common import PgLOG
|
|
20
21
|
from rda_python_common import PgUtil
|
|
21
22
|
from rda_python_common import PgFile
|
|
@@ -25,7 +26,7 @@ from . import PgIPInfo
|
|
|
25
26
|
|
|
26
27
|
USAGE = {
|
|
27
28
|
'TDSTBL' : "tdsusage",
|
|
28
|
-
'WEBTBL' : "
|
|
29
|
+
'WEBTBL' : "wusage",
|
|
29
30
|
'CDATE' : PgUtil.curdate(),
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -112,35 +113,44 @@ def get_dataset_ids(dsnames):
|
|
|
112
113
|
dsids = []
|
|
113
114
|
tbname = 'metadata.dataset'
|
|
114
115
|
for dsname in dsnames:
|
|
115
|
-
if re.match(r'^all$', dsname, re.I): return ALLIDS
|
|
116
|
+
if re.match(r'^all$', dsname, re.I): return get_dataset_ids(ALLIDS)
|
|
116
117
|
if dsname not in DSIDS:
|
|
117
118
|
PgLOG.pglog(dsname + ": Unknown CDG dataset short name", PgLOG.LOGWRN)
|
|
118
119
|
continue
|
|
119
|
-
|
|
120
|
+
bt = tm()
|
|
120
121
|
pgrec = PgDBI.pgget(tbname, 'id', "short_name = '{}'".format(dsname))
|
|
121
122
|
if not (pgrec and pgrec['id']): continue
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
rdaids = DSIDS[dsname]
|
|
124
|
+
strids = "{}-{}".format(dsname, rdaids)
|
|
125
|
+
cdgid = pgrec['id']
|
|
126
|
+
cdgids = [cdgid]
|
|
127
|
+
ccnt = 1
|
|
128
|
+
ccnt += recursive_dataset_ids(cdgid, cdgids)
|
|
129
|
+
dsids.append([dsname, rdaids, cdgids, strids])
|
|
130
|
+
rmsg = PgLOG.seconds_to_string_time(tm() - bt)
|
|
131
|
+
PgLOG.pglog("{}: Found {} CDG dsid/subdsids in {} at {}".format(strids, ccnt, rmsg, PgLOG.current_datetime()), PgLOG.LOGWRN)
|
|
126
132
|
|
|
127
133
|
if not dsids: PgLOG.pglog("No Dataset Id identified to gather CDG metrics", PgLOG.LOGWRN)
|
|
128
134
|
|
|
129
135
|
return dsids
|
|
130
136
|
|
|
131
137
|
#
|
|
132
|
-
# get
|
|
138
|
+
# get cdgids recursivley
|
|
133
139
|
#
|
|
134
|
-
def recursive_dataset_ids(
|
|
140
|
+
def recursive_dataset_ids(pcdgid, cdgids):
|
|
135
141
|
|
|
136
142
|
tbname = 'metadata.dataset'
|
|
137
|
-
pgrecs = PgDBI.pgmget(tbname, 'id', "parent_dataset_id = '{}'".format(
|
|
138
|
-
if not pgrecs: return
|
|
143
|
+
pgrecs = PgDBI.pgmget(tbname, 'id', "parent_dataset_id = '{}'".format(pcdgid))
|
|
144
|
+
if not pgrecs: return 0
|
|
139
145
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
ccnt = 0
|
|
147
|
+
for cdgid in pgrecs['id']:
|
|
148
|
+
if cdgid in cdgids: continue
|
|
149
|
+
cdgids.append(cdgid)
|
|
150
|
+
ccnt += 1
|
|
151
|
+
ccnt += recursive_dataset_ids(cdgid, cdgids)
|
|
152
|
+
|
|
153
|
+
return ccnt
|
|
144
154
|
|
|
145
155
|
#
|
|
146
156
|
# get the date ranges for given condition
|
|
@@ -159,24 +169,31 @@ def get_date_ranges(inputs):
|
|
|
159
169
|
tms = input.split('-')
|
|
160
170
|
dates.append(PgUtil.fmtdate(int(tms[0]), int(tms[1]), 1))
|
|
161
171
|
dates.append(PgUtil.enddate(dates[0], 0, 'M'))
|
|
162
|
-
elif opt == '
|
|
172
|
+
elif opt == 'y':
|
|
163
173
|
dates.append(input + "-01-01")
|
|
164
174
|
dates.append(input + "-12-31")
|
|
165
|
-
dranges.append(dates)
|
|
175
|
+
if dates: dranges.append(dates)
|
|
166
176
|
|
|
167
177
|
return dranges
|
|
168
178
|
|
|
169
179
|
#
|
|
170
180
|
# get file download records for given dsid
|
|
171
181
|
#
|
|
172
|
-
def get_dsid_records(
|
|
182
|
+
def get_dsid_records(cdgids, dates, strids):
|
|
173
183
|
|
|
174
184
|
gdex_dbname()
|
|
175
185
|
tbname = 'metrics.file_download'
|
|
176
186
|
fields = ('date_completed, remote_address, logical_file_size, logical_file_name, file_access_point_uri, user_agent_name, bytes_sent, '
|
|
177
187
|
'subset_file_size, range_request, dataset_file_size, dataset_file_name, dataset_file_file_access_point_uri')
|
|
178
|
-
|
|
179
|
-
|
|
188
|
+
dscnt = len(cdgids)
|
|
189
|
+
dscnd = "dataset_id "
|
|
190
|
+
if dscnt == 1:
|
|
191
|
+
dscnd += "= '{}'".format(cdgids[0])
|
|
192
|
+
else:
|
|
193
|
+
dscnd += "IN ('" + "','".join(cdgids) + "')"
|
|
194
|
+
dtcnd = "date_completed BETWEEN '{}' AND '{}'".format(dates[0], dates[1])
|
|
195
|
+
cond = "{} AND completed = True AND {} ORDER BY date_completed".format(dscnd, dtcnd)
|
|
196
|
+
PgLOG.pglog("{}: Query for {} CDG dsid/subdsids and {} at {}".format(strids, dscnt, dtcnd, PgLOG.current_datetime()), PgLOG.LOGWRN)
|
|
180
197
|
pgrecs = PgDBI.pgmget(tbname, fields, cond)
|
|
181
198
|
PgDBI.dssdb_dbname()
|
|
182
199
|
|
|
@@ -191,23 +208,27 @@ def fill_cdg_usages(dsids, dranges):
|
|
|
191
208
|
for dates in dranges:
|
|
192
209
|
for dsid in dsids:
|
|
193
210
|
lcnt += 1
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
211
|
+
dsname = dsid[0]
|
|
212
|
+
rdaids = dsid[1]
|
|
213
|
+
cdgids = dsid[2]
|
|
214
|
+
strids = dsid[3]
|
|
215
|
+
bt = tm()
|
|
216
|
+
pgrecs = get_dsid_records(cdgids, dates, strids)
|
|
198
217
|
pgcnt = len(pgrecs['dataset_file_name']) if pgrecs else 0
|
|
199
218
|
if pgcnt == 0:
|
|
200
|
-
PgLOG.pglog("{}: No record found to gather CDG usage between {} and {}".format(
|
|
219
|
+
PgLOG.pglog("{}: No record found to gather CDG usage between {} and {}".format(strids, dates[0], dates[1]), PgLOG.LOGWRN)
|
|
201
220
|
continue
|
|
202
|
-
|
|
221
|
+
rmsg = PgLOG.seconds_to_string_time(tm() - bt)
|
|
222
|
+
PgLOG.pglog("{}: Got {} records in {} for processing CDG usage at {}".format(strids, pgcnt, rmsg, PgLOG.current_datetime()), PgLOG.LOGWRN)
|
|
203
223
|
tcnt = wcnt = 0
|
|
204
224
|
pwkey = wrec = cdate = None
|
|
205
225
|
trecs = {}
|
|
226
|
+
bt = tm()
|
|
206
227
|
for i in range(pgcnt):
|
|
207
228
|
if (i+1)%20000 == 0:
|
|
208
229
|
PgLOG.pglog("{}/{}/{} CDG/TDS/WEB records processed to add".format(i, tcnt, wcnt), PgLOG.WARNLG)
|
|
209
230
|
|
|
210
|
-
pgrec = PgUtil.onerecord(
|
|
231
|
+
pgrec = PgUtil.onerecord(pgrecs, i)
|
|
211
232
|
dsize = pgrec['bytes_sent']
|
|
212
233
|
if not dsize: continue
|
|
213
234
|
(year, quarter, date, time) = get_record_date_time(pgrec['date_completed'])
|
|
@@ -217,8 +238,9 @@ def fill_cdg_usages(dsids, dranges):
|
|
|
217
238
|
engine = pgrec['user_agent_name']
|
|
218
239
|
wfile = pgrec['dataset_file_name']
|
|
219
240
|
if not wfile: wfile = pgrec['logic_file_name']
|
|
220
|
-
wfrec = get_wfile_record(
|
|
241
|
+
wfrec = get_wfile_record(rdaids, wfile)
|
|
221
242
|
if not wfrec: continue
|
|
243
|
+
dsid = wfrec['dsid']
|
|
222
244
|
ms = re.search(r'^https://tds.ucar.edu/thredds/(\w+)/', url)
|
|
223
245
|
if ms:
|
|
224
246
|
# tds usage
|
|
@@ -235,14 +257,14 @@ def fill_cdg_usages(dsids, dranges):
|
|
|
235
257
|
tcnt += add_tdsusage_records(year, trecs, cdate)
|
|
236
258
|
trecs = {}
|
|
237
259
|
cdate = date
|
|
238
|
-
tkey = "{}:{}:{}:{}".format(ip,
|
|
260
|
+
tkey = "{}:{}:{}:{}".format(ip, dsid, method, etype)
|
|
239
261
|
if tkey in trecs:
|
|
240
262
|
trecs[tkey]['size'] += dsize
|
|
241
263
|
trecs[tkey]['fcount'] += 1
|
|
242
264
|
else:
|
|
243
|
-
wurec = get_wuser_record(ip
|
|
265
|
+
wurec = get_wuser_record(ip)
|
|
244
266
|
if not wurec: return 0
|
|
245
|
-
trecs[tkey] = {'ip' : ip, 'dsid' :
|
|
267
|
+
trecs[tkey] = {'ip' : ip, 'dsid' : dsid, 'date' : cdate, 'time' : time, 'size' : dsize,
|
|
246
268
|
'fcount' : 1, 'method' : method, 'etype' : etype, 'engine' : engine,
|
|
247
269
|
'org_type' : wurec['org_type'], 'country' : wurec['country'],
|
|
248
270
|
'email' : wurec['email']}
|
|
@@ -252,7 +274,7 @@ def fill_cdg_usages(dsids, dranges):
|
|
|
252
274
|
if not fsize: fsize = pgrec['logic_file_size']
|
|
253
275
|
method = 'CDP'
|
|
254
276
|
if pgrec['subset_file_size'] or pgrec['range_request'] or dsize < fsize:
|
|
255
|
-
wkey = "{}:{}:{}".format(ip,
|
|
277
|
+
wkey = "{}:{}:{}".format(ip, dsid, wfile)
|
|
256
278
|
else:
|
|
257
279
|
wkey = None
|
|
258
280
|
|
|
@@ -261,9 +283,7 @@ def fill_cdg_usages(dsids, dranges):
|
|
|
261
283
|
wrec['size'] += dsize
|
|
262
284
|
continue
|
|
263
285
|
wcnt += add_webfile_usage(year, wrec)
|
|
264
|
-
|
|
265
|
-
if not wurec: return 0
|
|
266
|
-
wrec = {'ip' : ip, 'dsid' : wfrec['dsid'], 'wid' : wfrec['wid'], 'date' : date,
|
|
286
|
+
wrec = {'ip' : ip, 'dsid' : dsid, 'wid' : wfrec['wid'], 'date' : date,
|
|
267
287
|
'time' : time, 'quarter' : quarter, 'size' : dsize,
|
|
268
288
|
'locflag' : 'C', 'method' : method}
|
|
269
289
|
pwkey = wkey
|
|
@@ -276,10 +296,8 @@ def fill_cdg_usages(dsids, dranges):
|
|
|
276
296
|
atcnt += tcnt
|
|
277
297
|
awcnt += wcnt
|
|
278
298
|
allcnt += pgcnt
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if lcnt > 1: PgLOG.pglog("{}/{} TDS/WEB usage records added for {} CDG entries at {}".format(atcnt, awcnt, allcnt, PgLOG.current_datetime()), PgLOG.LOGWRN)
|
|
282
|
-
|
|
299
|
+
rmsg = PgLOG.seconds_to_string_time(tm() - bt)
|
|
300
|
+
PgLOG.pglog("{}: {}/{} TDS/WEB usage records added for {} CDG entries in {}".format(strids, atcnt, awcnt, allcnt, rmsg), PgLOG.LOGWRN)
|
|
283
301
|
|
|
284
302
|
def get_record_date_time(ctime):
|
|
285
303
|
|
|
@@ -309,33 +327,43 @@ def add_tdsusage_records(year, records, date):
|
|
|
309
327
|
|
|
310
328
|
return cnt
|
|
311
329
|
|
|
312
|
-
def add_tds_allusage(year,
|
|
330
|
+
def add_tds_allusage(year, logrec):
|
|
313
331
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
332
|
+
pgrec = {'method' : 'CDP', 'source' : 'C'}
|
|
333
|
+
pgrec['email'] = logrec['email']
|
|
334
|
+
pgrec['org_type'] = logrec['org_type']
|
|
335
|
+
pgrec['country'] = logrec['country']
|
|
336
|
+
pgrec['dsid'] = logrec['dsid']
|
|
337
|
+
pgrec['date'] = logrec['date']
|
|
338
|
+
pgrec['quarter'] = logrec['quarter']
|
|
339
|
+
pgrec['time'] = logrec['time']
|
|
340
|
+
pgrec['size'] = logrec['size']
|
|
341
|
+
pgrec['ip'] = logrec['ip']
|
|
342
|
+
return PgDBI.add_yearly_allusage(year, pgrec)
|
|
319
343
|
|
|
320
|
-
return PgDBI.add_yearly_allusage(year, record)
|
|
321
344
|
|
|
322
345
|
#
|
|
323
346
|
# Fill usage of a single online data file into table dssdb.wusage of DSS PgSQL database
|
|
324
347
|
#
|
|
325
|
-
def add_webfile_usage(year, logrec
|
|
348
|
+
def add_webfile_usage(year, logrec):
|
|
326
349
|
|
|
327
350
|
table = "{}_{}".format(USAGE['WEBTBL'], year)
|
|
328
|
-
|
|
351
|
+
cdate = logrec['date']
|
|
352
|
+
ip = logrec['ip']
|
|
353
|
+
cond = "wid = {} AND method = '{}' AND date_read = '{}' AND time_read = '{}'".format(logrec['wid'], logrec['method'], cdate, logrec['time'])
|
|
329
354
|
if PgDBI.pgget(table, "", cond, PgLOG.LOGWRN): return 0
|
|
330
355
|
|
|
356
|
+
wurec = get_wuser_record(ip, cdate, False)
|
|
357
|
+
if not wurec: return 0
|
|
358
|
+
|
|
331
359
|
record = {'wid' : logrec['wid'], 'dsid' : logrec['dsid']}
|
|
332
360
|
record['wuid_read'] = wurec['wuid']
|
|
333
|
-
record['date_read'] =
|
|
361
|
+
record['date_read'] = cdate
|
|
334
362
|
record['time_read'] = logrec['time']
|
|
335
363
|
record['size_read'] = logrec['size']
|
|
336
364
|
record['method'] = logrec['method']
|
|
337
365
|
record['locflag'] = logrec['locflag']
|
|
338
|
-
record['ip'] =
|
|
366
|
+
record['ip'] = ip
|
|
339
367
|
record['quarter'] = logrec['quarter']
|
|
340
368
|
|
|
341
369
|
if add_web_allusage(year, logrec, wurec):
|
|
@@ -345,7 +373,10 @@ def add_webfile_usage(year, logrec, wurec):
|
|
|
345
373
|
|
|
346
374
|
def add_web_allusage(year, logrec, wurec):
|
|
347
375
|
|
|
348
|
-
pgrec = {'
|
|
376
|
+
pgrec = {'source' : 'C'}
|
|
377
|
+
pgrec['email'] = wurec['email']
|
|
378
|
+
pgrec['org_type'] = wurec['org_type']
|
|
379
|
+
pgrec['country'] = wurec['country']
|
|
349
380
|
pgrec['dsid'] = logrec['dsid']
|
|
350
381
|
pgrec['date'] = logrec['date']
|
|
351
382
|
pgrec['quarter'] = logrec['quarter']
|
|
@@ -353,7 +384,6 @@ def add_web_allusage(year, logrec, wurec):
|
|
|
353
384
|
pgrec['size'] = logrec['size']
|
|
354
385
|
pgrec['method'] = logrec['method']
|
|
355
386
|
pgrec['ip'] = logrec['ip']
|
|
356
|
-
pgrec['source'] = 'C'
|
|
357
387
|
return PgDBI.add_yearly_allusage(year, pgrec)
|
|
358
388
|
|
|
359
389
|
#
|
|
@@ -364,7 +394,7 @@ def get_wfile_record(dsids, wfile):
|
|
|
364
394
|
for dsid in dsids:
|
|
365
395
|
wkey = "{}{}".format(dsid, wfile)
|
|
366
396
|
if wkey in WFILES: return WFILES[wkey]
|
|
367
|
-
wfcond = "wfile
|
|
397
|
+
wfcond = "wfile LIKE '%{}'".format(wfile)
|
|
368
398
|
pgrec = None
|
|
369
399
|
for dsid in dsids:
|
|
370
400
|
pgrec = PgSplit.pgget_wfile(dsid, "wid", wfcond)
|
|
@@ -382,11 +412,13 @@ def get_wfile_record(dsids, wfile):
|
|
|
382
412
|
pgrec = PgSplit.pgget_wfile(mvrec['dsid'], "wid", "wid = {}".format(pgrec['wid']))
|
|
383
413
|
if pgrec: pgrec['dsid'] = mvrec['dsid']
|
|
384
414
|
|
|
385
|
-
if pgrec:
|
|
415
|
+
if pgrec:
|
|
416
|
+
wkey = "{}{}".format(pgrec['dsid'], wfile)
|
|
417
|
+
WFILES[wkey] = pgrec
|
|
386
418
|
return pgrec
|
|
387
419
|
|
|
388
420
|
# return wuser record upon success, None otherwise
|
|
389
|
-
def get_wuser_record(ip, date, skipwuid = True):
|
|
421
|
+
def get_wuser_record(ip, date = None, skipwuid = True):
|
|
390
422
|
|
|
391
423
|
if ip in WUSERS: return WUSERS[ip]
|
|
392
424
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillawsusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillawsusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcdgusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcodusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcodusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillcountry.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillendtime.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillglobususage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillglobususage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillipinfo.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillipinfo.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filloneorder.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filloneorder.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillosdfusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillosdfusage.usg
RENAMED
|
File without changes
|
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/fillrdadb.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filltdsusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/filltdsusage.usg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/pgusername.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewallusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewallusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewcheckusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewcheckusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewcodusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewcodusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewordusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewordusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewrqstusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewrqstusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewtdsusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewtdsusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewwebfile.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewwebfile.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewwebusage.py
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics/viewwebusage.usg
RENAMED
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_metrics-1.0.10 → rda_python_metrics-1.0.12}/src/rda_python_metrics.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|