rda-python-dscheck 2.0.0__tar.gz → 2.0.2__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 (19) hide show
  1. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/PKG-INFO +1 -1
  2. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/pyproject.toml +1 -1
  3. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck/dscheck.py +4 -4
  4. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck/dscheck.usg +7 -7
  5. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck/pg_check.py +152 -157
  6. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck.egg-info/PKG-INFO +1 -1
  7. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/LICENSE +0 -0
  8. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/MANIFEST.in +0 -0
  9. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/README.md +0 -0
  10. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/setup.cfg +0 -0
  11. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck/PgCheck.py +0 -0
  12. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck/__init__.py +0 -0
  13. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck/ds_check.py +0 -0
  14. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck.egg-info/SOURCES.txt +0 -0
  15. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck.egg-info/dependency_links.txt +0 -0
  16. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck.egg-info/entry_points.txt +0 -0
  17. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck.egg-info/requires.txt +0 -0
  18. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/src/rda_python_dscheck.egg-info/top_level.txt +0 -0
  19. {rda_python_dscheck-2.0.0 → rda_python_dscheck-2.0.2}/tests/test_dscheck.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_dscheck
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: RDA python package to add and process batch jobs
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-dscheck
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rda_python_dscheck"
7
- version = "2.0.0"
7
+ version = "2.0.2"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -123,7 +123,7 @@ class DsCheck(PgCheck):
123
123
  ss = "is"
124
124
  subject = "{} active Check Record{}".format(allcnt, s)
125
125
  mbuf = "{} {} listed:\n".format(subject, ss)
126
- pgrecs = {'status' : self.get_check_status(pgrecs, allcnt)}
126
+ pgrecs = {'status': self.get_check_status(pgrecs, allcnt)}
127
127
  for i in range(allcnt):
128
128
  if i > 0: mbuf += self.PGLOG['SEPLINE']
129
129
  mbuf += self.build_check_message(self.onerecord(pgrecs, i))
@@ -362,7 +362,7 @@ class DsCheck(PgCheck):
362
362
  if dlupdt and self.pgexec("UPDATE dlupdt set pid = 0 WHERE lindex = {}".format(dlupdt['lindex']), self.PGOPT['extlog']):
363
363
  self.pglog("Update Local File Index {} unlocked".format(dlupdt['lindex']), self.LOGWRN)
364
364
  elif pgrec['command'] == 'dsrqst':
365
- record = {'status' : 'I', 'pid' : 0}
365
+ record = {'status': 'I', 'pid': 0}
366
366
  if pgrec['otype'] == 'P':
367
367
  table = "ptrqst"
368
368
  field = "pindex"
@@ -435,7 +435,7 @@ class DsCheck(PgCheck):
435
435
  cnd += "specialist = '{}' AND ".format(self.params['LN'])
436
436
  acnd = self.get_hash_condition("dscheck", None, "ST", 1)
437
437
  if acnd: acnd += " AND "
438
- self.set_dscheck_options(self.get_host(1), cnd + acnd, logact)
438
+ self.set_dscheck_options(cnd + acnd, logact)
439
439
  if self.PGLOG['ERRCNT']: self.send_error_email()
440
440
 
441
441
  # rdadata daemon handles the daemon controls
@@ -494,7 +494,7 @@ class DsCheck(PgCheck):
494
494
  hash = self.TBLHASH[tname]
495
495
  condition = self.get_hash_condition(tname, None, "H", 1)
496
496
  if 'HN' in self.params:
497
- pgrecs = {'specialist' : [], 'hostname' : []}
497
+ pgrecs = {'specialist': [], 'hostname': []}
498
498
  spclsts = self.pgmget(tname, "DISTINCT specialist", condition, self.PGOPT['extlog'])
499
499
  if spclsts:
500
500
  for specialist in spclsts['specialist']:
@@ -170,11 +170,11 @@ categories:
170
170
  is present. Combination of specialist login name, command name and hostname of
171
171
  computer must be unique for for each daemon control record.
172
172
 
173
- Specify host name 'SLURM' for putting the command in the SLURM batch control system. If
173
+ Specify host name 'PBS' for putting the command in the PBS batch control system. If
174
174
  a specified command name is not found in the daemon control, the general 'dscheck'
175
175
  configuration for command name 'ALL' is used.
176
176
 
