rda-python-metrics 3.0.2__tar.gz → 3.0.4__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.
Files changed (94) hide show
  1. {rda_python_metrics-3.0.2/src/rda_python_metrics.egg-info → rda_python_metrics-3.0.4}/PKG-INFO +1 -1
  2. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/pyproject.toml +1 -1
  3. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_oneorder.py +1 -1
  4. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillawsusage.usg +1 -1
  5. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillcodusage.py +1 -1
  6. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/filloneorder.py +1 -1
  7. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/filluser.py +3 -4
  8. rda_python_metrics-3.0.4/src/rda_python_metrics/fillzenodousage.usg +32 -0
  9. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/log_arch.py +23 -6
  10. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/logarch.py +24 -7
  11. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/logarch.usg +5 -1
  12. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/pgperson.py +7 -9
  13. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/pgusername.py +8 -9
  14. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_allusage.py +1 -1
  15. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_awsusage.py +1 -1
  16. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_checkusage.py +3 -3
  17. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_codusage.py +1 -1
  18. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_ordusage.py +1 -1
  19. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_osdfusage.py +2 -2
  20. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_rqstusage.py +1 -1
  21. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_tdsusage.py +1 -1
  22. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_webfile.py +8 -8
  23. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/view_webusage.py +1 -1
  24. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewallusage.py +1 -1
  25. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewawsusage.py +1 -1
  26. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewcheckusage.py +3 -3
  27. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewcodusage.py +1 -1
  28. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewordusage.py +1 -1
  29. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewosdfusage.py +2 -2
  30. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewrqstusage.py +1 -1
  31. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewtdsusage.py +1 -1
  32. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewwebfile.py +8 -8
  33. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewwebfile.usg +18 -19
  34. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewwebusage.py +1 -1
  35. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4/src/rda_python_metrics.egg-info}/PKG-INFO +1 -1
  36. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics.egg-info/SOURCES.txt +1 -0
  37. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/LICENSE +0 -0
  38. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/MANIFEST.in +0 -0
  39. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/README.md +0 -0
  40. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/setup.cfg +0 -0
  41. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/PgIPInfo.py +0 -0
  42. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/PgView.py +0 -0
  43. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/__init__.py +0 -0
  44. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_awsusage.py +0 -0
  45. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_cdgusage.py +0 -0
  46. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_codusage.py +0 -0
  47. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_country.py +0 -0
  48. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_endtime.py +0 -0
  49. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_globususage.py +0 -0
  50. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_ipinfo.py +0 -0
  51. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_osdfusage.py +0 -0
  52. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_rdadb.py +0 -0
  53. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_tdsusage.py +0 -0
  54. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fill_user.py +0 -0
  55. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillawsusage.py +0 -0
  56. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillcdgusage.py +0 -0
  57. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillcdgusage.usg +0 -0
  58. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillcodusage.usg +0 -0
  59. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillcountry.py +0 -0
  60. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillendtime.py +0 -0
  61. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillgdexusage.py +0 -0
  62. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillgdexusage.usg +0 -0
  63. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillglobususage.py +0 -0
  64. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillglobususage.usg +0 -0
  65. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillipinfo.py +0 -0
  66. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillipinfo.usg +0 -0
  67. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/filloneorder.usg +0 -0
  68. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillosdfusage.py +0 -0
  69. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillosdfusage.usg +0 -0
  70. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillrdadb.py +0 -0
  71. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillrdadb.usg +0 -0
  72. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/filltdsusage.py +0 -0
  73. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/filltdsusage.usg +0 -0
  74. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/filluser.usg +0 -0
  75. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/fillzenodousage.py +0 -0
  76. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/pg_ipinfo.py +0 -0
  77. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/pg_person.py +0 -0
  78. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/pg_username.py +0 -0
  79. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/pg_view.py +0 -0
  80. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/pgsyspath.py +0 -0
  81. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewallusage.usg +0 -0
  82. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewawsusage.usg +0 -0
  83. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewcheckusage.usg +0 -0
  84. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewcodusage.usg +0 -0
  85. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewordusage.usg +0 -0
  86. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewosdfusage.usg +0 -0
  87. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewrqstusage.usg +0 -0
  88. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewtdsusage.usg +0 -0
  89. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics/viewwebusage.usg +0 -0
  90. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics.egg-info/dependency_links.txt +0 -0
  91. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics.egg-info/entry_points.txt +0 -0
  92. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics.egg-info/requires.txt +0 -0
  93. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/src/rda_python_metrics.egg-info/top_level.txt +0 -0
  94. {rda_python_metrics-3.0.2 → rda_python_metrics-3.0.4}/tests/test_metrics.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_metrics
3
- Version: 3.0.2
3
+ Version: 3.0.4
4
4
  Summary: RDA Python Package to gather and view data usage metrics
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-metrics
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "rda_python_metrics"
9
- version = "3.0.2"
9
+ version = "3.0.4"
10
10
  authors = [
11
11
  { name="Zaihua Ji", email="zji@ucar.edu" },
12
12
  ]
@@ -143,7 +143,7 @@ def check_inputs(params):
143
143
  #
144
144
  def check_specialist(dsid, specialist):
145
145
 
146
- if specialist and PgDBI.pgget("dssgrp", "", "logname = 'specialist'", PgLOG.LGEREX): return specialist
146
+ if specialist and PgDBI.pgget("dssgrp", "", "logname = '{}'".format(specialist), PgLOG.LGEREX): return specialist
147
147
  scond = "specialist = logname AND dsid = '{}' AND priority = 1".format(dsid)
148
148
  pgrec = PgDBI.pgget("dsowner, dssgrp", "specialist", scond, PgLOG.LGEREX)
149
149
  return pgrec['specialist'] if pgrec else "datahelp"
@@ -1,7 +1,7 @@
1
1
 
2
2
  fillawsusage - Fill table 'awsusage' from AWS Server log files.
3
3
 
4
- Reads AWS access logs from /gpfs/fs1/collections/rda/transer/AWSera5log/
4
+ Reads AWS access logs from /gpfs/fs1/collections/rda/transfer/AWSera5log/
5
5
  and inserts usage records into the 'awsusage' table in PostgreSQL
6
6
  database 'rdadb'.
7
7
 
