rda-python-metrics 1.0.4__py3-none-any.whl

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.

Files changed (47) hide show
  1. rda_python_metrics/PgIPInfo.py +188 -0
  2. rda_python_metrics/PgView.py +782 -0
  3. rda_python_metrics/__init__.py +1 -0
  4. rda_python_metrics/fillawsusage.py +282 -0
  5. rda_python_metrics/fillawsusage.usg +17 -0
  6. rda_python_metrics/fillcodusage.py +247 -0
  7. rda_python_metrics/fillcodusage.usg +21 -0
  8. rda_python_metrics/fillcountry.py +79 -0
  9. rda_python_metrics/fillendtime.py +93 -0
  10. rda_python_metrics/fillglobususage.py +287 -0
  11. rda_python_metrics/fillglobususage.usg +17 -0
  12. rda_python_metrics/fillipinfo.py +185 -0
  13. rda_python_metrics/fillipinfo.usg +18 -0
  14. rda_python_metrics/filloneorder.py +155 -0
  15. rda_python_metrics/filloneorder.usg +41 -0
  16. rda_python_metrics/fillrdadb.py +151 -0
  17. rda_python_metrics/fillrdadb.usg +32 -0
  18. rda_python_metrics/filltdsusage.py +289 -0
  19. rda_python_metrics/filltdsusage.usg +17 -0
  20. rda_python_metrics/filluser.py +216 -0
  21. rda_python_metrics/filluser.usg +16 -0
  22. rda_python_metrics/logarch.py +359 -0
  23. rda_python_metrics/logarch.usg +27 -0
  24. rda_python_metrics/pgperson.py +72 -0
  25. rda_python_metrics/pgusername.py +50 -0
  26. rda_python_metrics/viewallusage.py +350 -0
  27. rda_python_metrics/viewallusage.usg +198 -0
  28. rda_python_metrics/viewcheckusage.py +289 -0
  29. rda_python_metrics/viewcheckusage.usg +185 -0
  30. rda_python_metrics/viewcodusage.py +314 -0
  31. rda_python_metrics/viewcodusage.usg +184 -0
  32. rda_python_metrics/viewordusage.py +340 -0
  33. rda_python_metrics/viewordusage.usg +224 -0
  34. rda_python_metrics/viewrqstusage.py +362 -0
  35. rda_python_metrics/viewrqstusage.usg +217 -0
  36. rda_python_metrics/viewtdsusage.py +323 -0
  37. rda_python_metrics/viewtdsusage.usg +191 -0
  38. rda_python_metrics/viewwebfile.py +294 -0
  39. rda_python_metrics/viewwebfile.usg +212 -0
  40. rda_python_metrics/viewwebusage.py +371 -0
  41. rda_python_metrics/viewwebusage.usg +211 -0
  42. rda_python_metrics-1.0.4.dist-info/METADATA +18 -0
  43. rda_python_metrics-1.0.4.dist-info/RECORD +47 -0
  44. rda_python_metrics-1.0.4.dist-info/WHEEL +5 -0
  45. rda_python_metrics-1.0.4.dist-info/entry_points.txt +22 -0
  46. rda_python_metrics-1.0.4.dist-info/licenses/LICENSE +21 -0
  47. rda_python_metrics-1.0.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env python3