177
- For example, set daemon control information for schuster, all commands on SLURM hosts,
177
+ For example, set daemon control information for schuster, all commands on PBS hosts,
178
178
  for maximum 4 checks can be processed at the same time with priority 1, the smaller
179
179
  the number the higher the priority is, via input file daemon.ctl
180
180
 
@@ -182,7 +182,7 @@ categories:
182
182
 
183
183
  <<Content of input file daemon.ctl>>
184
184
  DaemonIndex<:>Command<:>Specialist<:>Hostname<:>ProcessLimit<:>Priority<:>
185
- 0<:>schuster<:>ALL<:>SLURM<:>4<:>1<:>
185
+ 0<:>schuster<:>ALL<:>PBS<:>4<:>1<:>
186
186
 
187
187
 
188
188
  3.1.2 Get Daemon Control
@@ -311,11 +311,11 @@ DaemonIndex<:>Command<:>Specialist<:>Hostname<:>ProcessLimit<:>Priority<:>
311
311
  (ls -l | grep test) 1> test2.out 2>test2.err
312
312
 
313
313
  For example, to add testing command 'test2' into 'dscheck' for delayed mode execution on
314
- SLURM
314
+ PBS
315
315
 
316
- dsheck AC -CM test2 -HN SLURM
316
+ dsheck AC -CM test2 -HN PBS
317
317
 
318
- The command 'test2' must be executable at the current working directory on SLURM machines.
318
+ The command 'test2' must be executable at the current working directory on PBS machines.
319
319
 
320
320
 
321
321
  3.2.2 Get Check
@@ -591,7 +591,7 @@ Information options are used to pass information, one or multiple values, into
591
591
 
592
592
  -LH or -LocalHost, specify a local hostname to processes checks on the host for
593
593
  action -PC(-ProcessCheck). It defaults to '' to use the local host name. Specify
594
- SLURM or PBS to process batch jobs.
594
+ PBS to process batch jobs.
595
595
 
596
596
  -MT or -MaxrunTime, specify the maxmum run time for deamon mode. It defaults to 0
597
597
  for unlimit time. For examples, 5000 means seconds, and 1D means 1 day for 86400
@@ -1,15 +1,15 @@
1
1
  ###############################################################################
2
2
  #
3
- # Title : pg_check.py
4
- # Author : Zaihua Ji, zji@ucar.edu
5
- # Date : 08/26/2020
3
+ # Title: pg_check.py
4
+ # Author: Zaihua Ji, zji@ucar.edu
5
+ # Date: 08/26/2020
6
6
  # 2025-02-10 transferred to package rda_python_dscheck from
7
7
  # https://github.com/NCAR/rda-shared-libraries.git
8
8
  # 2025-12-04 convert to class PgOPT
9
- # Purpose : python library module for for holding some global variables and
9
+ # Purpose: python library module for for holding some global variables and
10
10
  # functions for dscheck utility
11
11
  #
12
- # Github : https://github.com/NCAR/rda-python-dscheck.git
12
+ # Github: https://github.com/NCAR/rda-python-dscheck.git
13
13
  #
14
14
  ###############################################################################
15
15
  #
@@ -30,147 +30,145 @@ class PgCheck(PgOPT, PgCMD):
30
30
  self.SHELLS = {} # shell names used by specialists
31
31
  # define initially the needed option values