@@ -39,7 +39,7 @@ class FillCODUsage(PgIPInfo):
39
39
  self.params = [] # array of input values
40
40
 
41
41
  def read_parameters(self):
42
- """Function to readparameters."""
42
+ """Function to read parameters."""
43
43
  argv = sys.argv[1:]
44
44
  for arg in argv:
45
45
  if arg == "-b":
@@ -124,7 +124,7 @@ class FillONEOrder(PgUtil):
124
124
 
125
125
  def check_specialist(self, dsid, specialist):
126
126
  """Return the dataset owner if specialist not given."""
127
- if specialist and self.pgget("dssgrp", "", "logname = 'specialist'", self.LGEREX): return specialist
127
+ if specialist and self.pgget("dssgrp", "", "logname = '{}'".format(specialist), self.LGEREX): return specialist
128
128
  scond = "specialist = logname AND dsid = '{}' AND priority = 1".format(dsid)
129
129
  pgrec = self.pgget("dsowner, dssgrp", "specialist", scond, self.LGEREX)
130
130
  return pgrec['specialist'] if pgrec else "datahelp"
@@ -11,11 +11,10 @@
11
11
  ###############################################################################
12
12
  import sys
13
13
  import re
14
- import time
15
- from os import path as op
16
14
  from rda_python_common.pg_util import PgUtil
15
+ from rda_python_common.pg_dbi import PgDBI
17
16
 
18
- class FillUser(PgUtil):
17
+ class FillUser(PgUtil, PgDBI):
19
18
 
20
19
  """Retrieve user info from the UCAR People API and fill table user in PostgreSQL database rdadb."""
21
20
 
@@ -131,7 +130,7 @@ class FillUser(PgUtil):
131
130
  if neworg: return 0
132
131
  newrec['org_name'] = orarec['org_name']
133
132
  if orarec['country'] and (not pgrec['country'] or orarec['country'] and pgrec['country'] != orarec['country']):
134
- orarec['country'] = self.set_country_code(orarec)
133
+ orarec['country'] = self.set_country_code(orarec['email'], orarec['country'])
135
134
  if not pgrec['country'] or pgrec['country'] != orarec['country']:
136
135
  if neworg: return 0
137
136
  newrec['country'] = orarec['country']
@@ -0,0 +1,32 @@
1
+
2
+ fillzenodousage - Fill table 'gdexzenodo' from Zenodo metrics.
3
+
4
+ Retrieves Zenodo usage info for GDEX-published datasets and inserts
5
+ records into the 'gdexzenodo' table in PostgreSQL database 'rdadb'.
6
+
7
+ USAGE:
8
+ fillzenodousage [-b] -s DatasetShortNames
9
+ (-m MonthList | -N NumberDays | -y YearList)
10
+
11
+ OPTIONS:
12
+
13
+ -s DatasetShortNames (required)
14
+ Gather usage info for the given dataset short names.
15
+
16
+ One of the following time-range options is required:
17
+
18
+ -m MonthList
19
+ Gather usage info for the given months.
20
+ Month format: YYYY-MM (e.g. 2024-01).
21
+
22
+ -N NumberDays
23
+ Gather usage info for the most recent NumberDays days.
24
+
25
+ -y YearList
26
+ Gather usage info for the given years.
27
+ Year format: YYYY (e.g. 2024).
28
+
29
+ -b Run in background mode (log to file only, no terminal output).
30
+
31
+ EXAMPLE:
32
+ fillzenodousage -s ds083.2 -y 2024
@@ -23,7 +23,7 @@ from rda_python_common import PgFile
23
23
  from rda_python_common import PgSIG
24
24
 
25
25
  # the defined options for archiving different logs
26
- WLOG = 0x21 # archive web log
26
+ WLOG = 0x01 # archive web log
27
27
  TLOG = 0x02 # archive tds log
28
28
  DLOG = 0x04 # archive dssdb logs
29
29
  SLOG = 0x08 # append dssdb sub batch logs