2
+ #*******************************************************************
3
+ # Title : pgusername.py
4
+ # Author : Zaihua Ji, zji@ucar.edu
5
+ # Date : 2025-03-27
6
+ # Purpose : utility program to retrieve user info from People DB
7
+ # for a given UCAR user login name
8
+ #
9
+ # Github : https://github.com/NCAR/rda-python-metrics.git
10
+ #
11
+ #*******************************************************************
12
+
13
+ import httplib2
14
+ import json
15
+ import sys
16
+ from rda_python_common import PgLOG
17
+
18
+ url="https://people.api.ucar.edu/usernames/"
19
+
20
+ #
21
+ # main function to excecute this script
22
+ #
23
+ def main():
24
+
25
+ pgname = "pgusername"
26
+ if sys.argc != 2:
27
+ print("Usage: {} UserName".format(pgname))
28
+ sys.exit(0)
29
+
30
+ uname = sys.argv[1]
31
+
32
+ headers = {'Content-type': 'application/json'}
33
+ http=httplib2.Http()
34
+ response, content = http.request(url + uname, 'GET', headers=headers)
35
+ status = response.status
36
+ if status == 200:
37
+ person=json.loads(content)
38
+ for key, value in person.items():
39
+ print("{}<=>{}".format(key, value))
40
+ elif status == 399:
41
+ print(content)
42
+ elif status == 500:
43
+ print('Server error')
44
+
45
+ sys.exit(0)
46
+
47
+ #
48
+ # call main() to start program
49
+ #
50
+ if __name__ == "__main__": main()
@@ -0,0 +1,350 @@
1
+ #!/usr/bin/env python
2
+ #
3
+ ###############################################################################
4
+ #
5
+ # Title : viewallusage
6
+ # Author : Zaihua Ji, zji@ucar.edu
7
+ # Date : 03/01/2022
8
+ # 2025-03-27 transferred to package rda_python_metrics from
9
+ # https://github.com/NCAR/rda-database.git
10
+ # Purpose : python program to view all usage information.
11
+ #
12
+ # Github : https://github.com/NCAR/rda-python-metrics.git
13
+ #
14
+ ###############################################################################
15
+ #
16
+ import os
17
+ import re
18
+ import sys
19
+ from rda_python_common import PgLOG
20
+ from rda_python_common import PgUtil
21
+ from rda_python_common import PgDBI
22
+ from . import PgView
23
+
24
+ VUSG = {
25
+ 'SNMS' : "ABCDEFGHMNOPQRSTUVWY", # all available short field names in FLDS
26
+ 'OPTS' : 'AabcCdDeEfghHImnLMNoOqsStTUvVwyz', # all available options, used for params
27
+ 'NOPT' : 'abhwz', # stand alone option without inputs
28
+ 'ACND' : 'cdefgmMoqStvy', # available array condition options
29
+ 'RCND' : 'DsNT', # available range condition options
30
+ 'CNDS' : 'acdDeEfgmMnNoqsStTvVy', # condition options, ACND, RCND and 'a'
31
+ 'HCND' : 'N', # condition options for having clause
32
+ 'ECND' : 'my', # condition options need evaluating
33
+ 'TCND' : 'dDmy', # temporal condition options
34
+ 'SFLD' : 'DEFGNOPTVW', # string fields, to be quoted in condition
35
+ 'UFLD' : 'GNOVW', # string fields must be in upper case
36
+ 'LFLD' : 'EPT' # string fields must be in lower case
37
+ }
38
+
39
+ # keys FLDS - short field names
40
+ # column 0 - column title showing in usage view
41
+ # column 1 - field name in format as shown in select clauses
42
+ # column 2 - field name shown in where condition query string
43
+ # column 3 - table name that the field belongs to
44
+ # column 4 - output field length, the longer one of data size and comlun title, determine
45
+ # dynamically if it is 0. Negative values indicate right justification
46
+ # column 5 - precision for floating point value if positive and an integer value if -1
47
+ # column 6 - field flag to indicate it is a group, distinct or sum field
48
+ FLDS = {
49
+ # SHRTNM COLUMNNANE FIELDNAME CNDNAME TBLNAM Size Prc Grp/Sum
50
+ 'D' : ['DATE', "date", 'date', 'allusage', 10, 0, 'G'],
51
+ 'E' : ['EMAIL', "allusage.email", 'allusage.email', 'allusage', 0, 0, 'G'],
52
+ 'F' : ['FORMAT', "data_format", 'data_format', 'dataset', 0, 0, 'G'],
53
+ 'M' : ['MONTH', PgDBI.fmtym("date"), 'date', 'allusage', 7, 0, 'G'],
54
+ 'N' : ['COUNTRY', "country", 'country', 'allusage', 0, 0, 'G'],
55
+ 'G' : ['GROUP', "source", 'source', 'allusage', 0, 0, 'G'],
56
+ 'O' : ['ORGTYPE', "org_type", 'org_type', 'allusage', 7, 0, 'G'],
57
+ 'P' : ['DSOWNER', "specialist", 'specialist', 'dsowner', 8, 0, 'G'],
58
+ 'Q' : ['QUARTER', "quarter", 'quarter', 'allusage', 7, -1, 'G'],
59
+ 'R' : ['DSTITLE', "search.datasets.title", 'search.datasets.title', 'search.datasets', 0, 0, 'G'],
60
+ 'S' : ['BYTESIZE', "size", 'size', 'allusage', -14, -1, 'G'],
61
+ 'T' : ['DATASET', "allusage.dsid", 'allusage.dsid', 'allusage', 0, 0, 'G'],
62
+ 'V' : ['IPADDRESS', "ip", 'ip', 'allusage', 15, 0, 'G'],
63
+ 'W' : ['METHOD', "method", 'method', 'allusage', 6, 0, 'G'],
64
+ 'Y' : ['YEAR', PgDBI.fmtyr("date"), 'date', 'allusage', 4, 0, 'G'],
65
+ 'A' : ['DSCOUNT', "allusage.dsid", 'A', 'allusage', -7, -1, 'D'],
66
+ 'B' : ['MBYTEREAD', "round(sum(size)/(1000000), 4)", 'B', 'allusage', -14, 3, 'S'],
67
+ 'C' : ['#UNIQUSER', "allusage.email", 'C', 'allusage', -9, -1, 'D'],
68
+ 'H' : ['#READ', "count(*)", 'H', 'allusage', -8, -1, 'S'],
69
+ 'U' : ['#UNIQIP', "ip", 'U', 'allusage', -9, -1, 'D'],
70
+ 'X' : ['INDEX', "", 'X', '', -6, -1, ' ']
71
+ }
72
+
73
+ # keys EXPAND - short field names allow zero usage
74
+ # column 0 - expand ID for group of fields
75
+ # column 1 - field name shown in where condition query string
76
+ # column 2 - field name in format as shown in select clauses
77
+ # column 3 - table name that the field belongs to
78
+ EXPAND = {
79
+ # SHRTNM EXPID CNDSTR FIELDNAME TBLNAM
80
+ 'D' : ["TIME", "dDmy"],
81
+ 'M' : ["TIME", "dDmy"],
82
+ 'Q' : ["TIME", "dDmy"],
83
+ 'Y' : ["TIME", "dDmy"],
84
+
85
+ 'E' : ["USER", "ecgo", "email", "wuser", "user"],
86
+ 'O' : ["USER", "ecgo", "org_type", "wuser", "user"],
87
+ 'N' : ["USER", "ecgo", "country", "wuser", "user"],
88
+ 'G' : ["USER", "ecgo", "region", "wuser", "user"],
89
+
90
+ 'R' : ["DSID", "fFsStT", "search.datasets.title", "search.datasets"],
91
+ 'T' : ["DSID", "fFsStT", "dataset.dsid", "dataset"],
92
+ 'P' : ["DSID", "fFsStT", "specialist", "dsowner"],
93
+
94
+ 'W' : ["METHOD", "gM", "method", "allusage"],
95
+ 'G' : ["METHOD", "gM", "source", "allusage"]
96
+ }
97
+
98
+ # valid options for params, a hash array of command line parameters
99
+ # a -- 1 to view all usage info available
100
+ # A -- number or records to return
101
+ # c -- array of specified country codes
102
+ # C -- a string of short field names for viewing usages
103
+ # d -- array of specified dates
104
+ # D -- dates range, array of 1 or 2 dates in format of YYYY-MM-DD
105
+ # e -- array of specified email addresses
106
+ # E -- use given date or date range for email notice of data update
107
+ # f -- use given data format to specify datasets.data_format
108
+ # g -- array of data usage source groups
109
+ # h -- for give emails, include their histical emails registered before
110
+ # H -- a string of report title to replace the default one
111
+ # I -- use given email IDs for email notice of data update
112
+ # L -- column delimiter for output
113
+ # m -- array of specified months
114
+ # M -- array of specified download methods
115
+ # N -- number read range, arrage of 1 or 2 integers
116
+ # o -- array of specified orginization types
117
+ # O -- a string of short field names for sorting on
118
+ # q -- array of the specified quarters, normally combined with years
119
+ # s -- file size range, arrage of 1 or 2 sizes in unit of MByte
120
+ # S -- array of login names of specialists who owns the datasets
121
+ # t -- array of specified dataset names
122
+ # T -- dataset range, array of 1 or 2 dataset names
123
+ # U -- use given unit for file or data sizes
124
+ # v -- array of specified IP addresses
125
+ # V -- IP address range
126
+ # w -- generate view without totals
127
+ # y -- array of specified years
128
+ # z -- generate view including entries without usage
129
+ params = {}
130
+
131
+ # relationship between parameter options and short field names, A option is not
132
+ # related to a field name if it is not in keys SNS
133
+ SNS = {
134
+ 'c' : 'N', 'd' : 'D', 'D' : 'D', 'e' : 'E', 'f' : 'F', 'g' : 'G', 'm' : 'M', 'M' : 'W', 'N' : 'H',
135
+ 'o' : 'O', 'q' : 'Q', 's' : 'S', 'S' : 'P', 't' : 'T', 'T' : 'T', 'u' : 'U', 'v' : 'V', 'V' : 'V', 'y' : 'Y'
136
+ }
137
+
138
+ tablenames = fieldnames = condition = ''
139
+ sfields = []
140
+ gfields = []
141
+ dfields = []
142
+ pgname = 'viewallusage'
143
+
144
+ #
145
+ # main function to run this program
146
+ #
147
+ def main():
148
+
149
+ PgDBI.view_dbinfo()
150
+ argv = sys.argv[1:]
151
+ inputs = []
152
+ option = 'C' # default option
153
+
154
+ for arg in argv:
155
+ if re.match(r'^-.*$', arg):
156
+ curopt = arg[1:2]
157
+ if curopt and VUSG['OPTS'].find(curopt) > -1:
158
+ if VUSG['NOPT'].find(option) > -1:
159
+ params[option] = 1
160
+ elif inputs:
161
+ params[option]= inputs # record input array
162
+ inputs = [] # empty input array
163
+ option = curopt # start a new option
164
+ else:
165
+ PgLOG.pglog(arg + ": Unknown Option", PgLOG.LGWNEX)
166
+ else:
167
+ val = arg
168
+ if val != '!':
169
+ if option == 's':
170
+ val = int(val)*1000000 # convert MBytes to Bytes
171
+ elif option in SNS:
172
+ sfld = SNS[option]
173
+ if VUSG['SFLD'].find(sfld) > -1:
174
+ if VUSG['UFLD'].find(sfld) > -1:
175
+ val = arg.upper() # in case not in upper case
176
+ elif VUSG['LFLD'].find(sfld) > -1:
177
+ val = arg.lower() # in case not in lower case
178
+ if option == 'c':
179
+ val = PgView.get_country_name(val)
180
+ elif option == 't' or option == 'T':
181
+ val = PgUtil.format_dataset_id(val) # add 'ds' if only numbers
182
+ val = "'{}'".format(val)
183
+ inputs.append(val)
184
+
185
+ # record the last option
186
+ if VUSG['NOPT'].find(option) > -1:
187
+ params[option] = 1
188
+ elif inputs:
189
+ params[option] = inputs # record input array
190
+
191
+ if not params:
192
+ PgLOG.show_usage(pgname)
193
+ else:
194
+ check_enough_options()
195
+
196
+ if 'o' not in params:
197
+ if 'e' not in params:
198
+ params['o'] = ['!', "'DSS'"] # default to exclude 'DSS' for organization
199
+ elif params['o'][0] == "'ALL'":
200
+ del params['o']
201
+
202
+ usgtable = 'allusage'
203
+ years = PgView.build_year_list(params, VUSG)
204
+ build_query_strings(usgtable) # build tablenames, fieldnames, and condtions
205
+ records = None
206
+ for year in sorted(years):
207
+ tname = "{}_{}".format(usgtable, year)
208
+ tbls = tablenames.replace(usgtable, tname)
209
+ flds = fieldnames.replace(usgtable, tname)
210
+ cond = condition.replace(usgtable, tname)
211
+ pgrecs = PgDBI.pgmget(tbls, flds, cond, PgLOG.UCLWEX)
212
+ if pgrecs:
213
+ if records:
214
+ for fld in records: records[fld].extend(pgrecs[fld])
215
+ else:
216
+ records = pgrecs
217
+ if not records: PgLOG.pglog("No Usage Found For Given Conditions", PgLOG.LGWNEX)
218
+ totals = None if 'w' in params else {}
219
+ if dfields or totals != None or len(years) > 1:
220
+ records = PgView.compact_hash_groups(records, gfields, sfields, dfields, totals)
221
+ if 'z' in params: records = expand_records(records)
222
+ ostr = params['O'][0] if 'O' in params else params['C'][0]
223
+ records = PgView.order_records(records, ostr.replace('X', ''))
224
+ PgView.simple_output(params, FLDS, records, totals)
225
+
226
+ PgLOG.pgexit(0)
227
+
228
+ #
229
+ # cehck if enough information entered on command line for generate view/report, exit if not
230
+ #
231
+ def check_enough_options():
232
+
233
+ cols = params['C'][0] if 'C' in params else 'X'
234
+ if cols == 'X': PgLOG.pglog("{}: miss field names '{}'".format(pgname, VUSG['SNMS']), PgLOG.LGWNEX)
235
+
236
+ if cols.find('Q') > -1 and cols.find('Y') < 0: # add Y if Q included
237
+ cols = re.sub('Q', 'YQ', cols)
238
+ params['C'][0] = cols
239
+
240
+ for sn in cols:
241
+ if sn == 'X': continue # do not process INDEX field
242
+ if VUSG['SNMS'].find(sn) < 0:
243
+ PgLOG.pglog("{}: Field {} must be in short field names '{}X'".format(pgname, sn, VUSG['SNMS']), PgLOG.LGWNEX)
244
+ if 'z' not in params or sn in EXPAND: continue
245
+ fld = FLDS[sn]
246
+ if fld[6] != 'G': continue
247
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
248
+
249
+ if 'E' in params or 'I' in params:
250
+ if 'z' in params:
251
+ PgLOG.pglog(pgname + ": option -z and -E/-I can not be present at the same time", PgLOG.LGWNEX)
252
+ elif 't' not in params or len(params['t']) > 1:
253
+ PgLOG.pglog(pgname + ": specify one dataset for viewing usage of notified users", PgLOG.LGWNEX)
254
+ elif 'E' in params and 'I' in params:
255
+ PgLOG.pglog(pgname + ": option -E and -I can not be present at the same time", PgLOG.LGWNEX)
256
+
257
+ for opt in params:
258
+ if VUSG['CNDS'].find(opt) > -1: return
259
+ PgLOG.pglog("{}: miss condition options '{}'".format(pgname, VUSG['CNDS']), PgLOG.LGWNEX)
260
+
261
+ #
262
+ # process parameter options to build all query strings
263
+ # global variables are used directly and nothing passes in and returns back
264
+ #
265
+ def build_query_strings(usgtable):
266
+
267
+ # initialize query strings
268
+ global condition, fieldnames, tablenames
269
+ joins = having = groupnames = ''
270
+ tablenames = usgtable
271
+ cols = params['C'][0]
272
+
273
+ if 'U' in params: # reset units for file and read sizes
274
+ if cols.find('B') > -1: FLDS['B'] = PgView.set_data_unit(FLDS['B'], params['U'][0], "sum(size)")
275
+ if cols.find('S') > -1: FLDS['S'] = PgView.set_data_unit(FLDS['S'], params['U'][0], "size")
276
+
277
+ if 'e' in params and 'h' in params: params['e'] = PgView.include_historic_emails(params['e'], 3)
278
+
279
+ for opt in params:
280
+ if opt == 'C': # build field, table and group names
281
+ for sn in cols:
282
+ if sn == 'X': continue # do not process INDEX field
283
+ fld = FLDS[sn]
284
+ if fieldnames: fieldnames += ', '
285
+ fieldnames += "{} {}".format(fld[1], sn) # add to field name string
286
+ (tablenames, joins) = PgView.join_query_tables(fld[3], tablenames, joins, usgtable)
287
+ if fld[6] == 'S':
288
+ sfields.append(sn)
289
+ else:
290
+ if groupnames: groupnames += ', '
291
+ groupnames += sn # add to group name string
292
+ if fld[6] == 'D':
293
+ dfields.append(sn)
294
+ else:
295
+ gfields.append(sn)
296
+ elif opt == 'O':
297
+ continue # order records later
298
+ elif VUSG['CNDS'].find(opt) > -1:
299
+ if VUSG['NOPT'].find(opt) > -1: continue
300
+ sn = SNS[opt]
301
+ fld = FLDS[sn]
302
+ # build having and where conditon strings
303
+ cnd = PgView.get_view_condition(opt, sn, fld, params, VUSG)
304
+ if cnd:
305
+ if VUSG['HCND'].find(opt) > -1:
306
+ if having: having += ' AND '
307
+ having += cnd
308
+ else:
309
+ if condition: condition += ' AND '
310
+ condition += cnd
311
+ (tablenames, joins) = PgView.join_query_tables(fld[3], tablenames, joins, usgtable)
312
+
313
+ # append joins, group by, order by, and having strings to condition string
314
+ if 'E' in params or 'I' in params:
315
+ (tablenames, joins) = PgView.join_query_tables("emreceive", tablenames, joins, usgtable)
316
+ if joins:
317
+ if condition:
318
+ condition = "{} AND {}".format(joins, condition)
319
+ else:
320
+ condition = joins
321
+ if 'E' in params or 'I' in params:
322
+ condition += PgView.notice_condition(params['E'], params['I'], params['t'][0])
323
+ if groupnames and sfields: condition += " GROUP BY " + groupnames
324
+ if having: condition += " HAVING " + having
325
+
326
+ #
327
+ # exand records as needed
328
+ #
329
+ def expand_records(records):
330
+
331
+ recs = PgView.expand_query("TIME", records, params, EXPAND)
332
+
333
+ trecs = PgView.expand_query("USER", records, params, EXPAND, VUSG, SNS, FLDS)
334
+ recs = PgUtil.crosshash(recs, trecs)
335
+
336
+ trecs = PgView.expand_query("DSID", records, params, EXPAND, VUSG, SNS, FLDS)
337
+ recs = PgUtil.crosshash(recs, trecs)
338
+
339
+ trecs = PgView.expand_query("OWNER", records, params, EXPAND, VUSG, SNS, FLDS)
340
+ recs = PgUtil.crosshash(recs, trecs)
341
+
342
+ trecs = PgView.expand_query("METHOD", records, params, EXPAND, VUSG, SNS, FLDS)
343
+ recs = PgUtil.crosshash(recs, trecs)
344
+
345
+ return PgUtil.joinhash(records, recs, 0, 1)
346
+
347
+ #
348
+ # call main() to start program
349
+ #
350
+ if __name__ == "__main__": main()
@@ -0,0 +1,198 @@
1
+
2
+ View all usage information of MSS, WEB and Order data from information
3
+ stored in MySQL database 'RDADB'.
4
+
5
+ Usage: viewallusage [-C] ColumnNames [-O OrderColumnNames] [-a] \
6
+ [-A RowLimit] [-c CountryCodes] [-d DateList] \
7
+ [-D StartDate [EndDate]] [-e EMailList] -h \
8
+ [-E StartNoticeDate [EndNoticeDate]] [-f DataFormats] \
9
+ [-g SourceGroups] [-I EmailIDList] [-m MonthList] \
10
+ [-M MethodList] [-N MinNumberRead [MaxNumberRead]] \
11
+ [-o OrganizationTypes] \
12
+ [-q QuaterList] [-s MinSize [MaxSize]] \
13
+ [-S SpecialistLoginNames] [-t DatasetList] \
14
+ [-T MinDataset [MaxDataset]] [-y YearList] \
15
+ [-v IPAddressList] [-V MinIPAddress [MaxIPAddress]] \
16
+ [-H Title] [-L Delimiter] [-U SizeUnit] \
17
+ [-w] [-z] [> OutputFileName] [| lp -d PrinterName]
18
+
19
+ Specify [-C] ColumnNames, refer to Option -C section for detail
20
+ description, and choose at least one of the condition options, -a, -c,
21
+ -d, -D, -e, -E, -f, -g, -I, -m, -M, -N, -o, -q, -s, -S -t, -T, -v, -V
22
+ and -y, to run this application.
23
+
24
+ For all condition options, except option -a, an '!' sign can be added
25
+ between an option flag and its option values to get an excluding
26
+ condition. For example, choose '-o ! OrganizationTypes' to gather order
27
+ data usage by users from organization types other than the ones given in
28
+ OrganizationTypes. Refer to the example given at the end of this help
29
+ document for how to select excluding condition.
30
+
31
+ String condition options, -c, -e, -f, -g, -M, -o, -S, -t and -v, allow wildcard
32
+ inputs. '%' matches any number of characters and '_' matches any one
33
+ character. Refer to the example given at the end of this help document
34
+ for how to use wildcard for string condition options.
35
+
36
+ Output of this application is defaulted to page format with a page
37
+ header on each page. A page header includes main title, sub titles and
38
+ column titles according to which column names and options are selected,
39
+ as well as page number and report date. If the output is used directly
40
+ for input of other applications, add option -w to remove page header
41
+ and show only the column titles and the usage information.
42
+
43
+
44
+ Column Options:
45
+ - Option -C, the ColumnNames must be present to run this application.
46
+ The flag -C can be omitted if it is the first parameter option on
47
+ the command line. The ColumnNames is a string that includes column
48
+ names listed below:
49
+
50
+ COLUMN - COLUMN - COLUMN
51
+ NAME - TITLE - DESCRIPTION
52
+ GroupColumns:
53
+ D*- DATE - format as YYYY-MM-DD, for example 2004-04-25
54
+ E*- EMAIL - user email address
55
+ F*- FORMAT - dataset default data format
56
+ G*- GROUP - data usage source group: W - Web log, G - Globus,
57
+ T - Thredds, O - Order, and A - AWS log
58
+ M*- MONTH - format as YYYY-MM, for example 2004-04
59
+ N*- COUNTRY - country codes users from
60
+ O*- ORGTYPE - organization types (DSS, NCAR, UNIV and OTHER)
61
+ P*- DSOWNER - login names of specialists who own the datasets
62
+ Q*- QUARTER - quarter of year, 1, 2, 3, or 4
63
+ R*- DSTITLE - dataset titles
64
+ S - BSIZE - size of data read each time, default to Bytes
65
+ T*- DATASET - format as dsnnn.n, for example d540001
66
+ V*- IPADDRESS - format as n.n.n.n (n = 0 - 999)
67
+ W*- METHOD - method of data transfer (FTP, Tape, etc.)
68
+ Y*- YEAR - format as YYYY, for example 2004
69
+
70
+ * - field names can processed with zero usages
71
+ SummaryColumns:
72
+ A - DSCOUNT - number of datasets in given GroupColumns
73
+ B - MBREAD - data sizes, default MB, read by given
74
+ GroupColumns
75
+ C - #USER - number of unique users in in given GroupColumns
76
+ H - #READ - number of reads by given GroupColumns
77
+ U - #UNIQIP - number of unique IP addresses in in given GroupColumns
78
+
79
+ IndexColumn:
80
+ X - INDEX - index of line, it should be the first column
81
+
82
+ The column names are used to build up string of ColumnNames, while
83
+ their associated column titles are shown in view/report output of
84
+ this application. The display order of the column titles is
85
+ determined by the order of the column names in the ColumnNames
86
+ string. At least one of the group and summary columns must be
87
+ selected, in the ColumnNames string, to generate all usage
88
+ view/report;
89
+
90
+ For example, choose '-C EMB' to display column titles of EMAIL,
91
+ MONTH and MBREAD, in the first, second and third columns
92
+ respectively, for numbers of MBytes of data read by each user
93
+ in each month;
94
+
95
+ - Option -O, sort data usage information in ascending or descending
96
+ order based on the column names specified in OrderColumnNames
97
+ string. These column names must be in the selected [-C]
98
+ ColumnNames string. If an column name is in upper case, its
99
+ associated column is sorted in ascending order, and a lower
100
+ case means sorting in descending order;
101
+
102
+
103
+ Condition Options:
104
+ - Option -a, for all usage in table 'allusage';
105
+
106
+ - Option -A, gives a row limit for querying;
107
+
108
+ - Option -c, for data read by users from given country codes;
109
+
110
+ - Option -d, for data read on given dates, in format YYYY-MM-DD;
111
+
112
+ - Option -D, for data read between two given dates, each date
113
+ is in format YYYY-MM-DD. Omit EndDate for no upper limit;
114
+
115
+ - Option -e, for data read by users with given email addresses;
116
+
117
+ - Option -E, for data read by users who have been notified
118
+ data update of a specified dataset between two given dates,
119
+ each date is in format YYYY-MM-DD. Omit EndNoticeDate for
120
+ no upper limit;
121
+
122
+ - Option -f, for data in datasets with specified data format;
123
+
124
+ - Option -g, for data usage source groups, W - Web log, G - Globus,
125
+ T - Thredds, O - Order, and A - AWS log;
126
+
127
+ - Option -h, works with Option -e to include historical user emails
128
+ registered before;
129
+
130
+ - Option -m, for data read in given months, in format YYYY-MM;
131
+
132
+ - Option -M, for data read via given medium methods;
133
+
134
+ - Option -N, for files for numbers of read by each group between
135
+ MinNumberRead and MaxNumberRead. Omit MaxNumberRead for no
136
+ upper limit;
137
+
138
+ - Option -o, for data read by users from given orgnization types.
139
+ It defaults to -o ! DSS to exclude usage from DSS specialists.
140
+ Set it to ALL to include all orgnization types;
141
+
142
+ - Option -q, for data read in given quarters;
143
+
144
+ - Option -s, for data sizes, unit of MByte, between MinSize and MaxSize.
145
+ Omit MaxSize for no upper limit;
146
+
147
+ - Option -S, for login names of specialsts who own the datasets;
148
+
149
+ - Option -t, for data associating to given dataset names;
150
+
151
+ - Option -T, for data associating to datasets between
152
+ MinDataset and MaxDataset. Omit MaxDataset for no upper limit.
153
+ For example, -T d540000 d550009, for datasets numbers d540000-d550009;
154
+
155
+ - Option -v, array of specified IP addresses;
156
+
157
+ - Option -V, IP address range;
158
+
159
+ - Option -y, for data read in given years in format YYYY;
160
+
161
+
162
+ Miscellaneous Options:
163
+ - Option -w, view all data usage in simple format without totals;
164
+
165
+ - Option -z, include datasets without without usage
166
+
167
+ - Option -H, use given report title to replace the default one;
168
+
169
+ - Option -L, use given delimiter for output, instead of defaulted spaces;
170
+
171
+ - Option -U, show data sizes in given unit SizeUnit [BKMG].
172
+ B - Byte, K - KiloBytes, M - MegaByte, and G - GigaByte;
173
+
174
+ - Option > OutputFilename, redirect output into an output file,
175
+ for example, ordusage.out, instead of viewing on screen directly;
176
+
177
+ - Option | lp -d PrinterName, redirect output to printer of PrinterName.
178
+ Replace PrinterName with lj100 to print through DSS LaserJet printer.
179
+
180
+
181
+ For example:
182
+ To view annual data usage in year 2005 with columns, INDEX(X),
183
+ EMAIL(E), ORGTYPE(O), #READ(H), and MBREAD(B); ordered by ORGTYPE as
184
+ ascending and MBREAD(B) as descending; the command line should be:
185
+
186
+ viewallusage XEOHB -y 2005 -O Ob
187
+
188
+ For usage by users in all grganization types, out of the file usage
189
+ gathered above, the command line should be:
190
+
191
+ viewallusage XEOHB -y 2005 -o ALL -O Ob
192
+
193
+ To redirect the previous output to a file named ordusage.out:
194
+
195
+ viewallusage XEOHB -y 2005 -o ALL -O Ob > ordusage.out
196
+
197
+ Then you can view the file or print it as a report.
198
+