32
32
  self.OPTS.update({
33
- 'PC' : [0x0004, 'ProcessCheck', 1],
34
- 'AC' : [0x0008, 'AddCheck', 1],
35
- 'GD' : [0x0010, 'GetDaemon', 0],
36
- 'SD' : [0x0020, 'SetDaemon', 1],
37
- 'GC' : [0x0040, 'GetCheck', 0],
38
- 'DL' : [0x0080, 'Delete', 1],
39
- 'UL' : [0x0100, 'UnLockCheck', 1],
40
- 'EC' : [0x0200, 'EmailCheck', 0],
41
- 'IC' : [0x0400, 'InterruptCheck', 1],
42
- 'CH' : [0x1000, 'CheckHost', 0],
43
- 'SO' : [0x1000, 'SetOptions', 1],
44
- 'AW' : [0, 'AnyWhere', 0],
45
- 'BG' : [0, 'BackGround', 0],
46
- 'CP' : [0, 'CheckPending', 0],
47
- 'CS' : [0, 'CheckStatus', 0],
48
- 'FI' : [0, 'ForceInterrrupt', 0],
49
- 'FO' : [0, 'FormatOutput', 0],
50
- 'LO' : [0, 'LogOn', 0],
51
- 'MD' : [0, 'PgDataset', 3],
52
- 'NC' : [0, 'NoCommand', 0],
53
- 'ND' : [0, 'NewDaemon', 0],
54
- 'NT' : [0, 'NoTrim', 0],
55
- 'WR' : [0, 'WithdsRqst', 0],
56
- 'WU' : [0, 'WithdsUpdt', 0],
57
- 'DM' : [1, 'DaemonMode', 1], # for action PC, start|quit|logon|logoff
58
- 'DV' : [1, 'Divider', 1], # default to <:>
59
- 'ES' : [1, 'EqualSign', 1], # default to <=>
60
- 'FN' : [1, 'FieldNames', 0],
61
- 'LH' : [1, 'LocalHost', 0, ''],
62
- 'MT' : [1, 'MaxrunTime', 0],
63
- 'OF' : [1, 'OutputFile', 0],
64
- 'ON' : [1, 'OrderNames', 0],
65
- 'AO' : [1, 'ActOption', 1], # default to <!>
66
- 'WI' : [1, 'WaitInterval', 1],
67
- 'AN' : [2, 'ActionName', 0],
68
- 'AV' : [2, 'ArgumentVector', 0],
69
- 'AX' : [2, 'ArgumenteXtra', 0],
70
- 'CC' : [2, 'CarbonCopy', 0],
71
- 'CD' : [2, 'CheckDate', 256],
72
- 'CI' : [2, 'CheckIndex', 16],
73
- 'CM' : [2, 'Command', 1],
74
- 'CT' : [2, 'CheckTime', 32],
75
- 'DB' : [2, 'Debug', 0],
76
- 'DC' : [2, 'DoneCount', 17],
77
- 'DF' : [2, 'DownFlags', 1],
78
- 'DI' : [2, 'DaemonIndex', 16],
79
- 'DS' : [2, 'Dataset', 1],
80
- 'ER' : [2, 'ERrormessage', 0],
81
- 'EV' : [2, 'Environments', 1],
82
- 'FC' : [2, 'FileCount', 17],
83
- 'HN' : [2, 'HostName', 1],
84
- 'IF' : [2, 'InputFile', 0],
85
- 'MC' : [2, 'MaxCount', 17],
86
- 'MH' : [2, 'MatchHost', 1],
87
- 'MO' : [2, 'Modules', 1],
88
- 'PI' : [2, 'ParentIndex', 17],
89
- 'PL' : [2, 'ProcessLimit', 17],
90
- 'PO' : [2, 'Priority', 17],
91
- 'PQ' : [2, 'PBSQueue', 0],
92
- 'QS' : [2, 'QSubOptions', 0],
93
- 'SN' : [2, 'Specialist', 1],
94
- 'ST' : [2, 'Status', 0],
95
- 'SZ' : [2, 'DataSize', 16],
96
- 'TC' : [2, 'TryCount', 17],
97
- 'WD' : [2, 'WorkDir', 0],
33
+ 'PC': [0x0004, 'ProcessCheck', 1],
34
+ 'AC': [0x0008, 'AddCheck', 1],
35
+ 'GD': [0x0010, 'GetDaemon', 0],
36
+ 'SD': [0x0020, 'SetDaemon', 1],
37
+ 'GC': [0x0040, 'GetCheck', 0],
38
+ 'DL': [0x0080, 'Delete', 1],
39
+ 'UL': [0x0100, 'UnLockCheck', 1],
40
+ 'EC': [0x0200, 'EmailCheck', 0],
41
+ 'IC': [0x0400, 'InterruptCheck', 1],
42
+ 'CH': [0x1000, 'CheckHost', 0],
43
+ 'SO': [0x1000, 'SetOptions', 1],
44
+ 'AW': [0, 'AnyWhere', 0],
45
+ 'BG': [0, 'BackGround', 0],
46
+ 'CP': [0, 'CheckPending', 0],
47
+ 'CS': [0, 'CheckStatus', 0],
48
+ 'FI': [0, 'ForceInterrrupt', 0],
49
+ 'FO': [0, 'FormatOutput', 0],
50
+ 'LO': [0, 'LogOn', 0],
51
+ 'MD': [0, 'PgDataset', 3],
52
+ 'NC': [0, 'NoCommand', 0],
53
+ 'ND': [0, 'NewDaemon', 0],
54
+ 'NT': [0, 'NoTrim', 0],
55
+ 'WR': [0, 'WithdsRqst', 0],
56
+ 'WU': [0, 'WithdsUpdt', 0],
57
+ 'DM': [1, 'DaemonMode', 1], # for action PC, start|quit|logon|logoff
58
+ 'DV': [1, 'Divider', 1], # default to <:>
59
+ 'ES': [1, 'EqualSign', 1], # default to <=>
60
+ 'FN': [1, 'FieldNames', 0],
61
+ 'LH': [1, 'LocalHost', 0, ''],
62
+ 'MT': [1, 'MaxrunTime', 0],
63
+ 'OF': [1, 'OutputFile', 0],
64
+ 'ON': [1, 'OrderNames', 0],
65
+ 'AO': [1, 'ActOption', 1], # default to <!>
66
+ 'WI': [1, 'WaitInterval', 1],
67
+ 'AN': [2, 'ActionName', 0],
68
+ 'AV': [2, 'ArgumentVector', 0],
69
+ 'AX': [2, 'ArgumenteXtra', 0],
70
+ 'CC': [2, 'CarbonCopy', 0],
71
+ 'CD': [2, 'CheckDate', 256],
72
+ 'CI': [2, 'CheckIndex', 16],
73
+ 'CM': [2, 'Command', 1],
74
+ 'CT': [2, 'CheckTime', 32],
75
+ 'DB': [2, 'Debug', 0],
76
+ 'DC': [2, 'DoneCount', 17],
77
+ 'DF': [2, 'DownFlags', 1],
78
+ 'DI': [2, 'DaemonIndex', 16],
79
+ 'DS': [2, 'Dataset', 1],
80
+ 'ER': [2, 'ERrormessage', 0],
81
+ 'EV': [2, 'Environments', 1],
82
+ 'FC': [2, 'FileCount', 17],
83
+ 'HN': [2, 'HostName', 1],
84
+ 'IF': [2, 'InputFile', 0],
85
+ 'MC': [2, 'MaxCount', 17],
86
+ 'MH': [2, 'MatchHost', 1],
87
+ 'MO': [2, 'Modules', 1],
88
+ 'PI': [2, 'ParentIndex', 17],
89
+ 'PL': [2, 'ProcessLimit', 17],
90
+ 'PO': [2, 'Priority', 17],
91
+ 'PQ': [2, 'PBSQueue', 0],
92
+ 'QS': [2, 'QSubOptions', 0],
93
+ 'SN': [2, 'Specialist', 1],
94
+ 'ST': [2, 'Status', 0],
95
+ 'SZ': [2, 'DataSize', 16],
96
+ 'TC': [2, 'TryCount', 17],
97
+ 'WD': [2, 'WorkDir', 0],
98
98
  })