@@ -33,8 +33,8 @@ OLOG = 0x20 # archive OSDF web log
33
33
  LOGS = {
34
34
  'OPTION' : 0,
35
35
  'AWSLOG' : PgLOG.PGLOG["TRANSFER"] + "/AWSera5log",
36
- 'WEBLOG' : PgLOG.PGLOG["DSSDATA"] + "/work/logs/gridftp",
37
- 'OSDFLOG' : PgLOG.PGLOG["DSSDATA"] + "/zji/osdflogs",
36
+ 'WEBLOG' : PgLOG.PGLOG["GDEXWORK"] + "/logs/gridftp",
37
+ 'OSDFLOG' : PgLOG.PGLOG["GDEXWORK"] + "/zji/osdflogs",
38
38
  'MGTLOG' : "/data/logs",
39
39
  'TDSLOG' : "/data/logs/nginx",
40
40
  'RDALOG' : PgLOG.PGLOG['LOGPATH'],
@@ -60,10 +60,10 @@ def main():
60
60
 
61
61
  option = None
62
62
  for arg in argv:
63
- ms = re.match(r'^-([abdmnpstw])', arg)
63
+ ms = re.match(r'^-([abcdmnopstw])', arg)
64
64
  if ms:
65
65
  option = ms.group(1)
66
- if option in 'mp': continue
66
+ if option in 'cmp': continue
67
67
  if option == "b":
68
68
  PgLOG.PGLOG['BCKGRND'] = 1
69
69
  elif option == "d":
@@ -81,6 +81,8 @@ def main():
81
81
  elif option == "n":
82
82
  LOGS['CHKLOG'] = 0
83
83
  option = None
84
+ elif option == 'c':
85
+ PgLOG.add_carbon_copy(arg, 1)
84
86
  elif option == 'm':
85
87
  smonth = arg
86
88
  elif option == 'p':
@@ -125,6 +127,9 @@ def archive_web_log(smonth):
125
127
  if op.exists(afile): PgFile.delete_local_file(afile)
126
128
 
127
129
  logfiles = sorted(glob.glob("{}/access_log_gridftp??_{}??{}".format(logpath, mn, yr)))
130
+ if not logfiles:
131
+ PgLOG.pglog("{}: NO globus web log file found for {}-{} to archive".format(logpath, yr, mn), PgLOG.LGWNEM)
132
+ return
128
133
  topt = '-cvf'
129
134
  tcnt = 0
130
135
  for logfile in logfiles:
@@ -164,6 +169,9 @@ def archive_osdf_log(smonth):
164
169
  if op.exists(afile): PgFile.delete_local_file(afile)
165
170
 
166
171
  logfiles = sorted(glob.glob("{}/{}-{}-??.log".format(logpath, yr, mn)))
172
+ if not logfiles:
173
+ PgLOG.pglog("{}: NO OSDF web log file found for {}-{} to archive".format(logpath, yr, mn), PgLOG.LGWNEM)
174
+ return
167
175
  topt = '-cvf'
168
176
  tcnt = 0
169
177
  for logfile in logfiles:
@@ -177,7 +185,7 @@ def archive_osdf_log(smonth):
177
185
  afile += '.gz'
178
186
  PgFile.move_local_file(dfile, afile, PgLOG.LGWNEM)
179
187
  s = 's' if tcnt > 1 else ''
180
- PgLOG.pglog("{}: {} globus log{} tarred, gzipped and archived at {}".format(afile, tcnt, s, PgLOG.current_datetime()), PgLOG.LGWNEM)
188
+ PgLOG.pglog("{}: {} OSDF log{} tarred, gzipped and archived at {}".format(afile, tcnt, s, PgLOG.current_datetime()), PgLOG.LGWNEM)
181
189
 
182
190
  #
183
191
  # Archive AWS web log files to LOGS['DECSLOGS']
@@ -196,6 +204,9 @@ def archive_aws_log(smonth):
196
204
  if op.exists(afile): PgFile.delete_local_file(afile)
197
205
 
198
206
  lfile = "{}/{}".format(yr, mn)
207
+ if not op.exists("{}/{}".format(logpath, lfile)):
208
+ PgLOG.pglog("{}/{}: NO AWS web log directory found to archive".format(logpath, lfile), PgLOG.LGWNEM)
209
+ return
199
210
  tcmd = "tar -cvf {} -C {} {}".format(afile, logpath, lfile)
200
211
  PgLOG.pgsystem(tcmd, PgLOG.LGWNEM, 5)
201
212
 
@@ -221,6 +232,9 @@ def archive_tds_log(smonth):
221
232
  if op.exists(afile): PgFile.delete_local_file(afile)
222
233
 
223
234
  logfiles = sorted(glob.glob("{}/{}-{}-??.access.log".format(logpath, yr, mn)))
235
+ if not logfiles:
236
+ PgLOG.pglog("{}: NO thredds log file found for {}-{} to archive".format(logpath, yr, mn), PgLOG.LGWNEM)
237
+ return
224
238
  topt = '-cvf'
225
239
  tcnt = 0
226
240
  for logfile in logfiles:
@@ -257,6 +271,9 @@ def archive_dssdb_log():
257
271
 
258
272
  # collect all the large log/err files
259
273
  files = sorted(glob.glob("*.log") + glob.glob("*.err"))
274
+ if not files:
275
+ PgLOG.pglog("{}: NO dssdb log file found to archive".format(LOGS['RDALOG']), PgLOG.LGWNEM)
276
+ return
260
277
  for file in files:
261
278
  info = PgFile.check_local_file(file, 2)
262
279
  if(not info or info['data_size'] < 10000): continue # skip log files small than 10KB
@@ -21,7 +21,7 @@ class LogArch(PgFile):
21
21
  def __init__(self):
22
22
  super().__init__()
23
23
  # the defined options for archiving different logs
24
- self.WLOG = 0x21 # archive web log
24
+ self.WLOG = 0x01 # archive web log
25
25
  self.TLOG = 0x02 # archive tds log
26
26
  self.DLOG = 0x04 # archive dssdb logs
27
27
  self.SLOG = 0x08 # append dssdb sub batch logs
@@ -30,8 +30,8 @@ class LogArch(PgFile):
30
30
  self.LOGS = {
31
31
  'OPTION' : 0,
32
32
  'AWSLOG' : self.PGLOG["TRANSFER"] + "/AWSera5log",
33
- 'WEBLOG' : self.PGLOG["DSSDATA"] + "/work/logs/gridftp",
34
- 'OSDFLOG' : self.PGLOG["DSSDATA"] + "/zji/osdflogs",
33
+ 'WEBLOG' : self.PGLOG["GDEXWORK"] + "/logs/gridftp",
34
+ 'OSDFLOG' : self.PGLOG["GDEXWORK"] + "/zji/osdflogs",
35
35
  'MGTLOG' : "/data/logs",
36
36
  'TDSLOG' : "/data/logs/nginx",
37
37
  'RDALOG' : self.PGLOG['LOGPATH'],
@@ -51,10 +51,10 @@ class LogArch(PgFile):
51
51
  self.set_suid(self.PGLOG['EUID'])
52
52
  option = None
53
53
  for arg in argv:
54
- ms = re.match(r'^-([abdmnpstw])', arg)
54
+ ms = re.match(r'^-([abcdmnopstw])', arg)
55
55
  if ms:
56
56
  option = ms.group(1)
57
- if option in 'mp': continue
57
+ if option in 'cmp': continue
58
58
  if option == "b":
59
59
  self.PGLOG['BCKGRND'] = 1
60
60
  elif option == "d":
@@ -72,6 +72,8 @@ class LogArch(PgFile):
72
72
  elif option == "n":
73
73
  self.LOGS['CHKLOG'] = 0
74
74
  option = None
75
+ elif option == 'c':
76
+ self.add_carbon_copy(arg, 1)
75
77
  elif option == 'm':
76
78
  self.smonth = arg
77
79
  elif option == 'p':
@@ -110,6 +112,9 @@ class LogArch(PgFile):
110
112
  return
111
113
  if op.exists(afile): self.delete_local_file(afile)
112
114
  logfiles = sorted(glob.glob("{}/access_log_gridftp??_{}??{}".format(logpath, mn, yr)))
115
+ if not logfiles:
116
+ self.pglog("{}: NO globus web log file found for {}-{} to archive".format(logpath, yr, mn), self.LGWNEM)
117
+ return
113
118
  topt = '-cvf'
114
119
  tcnt = 0
115
120
  for logfile in logfiles:
@@ -122,7 +127,7 @@ class LogArch(PgFile):
122
127
  lfile = op.basename(logfile)
123
128
  tcmd = "tar {} {} -C {} {}".format(topt, afile, logpath, lfile)
124
129
  tcnt += self.pgsystem(tcmd, self.LGWNEM, 5)
125
- topt = '-uvf'
130
+ topt = '-uvf'
126
131
  if tcnt > 0:
127
132
  self.pgsystem("gzip " + afile, self.LGWNEM, 5)
128
133
  afile += '.gz'
@@ -142,6 +147,9 @@ class LogArch(PgFile):
142
147
  return
143
148
  if op.exists(afile): self.delete_local_file(afile)
144
149
  logfiles = sorted(glob.glob("{}/{}-{}-??.log".format(logpath, yr, mn)))
150
+ if not logfiles:
151
+ self.pglog("{}: NO OSDF web log file found for {}-{} to archive".format(logpath, yr, mn), self.LGWNEM)
152
+ return
145
153
  topt = '-cvf'
146
154
  tcnt = 0
147
155
  for logfile in logfiles:
@@ -154,7 +162,7 @@ class LogArch(PgFile):
154
162
  afile += '.gz'
155
163
  self.move_local_file(dfile, afile, self.LGWNEM)
156
164
  s = 's' if tcnt > 1 else ''
157
- self.pglog("{}: {} globus log{} tarred, gzipped and archived at {}".format(afile, tcnt, s, self.current_datetime()), self.LGWNEM)
165
+ self.pglog("{}: {} OSDF log{} tarred, gzipped and archived at {}".format(afile, tcnt, s, self.current_datetime()), self.LGWNEM)
158
166
 
159
167
  # Archive AWS web log files to self.LOGS['DECSLOGS']
160
168
  def archive_aws_log(self):
@@ -168,6 +176,9 @@ class LogArch(PgFile):
168
176
  return
169
177
  if op.exists(afile): self.delete_local_file(afile)
170
178
  lfile = "{}/{}".format(yr, mn)
179
+ if not op.exists("{}/{}".format(logpath, lfile)):
180
+ self.pglog("{}/{}: NO AWS web log directory found to archive".format(logpath, lfile), self.LGWNEM)
181
+ return
171
182
  tcmd = "tar -cvf {} -C {} {}".format(afile, logpath, lfile)
172
183
  self.pgsystem(tcmd, self.LGWNEM, 5)
173
184
  self.pgsystem("gzip " + afile, self.LGWNEM, 5)
@@ -187,6 +198,9 @@ class LogArch(PgFile):
187
198
  return
188
199
  if op.exists(afile): self.delete_local_file(afile)
189
200
  logfiles = sorted(glob.glob("{}/{}-{}-??.access.log".format(logpath, yr, mn)))
201
+ if not logfiles:
202
+ self.pglog("{}: NO thredds log file found for {}-{} to archive".format(logpath, yr, mn), self.LGWNEM)
203
+ return
190
204
  topt = '-cvf'
191
205
  tcnt = 0
192
206
  for logfile in logfiles:
@@ -217,6 +231,9 @@ class LogArch(PgFile):
217
231
  self.change_local_directory(self.LOGS['RDALOG'], self.LWEMEX)
218
232
  # collect all the large log/err files
219
233
  files = sorted(glob.glob("*.log") + glob.glob("*.err"))
234
+ if not files:
235
+ self.pglog("{}: NO dssdb log file found to archive".format(self.LOGS['RDALOG']), self.LGWNEM)
236
+ return
220
237
  for file in files:
221
238
  info = self.check_local_file(file, 2)
222
239
  if(not info or info['data_size'] < 10000): continue # skip log files small than 10KB
@@ -5,7 +5,7 @@
5
5
  detected and skipped (unless -n is given).
6
6
 
7
7
  USAGE:
8
- logarch [-b] [-n] [-s] [-p LogPath] [-m YearMonth]
8
+ logarch [-b] [-n] [-s] [-c CcAddress] [-p LogPath] [-m YearMonth]
9
9
  (-a | -d | -o | -t | -w) [more archive-type flags]
10
10
 
11
11
  ARCHIVE TYPES (at least one required):
@@ -21,6 +21,10 @@
21
21
  -m YearMonth
22
22
  Archive logs for the given YYYY-MM (e.g. 2024-01) only.
23
23
 
24
+ -c CcAddress
25
+ Carbon-copy the email notice to one or more additional specialists
26
+ (comma/space-separated). May be given more than once.
27
+
24
28
  -p LogPath
25
29
  Use LogPath instead of the default log directory.
26
30
 
@@ -53,15 +53,13 @@ class PgPerson:
53
53
  url = self.urlfmt.format(self.option, self.optval)
54
54
  response, content = http.request(url, 'GET', headers=headers)
55
55
  status = response.status
56
- if status == 200:
57
- persons=json.loads(content)
58
- for person in persons:
59
- for key, value in person.items():
60
- print("{}<=>{}".format(key, value))
61
- elif status == 399:
62
- print(content)
63
- elif status == 500:
64
- print('Server error')
56
+ if status != 200:
57
+ print("pgperson: HTTP {} from {}\n{}".format(status, url, content.decode(errors='replace')), file=sys.stderr)
58
+ sys.exit(1)
59
+ persons=json.loads(content)
60
+ for person in persons:
61
+ for key, value in person.items():
62
+ print("{}<=>{}".format(key, value))
65
63
 
66
64
  # main function to execute this script
67
65
  def main():
@@ -32,16 +32,15 @@ class PgUserName:
32
32
  def start_actions(self):
33
33
  headers = {'Content-type': 'application/json'}
34
34
  http=httplib2.Http()
35
- response, content = http.request(self.url + self.uname, 'GET', headers=headers)
35
+ url = self.url + self.uname
36
+ response, content = http.request(url, 'GET', headers=headers)
36
37
  status = response.status
37
- if status == 200:
38
- person=json.loads(content)
39
- for key, value in person.items():
40
- print("{}<=>{}".format(key, value))
41
- elif status == 399:
42
- print(content)
43
- elif status == 500:
44
- print('Server error')
38
+ if status != 200:
39
+ print("pgusername: HTTP {} from {}\n{}".format(status, url, content.decode(errors='replace')), file=sys.stderr)
40
+ sys.exit(1)
41
+ person=json.loads(content)
42
+ for key, value in person.items():
43
+ print("{}<=>{}".format(key, value))
45
44
 
46
45
  # main function to execute this script
47
46
  def main():
@@ -247,7 +247,7 @@ def check_enough_options():
247
247
  if 'z' not in params or sn in EXPAND: continue
248
248
  fld = FLDS[sn]
249
249
  if fld[6] != 'G': continue
250
- PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
250
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(pgname, sn, fld[0]), PgLOG.LGWNEX)
251
251
 
252
252
  if 'E' in params or 'I' in params:
253
253
  if 'z' in params:
@@ -224,7 +224,7 @@ def check_enough_options():
224
224
  if 'z' not in params or sn in EXPAND: continue
225
225
  fld = FLDS[sn]
226
226
  if fld[6] != 'G': continue
227
- PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
227
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(pgname, sn, fld[0]), PgLOG.LGWNEX)
228
228
 