99
99
  self.ALIAS.update({
100
- 'AN' : ['Action'],
101
- 'BG' : ['b'],
102
- 'CF' : ['Confirmation', 'ConfirmAction'],
103
- 'CM' : ['CommandName'],
104
- 'DL' : ['RM', 'Remove'],
105
- 'DS' : ['Dsid', 'DatasetID'],
106
- 'DV' : ['Delimiter', 'Separater'],
107
- 'EV' : ['Envs'],
108
- 'GZ' : ['GMT', 'GreenwichZone', 'UTC'],
109
- 'MC' : ['MaximumCount', 'MaxTryCount'],
110
- 'MH' : ['MatchHostname'],
111
- 'NC' : ['NoRemoteCommand'],
112
- 'MO' : ['Mods'],
113
- 'PI' : ['ParentCheckIndex'],
114
- 'QS' : ['PBSOptions'],
115
- 'SO' : ['SetBatchOptions'],
116
- 'SZ' : ['Size', "ProcSize"],
117
- 'UL' : ['UnLock'],
118
- 'WD' : ["WorkDirectory"],
119
- 'WR' : ["WithRequest"],
120
- 'WU' : ["WithUpdate"],
100
+ 'AN': ['Action'],
101
+ 'BG': ['b'],
102
+ 'CF': ['Confirmation', 'ConfirmAction'],
103
+ 'CM': ['CommandName'],
104
+ 'DL': ['RM', 'Remove'],
105
+ 'DS': ['Dsid', 'DatasetID'],
106
+ 'DV': ['Delimiter', 'Separater'],
107
+ 'EV': ['Envs'],
108
+ 'GZ': ['GMT', 'GreenwichZone', 'UTC'],
109
+ 'MC': ['MaximumCount', 'MaxTryCount'],
110
+ 'MH': ['MatchHostname'],
111
+ 'NC': ['NoRemoteCommand'],
112
+ 'MO': ['Mods'],
113
+ 'PI': ['ParentCheckIndex'],
114
+ 'QS': ['PBSOptions'],
115
+ 'SO': ['SetBatchOptions'],
116
+ 'SZ': ['Size', "ProcSize"],
117
+ 'UL': ['UnLock'],
118
+ 'WD': ["WorkDirectory"],
119
+ 'WR': ["WithRequest"],
120
+ 'WU': ["WithUpdate"],
121
121
  })