229
229
  if 'E' in params or 'I' in params:
230
230
  if 'z' in params:
@@ -23,7 +23,7 @@ from rda_python_common import PgDBI
23
23
  from . import PgView
24
24
 
25
25
  VUSG = {
26
- 'SNMS' : "ABCDEFGHIJKLMNPQRSTUVWZ", # all available short field names in FLDS
26
+ 'SNMS' : "ABCDEFGHIJKLMNPQRSTUVWYZ", # all available short field names in FLDS
27
27
  'OPTS' : 'aABcCdDhHilLmnOqrsStTwyz', # all available options, used for params
28
28
  'NOPT' : 'abwz', # stand alone option without inputs
29
29
  'ACND' : 'cdhilLmnsSty', # available array condition options
@@ -120,7 +120,7 @@ params = {}
120
120
  # related to a field name if it is not in keys SNS
121
121
  SNS = {
122
122
  'b' : 'L', 'B' : 'L', 'c' : 'C', 'd' : 'D', 'D' : 'D', 'h' : 'H', 'i' : 'I', 'm' : 'M', 'n' : 'N',
123
- 'q' : 'Q', 'r' : 'R', 'q' : 'Q', 's' : 'W', 'S' : 'S', 't' : 'T', 'T' : 'T', 'y' : 'Y'
123
+ 'q' : 'Q', 'r' : 'R', 's' : 'W', 'S' : 'S', 't' : 'T', 'T' : 'T', 'y' : 'Y'
124
124
  }
125
125
 
126
126
  tablenames = fieldnames = condition = ''
@@ -203,7 +203,7 @@ def check_enough_options():
203
203
  for sn in flds:
204
204
  if sn == 'X': continue # do not process INDEX field
205
205
  if VUSG['SNMS'].find(sn) == -1:
206
- PgLOG.pglog("{}: Field sn must be in short field names: {}X".format(pgname, VUSG['SNMS']), PgLOG.LGWNEX)
206
+ PgLOG.pglog("{}: Field {} must be in short field names: {}X".format(pgname, sn, VUSG['SNMS']), PgLOG.LGWNEX)
207
207
 
208
208
  if 'z' not in params or sn in EXPAND: continue
209
209
  fld = FLDS[sn]
@@ -225,7 +225,7 @@ def check_enough_options():
225
225
  if 'z' not in params or sn in EXPAND: continue
226
226
  fld = FLDS[sn]
227
227
  if fld[6] != 'G': continue
228
- PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
228
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(pgname, sn, fld[0]), PgLOG.LGWNEX)
229
229
 