122
122
  self.TBLHASH['dscheck'] = {
123
123
  #SHORTNM KEYS DBFIELD
124
- 'C' : ['CI', "cindex", 0],
125
- 'O' : ['CM', "command", 1],
126
- 'V' : ['AV', "argv", 1],
127
- 'T' : ['DS', "dsid", 1],
128
- 'A' : ['AN', "action", 1],
129
- 'U' : ['ST', "status", 1],
130
- 'P' : ['PQ', "pbsqueue", 1],
131
- 'R' : ['PI', "pindex", 0],
132
- 'B' : ['DF', "dflags", 0],
133
- 'F' : ['FC', "fcount", 0],
134
- 'J' : ['DC', "dcount", 0],
135
- 'K' : ['TC', "tcount", 0],
136
- 'L' : ['MC', "mcount", 0],
137
- 'Z' : ['SZ', "size", 0],
138
- 'D' : ['CD', "date", 1],
139
- 'Y' : ['CT', "time", 1],
140
- 'H' : ['HN', "hostname", 1],
141
- 'N' : ['SN', "specialist", 1],
142
- 'W' : ['WD', "workdir", 1],
143
- 'M' : ['MO', "modules", 1],
144
- 'I' : ['EV', "environments", 1],
145
- 'Q' : ['QS', "qoptions", 1],
146
- 'X' : ['AX', "argextra", -1],
147
- 'E' : ['ER', "errmsg", -1],
124
+ 'C': ['CI', "cindex", 0],
125
+ 'O': ['CM', "command", 1],
126
+ 'V': ['AV', "argv", 1],
127
+ 'T': ['DS', "dsid", 1],
128
+ 'A': ['AN', "action", 1],
129
+ 'U': ['ST', "status", 1],
130
+ 'P': ['PQ', "pbsqueue", 1],
131
+ 'R': ['PI', "pindex", 0],
132
+ 'B': ['DF', "dflags", 0],
133
+ 'F': ['FC', "fcount", 0],
134
+ 'J': ['DC', "dcount", 0],
135
+ 'K': ['TC', "tcount", 0],
136
+ 'L': ['MC', "mcount", 0],
137
+ 'Z': ['SZ', "size", 0],
138
+ 'D': ['CD', "date", 1],
139
+ 'Y': ['CT', "time", 1],
140
+ 'H': ['HN', "hostname", 1],
141
+ 'N': ['SN', "specialist", 1],
142
+ 'W': ['WD', "workdir", 1],
143
+ 'M': ['MO', "modules", 1],
144
+ 'I': ['EV', "environments", 1],
145
+ 'Q': ['QS', "qoptions", 1],
146
+ 'X': ['AX', "argextra", -1],
147
+ 'E': ['ER', "errmsg", -1],
148
148
  }
149
149
  self.TBLHASH['dsdaemon'] = {
150
150
  #SHORTNM KEYS DBFIELD
151
- 'I' : ['DI', "dindex", 0],
152
- 'C' : ['CM', "command", 1],
153
- 'H' : ['HN', "hostname", 1],
154
- 'M' : ['MH', "matchhost", 1],
155
- 'S' : ['SN', "specialist", 1],
156
- 'P' : ['PL', "proclimit", 0],
157
- 'O' : ['PO', "priority", 0],
151
+ 'I': ['DI', "dindex", 0],
152
+ 'C': ['CM', "command", 1],
153
+ 'H': ['HN', "hostname", 1],
154
+ 'M': ['MH', "matchhost", 1],
155
+ 'S': ['SN', "specialist", 1],
156
+ 'P': ['PL', "proclimit", 0],
157
+ 'O': ['PO', "priority", 0],
158
158
  }
159
159
  self.CHKHOST = {
160
- 'curhost' : self.get_host(1),
161
- 'chkhost' : None,
162
- 'hostcond' : None,
163
- 'isbatch' : 0
160
+ 'curhost': self.get_host(1),
161
+ 'chkhost': None,
162
+ 'hostcond': None,
163
+ 'isbatch': 0
164
164
  }
165
165
  self.PGOPT['dscheck'] = "COVTUPFJDNW" # default
166
166
  self.PGOPT['chkall'] = "COVTAUPRBFJKLZDYHNWMIQXE" # default to all
167
167
  self.PGOPT['dsdaemon'] = "ICHQSPO" # default to all
168
168
  self.PGOPT['waitlimit'] = 280 # limit of C and P request checks at a time
169
169
  self.PGOPT['totallimit'] = 380 # maximum number of checks can be started on PBS
170
- self.PBSQUEUES = {'rda' : None, 'htc' : 'casper@casper-pbs'}
171
- self.PBSTIMES = {'default' : 21600, 'rda' : self.PGLOG['PBSTIME'], 'htc' : 86400}
172
- #self.DOPTHOSTS = {'rda-work' : None, 'PBS' : ['!subconv -Q']}
173
- self.DOPTHOSTS = {'rda-work' : None, 'PBS' : None, 'cron' : None}
170
+ self.PBSQUEUES = {'rda': None, 'htc': 'casper@casper-pbs'}
171
+ self.PBSTIMES = {'default': 21600, 'rda': self.PGLOG['PBSTIME'], 'htc': 86400}
174
172
  self.DSLMTS = {}
175
173
  self.EMLMTS = {}
176
174
 
@@ -280,7 +278,7 @@ class PgCheck(PgOPT, PgCMD):
280
278
  self.PLIMITS[ckey] = 0
281
279
  return 0
282
280
  j = 0
283
- self.PLIMITS[ckey] = {'host' : [], 'priority' : [], 'acnt' : [], 'match' : [], 'pcnd' : []}
281
+ self.PLIMITS[ckey] = {'host': [], 'priority': [], 'acnt': [], 'match': [], 'pcnd': []}
284
282
  for i in range(cnt):
285
283
  if pgrecs['proclimit'][i] <= 0: continue
286
284
  host = pgrecs['hostname'][i]
@@ -366,7 +364,7 @@ class PgCheck(PgOPT, PgCMD):
366
364
  else:
367
365
  self.update_dscheck_time(pgrec, ltime, logact)
368
366
  elif not pgrec['lockhost'] or pgrec['lockhost'] == 'rda_config':
369
- record = {'pid' : 0, 'lockhost' : ''}
367
+ record = {'pid': 0, 'lockhost': ''}
370
368
  if self.pgupdt("dscheck", record, "cindex = {} AND pid = {}".format(cidx, pgrec['pid']), logact):
371
369
  self.pglog("CHK{}: unlocked {}".format(cidx, lmsg), self.LOGWRN)
372
370
  lcnt += 1
@@ -398,7 +396,7 @@ class PgCheck(PgOPT, PgCMD):
398
396
  # update dscheck time in case in pending status or
399
397
  # the command does not updateupdates not on time by itself
400
398
  def update_dscheck_time(self, pgrec, ltime, logact = 0):
401
- record = {'chktime' : ltime}
399
+ record = {'chktime': ltime}
402
400
  if(self.CHKHOST['chkhost'] and self.CHKHOST['chkhost'] == self.PGLOG['PBSNAME']
403
401
  and pgrec['lockhost'] == self.PGLOG['PBSNAME']):
404
402
  info = self.get_pbs_info(pgrec['pid'], 0, logact)
@@ -756,7 +754,7 @@ class PgCheck(PgOPT, PgCMD):
756
754
  newrec['stttime'] > pgrec['stttime'] or newrec['tcount'] > pgrec['tcount']): return 1
757
755
  if self.lock_dscheck(pgrec['cindex'], 1) <= 0: return 1
758
756
  if pgrec['subtime'] or pgrec['stttime']:
759
- newrec = {'stttime' : 0, 'subtime' : 0, 'runhost' : '', 'bid' : 0}
757
+ newrec = {'stttime': 0, 'subtime': 0, 'runhost': '', 'bid': 0}
760
758
  (newrec['ttltime'], newrec['quetime']) = self.get_dscheck_runtime(pgrec)
761
759
  if not self.pgupdt("dscheck", newrec, "cindex = {}".format(pgrec['cindex']), logact): return 1