230
230
  if 'E' in params or 'I' in params:
231
231
  if 'z' in params:
@@ -240,7 +240,7 @@ def check_enough_options():
240
240
  if 'z' not in params or sn in EXPAND: continue
241
241
  fld = FLDS[sn]
242
242
  if fld[6] != 'G': continue
243
- PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
243
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(pgname, sn, fld[0]), PgLOG.LGWNEX)
244
244
 
245
245
  if 'E' in params:
246
246
  if 'z' in params:
@@ -86,7 +86,7 @@ EXPAND = {
86
86
  'T' : ["DSID", "StT", "dataset.dsid", "dataset"],
87
87
  'P' : ["DSID", "StT", "specialist", "dsowner"],
88
88
 
89
- 'W' : ["METHOD", "fM", "method", "osdfusage"]
89
+ 'W' : ["METHOD", "M", "method", "osdfusage"]
90
90
  }
91
91
 
92
92
  # valid options for params, a hash array of command line parameters
@@ -224,7 +224,7 @@ def check_enough_options():
224
224
  if 'z' not in params or sn in EXPAND: continue
225
225
  fld = FLDS[sn]
226
226
  if fld[6] != 'G': continue
227
- PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
227
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(pgname, sn, fld[0]), PgLOG.LGWNEX)
228
228
 
229
229
  if 'E' in params or 'I' in params:
230
230
  if 'z' in params:
@@ -248,7 +248,7 @@ def check_enough_options():
248
248
  if 'z' not in params or sn in EXPAND: continue
249
249
  fld = FLDS[sn]
250
250
  if fld[6] != 'G': continue
251
- PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
251
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(pgname, sn, fld[0]), PgLOG.LGWNEX)
252
252
 
253
253
  if 'E' in params or 'I' in params:
254
254
  if 'z' in params:
@@ -229,7 +229,7 @@ def check_enough_options():
229
229
  if 'z' not in params or sn in EXPAND: continue
230
230
  fld = FLDS[sn]
231
231
  if fld[6] != 'G': continue
232
- PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
232
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(pgname, sn, fld[0]), PgLOG.LGWNEX)
233
233
 
234
234
  if 'E' in params or 'I' in params:
235
235
  if 'z' in params:
@@ -22,15 +22,15 @@ from rda_python_common import PgDBI
22
22
  from . import PgView
23
23
 