762
760
  return 0
@@ -808,7 +806,7 @@ class PgCheck(PgOPT, PgCMD):
808
806
  def validate_dsrqst_partitions(self, pgrec, logact = 0):
809
807
  pgctl = self.get_dsrqst_control(pgrec, logact)
810
808
  if pgctl and (pgctl['ptlimit'] or pgctl['ptsize']): return True
811
- record = {'ptcount' : 1}
809
+ record = {'ptcount': 1}
812
810
  pgrec['ptcount'] = 1
813
811
  if pgrec['ptlimit']: pgrec['ptlimit'] = record['ptlimit'] = 0
814
812
  if pgrec['ptsize']: pgrec['ptsize'] = record['ptsize'] = 0
@@ -816,19 +814,16 @@ class PgCheck(PgOPT, PgCMD):
816
814
  return False
817
815
 
818
816
  # call given command to evaluate dynamically the dscheck.qoptions
819
- def set_dscheck_options(self, chost, cnd, logact):
820
- if chost not in self.DOPTHOSTS: return
817
+ def set_dscheck_options(self, cnd, logact):
821
818
  qcnt = 0
822
- skipcmds = self.DOPTHOSTS[chost]
823
819
  pgrecs = self.pgmget("dscheck", "*", cnd + "pid = 0 AND status = 'C' AND LEFT(qoptions, 1) = '!'", logact)
824
820
  cnt = len(pgrecs['cindex']) if pgrecs else 0
825
821
  for i in range(cnt):
826
822
  pgrec = self.onerecord(pgrecs, i)
827
- if skipcmds and pgrec['qoptions'] in skipcmds: continue # skip
828
823
  if self.lock_dscheck(pgrec['cindex'], 1) <= 0: continue
829
824
  qoptions = self.build_dscheck_options(pgrec, 'qoptions', 'PBS')
830
825
  if not qoptions and pgrec['status'] == 'E': continue # failed evaluating qoptions
831
- record = {'pid' : 0, 'qoptions': qoptions}
826
+ record = {'pid': 0, 'qoptions': qoptions}
832
827
  qcnt += self.pgupdt('dscheck', record, "cindex = {}".format(pgrec['cindex']), self.PGOPT['errlog'])
833
828
  if qcnt and cnt > 1: self.pglog("{} of {} DSCHECK PBS options Dynamically set on {}".format(qcnt, cnt, self.PGLOG['HOSTNAME']), self.WARNLG)
834
829
 
@@ -927,7 +922,7 @@ class PgCheck(PgOPT, PgCMD):
927
922
  self.pglog("Rqst{}: time updated for {}".format(ridx, lmsg), self.LOGWRN|self.FRCLOG)
928
923
  elif(not pgrec['lockhost'] or pgrec['lockhost'] == 'rda_config' or pgrec['lockhost'] == 'partition' and
929
924
  not self.pgget('ptrqst', '', "rindex = {} AND pid > 0".format(ridx), logact)):
930
- record = {'pid' : 0, 'lockhost' : ''}
925
+ record = {'pid': 0, 'lockhost': ''}
931
926
  if self.pgupdt("dsrqst", record, "rindex = {} AND pid = {}".format(ridx, pgrec['pid']), logact):
932
927
  self.pglog("Rqst{}: unlocked {}".format(ridx, pgrec['lockhost'], pgrec['pid'], self.current_datetime(ltime)), self.LOGWRN)
933
928
  lcnt += 1
@@ -956,7 +951,7 @@ class PgCheck(PgOPT, PgCMD):
956
951
  not self.pgget("dscheck", "", "oindex = {} AND command = 'dsrqst' AND otype = 'P'".format(pidx))):
957
952
  self.pglog("RPT{}: time updated for {}".format(pidx, lmsg), self.LOGWRN)
958
953
  elif not pgrec['lockhost'] or pgrec['lockhost'] == 'rda_config':
959
- record = {'pid' : 0, 'lockhost' : ''}
954
+ record = {'pid': 0, 'lockhost': ''}
960
955
  if self.pgupdt("ptrqst", record, "pindex = {} AND pid = {}".format(pidx, pgrec['pid']), logact):
961
956
  self.pglog("RPT{}: unlocked {}".format(pidx, lmsg), self.LOGWRN)
962
957
  lcnt += 1