24
24
  FILE = {
25
- 'SNMS' : "BCDEFGHIJKLMNOPQRSTUVWYZ", # all available short field names in FLDS
26
- 'OPTS' : 'AabCdDefFgGHijJlLmMnNoOprsStTuUvwyYzZ', # all available options, used for params
25
+ 'SNMS' : "ABCDEFGHIJKLMNOPQRSTUWYZ", # all available short field names in FLDS
26
+ 'OPTS' : 'AabCdDefFgGHijJlLmMNoOprsStTuUWwyYzZ', # all available options, used for params
27
27
  'NOPT' : 'abjJw', # stand alone option without inputs
28
- 'ACND' : 'defgGilmMnopStuvyYz', # available array condition options
28
+ 'ACND' : 'defgGilmMopStuWyYz', # available array condition options
29
29
  'RCND' : 'DFNrsTZ', # available range condition options
30
- 'CNDS' : 'adDefFgGilmMnNoprstTuvyYzZ', # condition options, ACND, RCND and 'a'
30
+ 'CNDS' : 'adDefFgGilmMNoprstTuWyYzZ', # condition options, ACND, RCND and 'a'
31
31
  'ECND' : 'mMyY', # condition options need evaluating
32
- 'SFLD' : 'DEFILNOPQTUVZ', # string fields, to be quoted in condition
33
- 'UFLD' : 'ILOPV', # string fields must be in upper case
32
+ 'SFLD' : 'DEFILNOPQTUWZ', # string fields, to be quoted in condition
33
+ 'UFLD' : 'ILOPW', # string fields must be in upper case
34
34
  'LFLD' : 'EQTU' # string fields must be in lower case
35
35
  }
36
36
 
@@ -91,8 +91,7 @@ FLDS = {
91
91
  # L -- column delimiter for output
92
92
  # m -- array of specified months of file last written
93
93
  # M -- array of specified months of file created
94
- # n -- array of specified user numbers
95
- # D -- dates range, datasets created between, array of 1 or 2 dates in format of YYYY-MM-DD
94
+ # N -- dataset created dates range, array of 1 or 2 dates in format of YYYY-MM-DD
96
95
  # o -- array of specified file status
97
96
  # O -- a string of short field names for sorting on
98
97
  # p -- array of web file types, Data, Document, and etc.
@@ -104,6 +103,7 @@ FLDS = {
104
103
  # u -- array of specified specialist user names
105
104
  # U -- use given unit for file or data sizes
106
105
  # w -- generate view without totals
106
+ # W -- array of specified dataset types
107
107
  # y -- array of specified years of file last written
108
108
  # Y -- array of specified years of file created
109
109
  # z -- array of specified dates when files created
@@ -270,7 +270,7 @@ def check_enough_options():
270
270
  if 'z' not in params or sn in EXPAND: continue
271
271
  fld = FLDS[sn]
272
272
  if fld[6] != 'G': continue
273
- PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
273
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(pgname, sn, fld[0]), PgLOG.LGWNEX)
274
274
 
275
275
  if 'E' in params or 'I' in params:
276
276
  if 'z' in params:
@@ -230,7 +230,7 @@ class ViewALLUsage(PgView):
230
230
  if 'z' not in self.params or sn in self.EXPAND: continue
231
231
  fld = self.FLDS[sn]
232
232
  if fld[6] != 'G': continue
233
- self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(self.pgname, sn, fld[0]), self.LGWNEX)
233
+ self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(self.pgname, sn, fld[0]), self.LGWNEX)
234
234
  if 'E' in self.params or 'I' in self.params:
235
235
  if 'z' in self.params:
236
236
  self.pglog(self.pgname + ": option -z and -E/-I can not be present at the same time", self.LGWNEX)
@@ -202,7 +202,7 @@ class ViewAWSUsage(PgView):
202
202
  if 'z' not in self.params or sn in self.EXPAND: continue
203
203
  fld = self.FLDS[sn]
204
204
  if fld[6] != 'G': continue
205
- self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(self.pgname, sn, fld[0]), self.LGWNEX)
205
+ self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(self.pgname, sn, fld[0]), self.LGWNEX)
206
206
  if 'E' in self.params or 'I' in self.params:
207
207
  if 'z' in self.params:
208
208
  self.pglog(self.pgname + ": option -z and -E/-I can not be present at the same time", self.LGWNEX)
@@ -22,7 +22,7 @@ class ViewCheckUsage(PgView):
22
22
  def __init__(self):
23
23
  super().__init__()
24
24
  self.VUSG = {
25
- 'SNMS' : "ABCDEFGHIJKLMNPQRSTUVWZ", # all available short field names in FLDS
25
+ 'SNMS' : "ABCDEFGHIJKLMNPQRSTUVWYZ", # all available short field names in FLDS
26
26
  'OPTS' : 'aABcCdDhHilLmnOqrsStTwyz', # all available options, used for params
27
27
  'NOPT' : 'abwz', # stand alone option without inputs
28
28
  'ACND' : 'cdhilLmnsSty', # available array condition options
@@ -115,7 +115,7 @@ class ViewCheckUsage(PgView):
115
115
  # related to a field name if it is not in keys SNS
116
116
  self.SNS = {
117
117
  'b' : 'L', 'B' : 'L', 'c' : 'C', 'd' : 'D', 'D' : 'D', 'h' : 'H', 'i' : 'I', 'm' : 'M', 'n' : 'N',
118
- 'q' : 'Q', 'r' : 'R', 'q' : 'Q', 's' : 'W', 'S' : 'S', 't' : 'T', 'T' : 'T', 'y' : 'Y'
118
+ 'q' : 'Q', 'r' : 'R', 's' : 'W', 'S' : 'S', 't' : 'T', 'T' : 'T', 'y' : 'Y'
119
119
  }
120
120
  self.tablenames = self.fieldnames = self.condition = ''
121
121
  self.sfields = []
@@ -187,7 +187,7 @@ class ViewCheckUsage(PgView):
187
187
  for sn in flds:
188
188
  if sn == 'X': continue # do not process INDEX field
189
189
  if self.VUSG['SNMS'].find(sn) == -1:
190
- self.pglog("{}: Field sn must be in short field names: {}X".format(self.pgname, self.VUSG['SNMS']), self.LGWNEX)
190
+ self.pglog("{}: Field {} must be in short field names: {}X".format(self.pgname, sn, self.VUSG['SNMS']), self.LGWNEX)
191
191
  if 'z' not in self.params or sn in self.EXPAND: continue
192
192
  fld = self.FLDS[sn]
193
193
  if fld[6] != 'G': continue
@@ -204,7 +204,7 @@ class ViewCODUsage(PgView):
204
204
  if 'z' not in self.params or sn in self.EXPAND: continue
205
205
  fld = self.FLDS[sn]
206
206
  if fld[6] != 'G': continue
207
- self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(self.pgname, sn, fld[0]), self.LGWNEX)
207
+ self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(self.pgname, sn, fld[0]), self.LGWNEX)
208
208
  if 'E' in self.params or 'I' in self.params:
209
209
  if 'z' in self.params:
210
210
  self.pglog(self.pgname + ": option -z and -E/-I can not be present at the same time", self.LGWNEX)
@@ -217,7 +217,7 @@ class ViewORDUsage(PgView):
217
217
  if 'z' not in self.params or sn in self.EXPAND: continue
218
218
  fld = self.FLDS[sn]
219
219
  if fld[6] != 'G': continue
220
- self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(self.pgname, sn, fld[0]), self.LGWNEX)
220
+ self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(self.pgname, sn, fld[0]), self.LGWNEX)
221
221
  if 'E' in self.params:
222
222
  if 'z' in self.params:
223
223
  self.pglog(self.pgname + ": option -z and -E can not be present at the same time", self.LGWNEX)
@@ -80,7 +80,7 @@ class ViewOSDFUsage(PgView):
80
80
  'R' : ["DSID", "StT", "search.datasets.title", "search.datasets"],
81
81
  'T' : ["DSID", "StT", "dataset.dsid", "dataset"],
82
82
  'P' : ["DSID", "StT", "specialist", "dsowner"],
83
- 'W' : ["METHOD", "fM", "method", "osdfusage"]
83
+ 'W' : ["METHOD", "M", "method", "osdfusage"]
84
84
  }
85
85
  # valid options for params, a hash array of command line parameters
86
86
  # a -- 1 to view all usage info available
@@ -202,7 +202,7 @@ class ViewOSDFUsage(PgView):
202
202
  if 'z' not in self.params or sn in self.EXPAND: continue
203
203
  fld = self.FLDS[sn]
204
204
  if fld[6] != 'G': continue
205
- self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(self.pgname, sn, fld[0]), self.LGWNEX)
205
+ self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(self.pgname, sn, fld[0]), self.LGWNEX)
206
206
  if 'E' in self.params or 'I' in self.params:
207
207
  if 'z' in self.params:
208
208
  self.pglog(self.pgname + ": option -z and -E/-I can not be present at the same time", self.LGWNEX)
@@ -224,7 +224,7 @@ class ViewRQSTUsage(PgView):
224
224
  if 'z' not in self.params or sn in self.EXPAND: continue
225
225
  fld = self.FLDS[sn]
226
226
  if fld[6] != 'G': continue
227
- self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(self.pgname, sn, fld[0]), self.LGWNEX)
227
+ self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(self.pgname, sn, fld[0]), self.LGWNEX)
228
228
  if 'E' in self.params or 'I' in self.params:
229
229
  if 'z' in self.params:
230
230
  self.pglog(self.pgname + ": option -z and -E/-I can not be present at the same time", self.LGWNEX)
@@ -207,7 +207,7 @@ class ViewTDSUsage(PgView):
207
207
  if 'z' not in self.params or sn in self.EXPAND: continue
208
208
  fld = self.FLDS[sn]
209
209
  if fld[6] != 'G': continue
210
- self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(self.pgname, sn, fld[0]), self.LGWNEX)
210
+ self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(self.pgname, sn, fld[0]), self.LGWNEX)
211
211
  if 'E' in self.params or 'I' in self.params:
212
212
  if 'z' in self.params:
213
213
  self.pglog(self.pgname + ": option -z and -E/-I can not be present at the same time", self.LGWNEX)
@@ -21,15 +21,15 @@ class ViewWEBFile(PgView):
21
21
  def __init__(self):
22
22
  super().__init__()
23
23
  self.FILE = {
24
- 'SNMS' : "BCDEFGHIJKLMNOPQRSTUVWYZ", # all available short field names in FLDS
25
- 'OPTS' : 'AabCdDefFgGHijJlLmMnNoOprsStTuUvwyYzZ', # all available options, used for params
24
+ 'SNMS' : "ABCDEFGHIJKLMNOPQRSTUWYZ", # all available short field names in FLDS
25
+ 'OPTS' : 'AabCdDefFgGHijJlLmMNoOprsStTuUWwyYzZ', # all available options, used for params
26
26
  'NOPT' : 'abjJw', # stand alone option without inputs
27
- 'ACND' : 'defgGilmMnopStuvyYz', # available array condition options
27
+ 'ACND' : 'defgGilmMopStuWyYz', # available array condition options
28
28
  'RCND' : 'DFNrsTZ', # available range condition options
29
- 'CNDS' : 'adDefFgGilmMnNoprstTuvyYzZ', # condition options, ACND, RCND and 'a'
29
+ 'CNDS' : 'adDefFgGilmMNoprstTuWyYzZ', # condition options, ACND, RCND and 'a'
30
30
  'ECND' : 'mMyY', # condition options need evaluating
31
- 'SFLD' : 'DEFILNOPQTUVZ', # string fields, to be quoted in condition
32
- 'UFLD' : 'ILOPV', # string fields must be in upper case
31
+ 'SFLD' : 'DEFILNOPQTUWZ', # string fields, to be quoted in condition
32
+ 'UFLD' : 'ILOPW', # string fields must be in upper case
33
33
  'LFLD' : 'EQTU' # string fields must be in lower case
34
34
  }
35
35
  # keys FLDS - short field names
@@ -88,8 +88,7 @@ class ViewWEBFile(PgView):
88
88
  # L -- column delimiter for output
89
89
  # m -- array of specified months of file last written
90
90
  # M -- array of specified months of file created
91
- # n -- array of specified user numbers
92
- # D -- dates range, datasets created between, array of 1 or 2 dates in format of YYYY-MM-DD
91
+ # N -- dataset created dates range, array of 1 or 2 dates in format of YYYY-MM-DD
93
92
  # o -- array of specified file status
94
93
  # O -- a string of short field names for sorting on
95
94
  # p -- array of web file types, Data, Document, and etc.
@@ -101,6 +100,7 @@ class ViewWEBFile(PgView):
101
100
  # u -- array of specified specialist user names
102
101
  # U -- use given unit for file or data sizes
103
102
  # w -- generate view without totals
103
+ # W -- array of specified dataset types
104
104
  # y -- array of specified years of file last written
105
105
  # Y -- array of specified years of file created
106
106
  # z -- array of specified dates when files created
@@ -17,14 +17,14 @@
17
17
  The '-C' flag may be omitted if ColumnNames is the first argument.
18
18
 
19
19
  2. At least one condition option must be given:
20
- -a -d -D -e -f -F -g -G -i -l -m -M -n -o -p -r -s -t -T
21
- -u -v -W -y -Y -z -Z
20
+ -a -d -D -e -f -F -g -G -i -l -m -M -N -o -p -r -s -t -T
21
+ -u -W -y -Y -z -Z
22
22
 
23
23
  3. Negation: for any condition option except -a, prepend '!' between
24
24
  the flag and value to invert the filter, e.g. '-o ! DSS'.
25
25
 
26
26
  4. Wildcards: condition options that take strings (-e, -f, -G, -i, -l,
27
- -o, -t, -u, -v) accept SQL wildcards '%' (any chars) and '_' (one
27
+ -o, -t, -u) accept SQL wildcards '%' (any chars) and '_' (one
28
28
  char).
29
29
 
30
30
  5. By default the output is paginated with a header, footer, and
@@ -46,35 +46,36 @@
46
46
  Column letters:
47
47
 
48
48
  Group Columns:
49
- A - CYEAR - year the file was created
50
49
  D - DATEWRITE - date the file was last written
51
50
  E - EMAIL - email of file-written user
52
51
  F - FILENAME - WEB data file name
53
52
  G - PRODUCT - product (top group) information
54
53
  H - CMONTH - month the file was created
55
54
  I - FIRSTNAME - first name of file-written user
56
- K - TIMEWRITE - time the file was last written
55
+ K - CYEAR - year the file was created
57
56
  L - LASTNAME - last name of file-written user
58
57
  M - WMONTH - month the file was last written
59
- N - USERNO - account number of file-written user
58
+ N - DSCREATED - date the dataset was created
60
59
  O - STAT - file status: Public or Internal
61
60
  P - TYPE - file type: Data, Software, etc.
62
- Q - TIMECREATE - time the file was created
61
+ Q - DSOWNER - specialist who owns the dataset
63
62
  R* - DSTITLE - dataset title
64
63
  S - FILESIZE - individual file size (bytes)
65
64
  T - DATASET - dataset name
66
- U - USERNAME - login name of file-written user
67
- V - DIV. - division of file-written user
68
- W - DSTYPE - dataset type flag: P, H, I, or W
65
+ U - SPECIALIST - login name of file-written user
66
+ W - DSTYPE - dataset type flag: D, H, I, P, or W
69
67
  Y - WYEAR - year the file was last written
70
68
  Z - DATECREATE - date the file was created
71
69
 
72
70
  (*) = column may be displayed with zero usages when -z is used.
73
71
 
74
72
  Summary Columns:
75
- B - MBYTESFILES - data size (MB) by the group
76
- C - #USER - number of users in the group
77
- J - #FILE - number of files by the group
73
+ B - MBYTEDATA - data size (MB) by the group
74
+
75
+ Count Columns:
76
+ A - DSCOUNT - number of distinct file names in the group
77
+ C - #UNIQSPLST - number of distinct specialists in the group
78
+ J - #UNIQFILE - number of distinct files in the group
78
79
 
79
80
  Index Column:
80
81
  X - INDEX - 1-based row index (use as the first column)
@@ -97,7 +98,7 @@
97
98
  -l LastNameList Users with these last names.
98
99
  -m MonthList Last written in these months (YYYY-MM).
99
100
  -M MonthList Created in these months (YYYY-MM).
100
- -n UserNumberList These user account numbers.
101
+ -N StartDate [EndDate] Datasets created between two dates.
101
102
  -o FileStatus File status: P (Public) or I (Internal).
102
103
  -p TypeList File types: D (Data), I (Internal Data),
103
104
  O (Document), S (Software).
@@ -108,9 +109,7 @@
108
109
  e.g. '-T d540000 d550009'.
109
110
  -u UserNameList Last written by users with these
110
111
  login names.
111
- -v DivisionList Last written by users from these
112
- divisions.
113
- -W DatasetTypes Dataset type flag: P, H, I, or W.
112
+ -W DatasetTypes Dataset type flag: D, H, I, P, or W.
114
113
  -y YearList Last written in these years (YYYY).
115
114
  -Y YearList Created in these years (YYYY).
116
115
  -z DateList Created on these dates.
@@ -129,8 +128,8 @@
129
128
 
130
129
  EXAMPLES:
131
130
 
132
- View files last written in 2004 with columns INDEX, USERNAME, STAT,
133
- #FILE, MBYTESFILES; sort by STAT ascending and MBYTESFILES descending:
131
+ View files last written in 2004 with columns INDEX, SPECIALIST, STAT,
132
+ #UNIQFILE, MBYTEDATA; sort by STAT ascending and MBYTEDATA descending:
134
133
 
135
134
  viewwebfile XUOJB -y 2004 -O Ob
136
135
 
@@ -247,7 +247,7 @@ class ViewWEBUsage(PgView):
247
247
  if 'z' not in self.params or sn in self.EXPAND: continue
248
248
  fld = self.FLDS[sn]
249
249
  if fld[6] != 'G': continue
250
- self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(self.pgname, sn, fld[0]), self.LGWNEX)
250
+ self.pglog("{}: cannot show zero usage for unexpandable field {} - {}".format(self.pgname, sn, fld[0]), self.LGWNEX)
251
251
  if 'E' in self.params or 'I' in self.params:
252
252
  if 'z' in self.params:
253
253
  self.pglog(self.pgname + ": option -z and -E/-I can not be present at the same time", self.LGWNEX)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_metrics
3
- Version: 3.0.2
3
+ Version: 3.0.4
4
4
  Summary: RDA Python Package to gather and view data usage metrics
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-metrics
@@ -42,6 +42,7 @@ src/rda_python_metrics/filltdsusage.usg
42
42
  src/rda_python_metrics/filluser.py
43
43
  src/rda_python_metrics/filluser.usg
44
44
  src/rda_python_metrics/fillzenodousage.py
45
+ src/rda_python_metrics/fillzenodousage.usg
45
46
  src/rda_python_metrics/log_arch.py
46
47
  src/rda_python_metrics/logarch.py
47
48
  src/rda_python_metrics/logarch.usg