@@ -973,7 +968,7 @@ class PgCheck(PgOPT, PgCMD):
973
968
  cnd += " OR status = 'O' AND (date_purge < '{}' OR date_purge = '{}' AND time_purge < '{}')) ORDER BY rindex".format(sdate, sdate, stime)
974
969
  pgrecs = self.pgmget("dsrqst", "rindex, dsid, email, specialist", cnd, logact)
975
970
  cnt = (len(pgrecs['rindex']) if pgrecs else 0)
976
- pgctl = {'qoptions' : "-l walltime=1:00:00"}
971
+ pgctl = {'qoptions': "-l walltime=1:00:00"}
977
972
  pcnt = 0
978
973
  for i in range(cnt):
979
974
  pgrec = self.onerecord(pgrecs, i)
@@ -1099,7 +1094,7 @@ class PgCheck(PgOPT, PgCMD):
1099
1094
  not self.pgget("dscheck", "", "oindex = {} AND command = 'dsupdt'".format(idx))):
1100
1095
  self.pglog("UC{}: time updated for {}".format(idx, lmsg), self.LOGWRN)
1101
1096
  elif not pgrec['lockhost'] or pgrec['lockhost'] == 'rda_config':
1102
- record = {'pid' : 0, 'lockhost' : ''}
1097
+ record = {'pid': 0, 'lockhost': ''}
1103
1098
  if self.pgupdt("dcupdt", record, "cindex = {} AND pid = {}".format(idx, pgrec['pid']), logact):
1104
1099
  self.pglog("UC{}: unlocked {}".format(idx, lmsg), self.LOGWRN)
1105
1100
  lcnt += 1
@@ -1124,7 +1119,7 @@ class PgCheck(PgOPT, PgCMD):
1124
1119
  continue
1125
1120
  self.pgexec("UPDATE dlupdt SET locktime = {} WHERE lindex = {} AND pid = {}".format(ltime, idx, pgrec['pid']), logact)
1126
1121
  elif not pgrec['hostname'] or pgrec['hostname'] == 'rda_config':
1127
- record = {'pid' : 0, 'hostname' : ''}
1122
+ record = {'pid': 0, 'hostname': ''}
1128
1123
  if self.pgupdt("dlupdt", record, "lindex = {} AND pid = {}".format(idx, pgrec['pid']), logact):
1129
1124
  self.pglog("Updt{}: unlocked {}".format(idx, lmsg), self.LOGWRN)
1130
1125
  lcnt += 1
@@ -1188,8 +1183,8 @@ class PgCheck(PgOPT, PgCMD):
1188
1183
  argv = argv[0:100]
1189
1184
  else:
1190
1185
  argextra = None
1191
- record = {'command' : cmd, 'argv' : argv, 'specialist' : specialist, 'workdir' : workdir,
1192
- 'dsid' : dsid, 'action' : action, 'oindex' : oindex, 'otype' : otype}
1186
+ record = {'command': cmd, 'argv': argv, 'specialist': specialist, 'workdir': workdir,
1187
+ 'dsid': dsid, 'action': action, 'oindex': oindex, 'otype': otype}
1193
1188
  (record['date'], record['time']) = self.get_date_time()
1194
1189
  if argextra: record['argextra'] = argextra
1195
1190
  if 'PI' in self.params: record['pindex'] = self.params['PI'][0]
@@ -1225,16 +1220,16 @@ class PgCheck(PgOPT, PgCMD):
1225
1220
  @staticmethod
1226
1221
  def dscheck_status(stat):
1227
1222
  STATUS = {
1228
- 'C' : "Created",
1229
- 'D' : "Done",
1230
- 'E' : "Exit",
1231
- 'F' : "Finished",
1232
- 'H' : "Held",
1233
- 'I' : "Interrupted",
1234
- 'P' : "Pending",
1235
- 'Q' : "Queueing",
1236
- 'R' : "Run",
1237
- 'S' : "Suspended",
1223
+ 'C': "Created",
1224
+ 'D': "Done",
1225
+ 'E': "Exit",
1226
+ 'F': "Finished",
1227
+ 'H': "Held",
1228
+ 'I': "Interrupted",
1229
+ 'P': "Pending",
1230
+ 'Q': "Queueing",
1231
+ 'R': "Run",
1232
+ 'S': "Suspended",
1238
1233
  }
1239
1234
  return (STATUS[stat] if stat in STATUS else "Unknown")
1240
1235
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_dscheck
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: RDA python package to add and process batch jobs
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-dscheck