rda-python-miscs 2.0.0__tar.gz → 2.0.1__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 (49) hide show
  1. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/PKG-INFO +1 -1
  2. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/pyproject.toml +1 -1
  3. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdakill.py +4 -47
  4. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdakill.usg +4 -4
  5. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdaps.py +3 -39
  6. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdaps.usg +1 -1
  7. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs.egg-info/PKG-INFO +1 -1
  8. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/LICENSE +0 -0
  9. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/MANIFEST.in +0 -0
  10. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/README.md +0 -0
  11. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/setup.cfg +0 -0
  12. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/__init__.py +0 -0
  13. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/bash_qsub.py +0 -0
  14. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/bashqsub.py +0 -0
  15. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/bashqsub.usg +0 -0
  16. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/gdex_ls.py +0 -0
  17. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/gdexls.py +0 -0
  18. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/gdexls.usg +0 -0
  19. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/gdexls_standalone.py +0 -0
  20. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/pg_wget.py +0 -0
  21. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/pgwget.py +0 -0
  22. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rda_cp.py +0 -0
  23. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rda_kill.py +0 -0
  24. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rda_mod.py +0 -0
  25. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rda_own.py +0 -0
  26. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rda_ps.py +0 -0
  27. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rda_sub.py +0 -0
  28. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rda_zip.py +0 -0
  29. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdacp.py +0 -0
  30. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdacp.usg +0 -0
  31. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdals.py +0 -0
  32. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdals.usg +0 -0
  33. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdamod.py +0 -0
  34. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdamod.usg +0 -0
  35. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdaown.py +0 -0
  36. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdaown.usg +0 -0
  37. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdasub.py +0 -0
  38. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdasub.usg +0 -0
  39. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdazip.py +0 -0
  40. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/rdazip.usg +0 -0
  41. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/tcsh_qsub.py +0 -0
  42. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/tcshqsub.py +0 -0
  43. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs/tcshqsub.usg +0 -0
  44. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs.egg-info/SOURCES.txt +0 -0
  45. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs.egg-info/dependency_links.txt +0 -0
  46. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs.egg-info/entry_points.txt +0 -0
  47. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs.egg-info/requires.txt +0 -0
  48. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/src/rda_python_miscs.egg-info/top_level.txt +0 -0
  49. {rda_python_miscs-2.0.0 → rda_python_miscs-2.0.1}/tests/test_miscs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_miscs
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: RDA Python package to hold RDA miscellaneous utility programs
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-miscs
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "rda_python_miscs"
9
- version = "2.0.0"
9
+ version = "2.0.1"
10
10
  authors = [
11
11
  { name="Zaihua Ji", email="zji@ucar.edu" },
12
12
  ]
@@ -26,7 +26,7 @@ class RdaKill(PgFile):
26
26
  'r': 0, # 1 - reserved for exclusive, working with -s PEND only
27
27
  'u': None, # login user name
28
28
  's': None, # batch status to kill
29
- 'q': None # batch partition/queue for SLURM/PBS, rda for default
29
+ 'q': None # batch partition/queue for PBS, rda for default
30
30
  }
31
31
 
32
32
  # function to read parameters
@@ -71,15 +71,7 @@ class RdaKill(PgFile):
71
71
  killloc = 1
72
72
  if self.RDAKILL['h']:
73
73
  self.local_host_action(self.RDAKILL['h'], "kill processes", self.PGLOG['HOSTNAME'], self.LGEREX)
74
- if not self.pgcmp(self.RDAKILL['h'], self.PGLOG['SLMNAME'], 1):
75
- if not (self.RDAKILL['p'] or self.RDAKILL['s']):
76
- self.pglog("Provide Batch ID or Job Status to kill SLURM jobs", self.LGEREX)
77
- if self.RDAKILL['p']:
78
- self.dakill_slurm_batch(self.RDAKILL['p'])
79
- else:
80
- self.rdakill_slurm_status(self.RDAKILL['s'], self.RDAKILL['q'], self.RDAKILL['u'])
81
- killloc = 0
82
- elif not self.pgcmp(self.RDAKILL['h'], self.PGLOG['PBSNAME'], 1):
74
+ if not self.pgcmp(self.RDAKILL['h'], self.PGLOG['PBSNAME'], 1):
83
75
  if not (self.RDAKILL['p'] or self.RDAKILL['s']):
84
76
  self.pglog("Provide Batch ID or Job Status to kill PBS jobs", self.LGEREX)
85
77
  if self.RDAKILL['p']:
@@ -127,7 +119,6 @@ class RdaKill(PgFile):
127
119
  buf += "on " + self.RDAKILL['h']
128
120
  else:
129
121
  buf += "locally"
130
- if self.PGLOG['CURBID']: buf += "; add Option '-h SLURM' if SLURM batch ID provided"
131
122
  self.pglog(buf, self.LOGWRN)
132
123
 
133
124
  # a local child process
@@ -139,41 +130,7 @@ class RdaKill(PgFile):
139
130
  elif self.check_process(pid):
140
131
  return self.pglog("Error Kill: {}\n{}".format(line, self.PGLOG['SYSERR']), self.LOGWRN)
141
132
  if not self.check_process(pid): self.pglog("Quit: " + line, self.LOGWRN)
142
-
143
- # kill a slurm batch job
144
- def rdakill_slurm_batch(self, bid):
145
- ret = 0
146
- stat = self.check_slurm_status(bid, self.LOGWRN)
147
- if stat:
148
- cmd = self.get_local_command("scancel {}".format(bid), stat['USER'])
149
- ret = self.pgsystem(cmd, self.LOGWRN, 6)
150
- if ret: self.record_dscheck_interrupt(bid, self.PGLOG['SLMNAME'])
151
- else:
152
- self.pglog("{}: cannot find SLURM batch ID".format(bid), self.LOGERR)
153
- if not ret and self.PGLOG['SYSERR']: self.pglog(self.PGLOG['SYSERR'], self.LGEREX)
154
- return ret
155
-
156
- # kill SLURM batch jobs for given status
157
- def rdakill_slurm_status(self, stat, part, uname):
158
- if not part: part = 'rda'
159
- bcmd = "sacct -o jobid,user,state -r {} -".format(part)
160
- bcmd += ("u " + uname if uname else 'a')
161
- lines = self.get_slurm_multiple(bcmd)
162
- bcnt = len(lines['JOBID']) if lines else 0
163
- pcnt = kcnt = 0
164
- for i in range(bcnt):
165
- if lines['STATE'][i] == stat:
166
- pcnt += 1
167
- kcnt += self.rdakill_slurm_batch(lines['JOBID'][i])
168
- if pcnt > 0:
169
- s = 's' if pcnt > 1 else ''
170
- line = "{} of {} SLURM '{}' job{} Killed".format(kcnt, pcnt, stat, s)
171
- else:
172
- line = "No SLURM '{}' job found to kill".format(stat)
173
- line += " in Partition '{}'".format(part)
174
- if uname: line += " for " + uname
175
- self.pglog(line, self.LOGWRN)
176
-
133
+
177
134
  # kill a pbs batch job
178
135
  def rdakill_pbs_batch(self, bid):
179
136
  ret = 0
@@ -188,7 +145,7 @@ class RdaKill(PgFile):
188
145
  self.pglog("{}: cannot find PBS batch ID".format(bid), self.LOGERR)
189
146
  if not ret and self.PGLOG['SYSERR']: self.pglog(self.PGLOG['SYSERR'], self.LGEREX)
190
147
  return ret
191
-
148
+
192
149
  # kill PBS batch jobs for given status
193
150
  def rdakill_pbs_status(self, stat, queue, uname):
194
151
  if not queue: queue = 'rda'
@@ -1,7 +1,7 @@
1
1
 
2
2
  Kill one of multiple processes and theirs children for given local process ID or
3
- other process information; kill one or multiple SLURM/PBS batch jobs for give batch
4
- Job ID or Status. For killing SLURM/PBS batch jobs, you must login to cheyenne/caser
3
+ other process information; kill one or multiple PBS batch jobs for give batch
4
+ Job ID or Status. For killing PBS batch jobs, you must login to casper
5
5
  login nodes.
6
6
 
7
7
  Usage: rdakill [-h HostName] [-p ProcessID] [-P ParentProcessID] \
@@ -10,13 +10,13 @@
10
10
  - Option -a, application name of the process;
11
11
 
12
12
  - Option -h, hostname the process is on. Omit it for local process,
13
- but it is mandatory if the process id is a SLURM/PBS bactch id.
13
+ but it is mandatory if the process id is a PBS bactch id.
14
14
 
15
15
  - Option -p, the process id or batch job id to be stopped.
16
16
 
17
17
  - Option -P, the parent process id;
18
18
 
19
- - Option -q, the SLURM Partition or PBS queue name. It defaults to 'rda';
19
+ - Option -q, the PBS queue name. It defaults to 'rda';
20
20
 
21
21
  - Option -s, the Batch Job Status; this is mantatory if batch id is not provided;
22
22
 
@@ -64,10 +64,7 @@ class RdaPs(PgFile):
64
64
  chkloc = 1
65
65
  if self.RDAPS['h']:
66
66
  self.local_host_action(self.RDAPS['h'], "check processes", self.PGLOG['HOSTNAME'], self.LGEREX)
67
- if not self.pgcmp(self.RDAPS['h'], self.PGLOG['SLMNAME'], 1):
68
- self.slurm_snapshot()
69
- chkloc = 0
70
- elif not self.pgcmp(self.RDAPS['h'], self.PGLOG['PBSNAME'], 1):
67
+ if not self.pgcmp(self.RDAPS['h'], self.PGLOG['PBSNAME'], 1):
71
68
  self.pbs_snapshot()
72
69
  chkloc = 0
73
70
  if chkloc: self.process_snapshot()
@@ -96,40 +93,7 @@ class RdaPs(PgFile):
96
93
  if self.RDAPS['P'] and self.RDAPS['P'] != ppid: continue
97
94
  if self.RDAPS['a'] and aname.find(self.RDAPS['a']) < 0: continue
98
95
  self.pglog(re.sub(r' +', ' ', line), self.LOGWRN)
99
-
100
- # get a snapshot of a SLURM batch process status
101
- def slurm_snapshot(self):
102
- qopts = ''
103
- if self.RDAPS['u']: qopts += " -u " + self.RDAPS['u']
104
- if self.RDAPS['p']:
105
- qopts += " -j {}".format(self.RDAPS['p'])
106
- else:
107
- qopts = " -p rda"
108
- cmd = "squeue -l" + qopts
109
- buf = self.pgsystem(cmd, self.LOGWRN, 272)
110
- if not buf:
111
- if self.PGLOG['SYSERR'] and self.PGLOG['SYSERR'].find('Invalid job id specified') < 0:
112
- self.pglog(self.PGLOG['SYSERR'], self.LGEREX)
113
- return
114
- lines = re.split(r'\n', buf)
115
- lcnt = len(lines)
116
- if lcnt < 3: return
117
- dochk = 1
118
- for line in lines:
119
- if not line: continue
120
- if dochk:
121
- if re.match(r'^\s*JOBID\s', line): dochk = 0
122
- else:
123
- vals = re.split(r'\s+', self.pgtrim(line))
124
- if self.RDAPS['a'] and vals[2] and self.RDAPS['a'] != vals[2]: continue
125
- # move user name to front
126
- val = vals[3]
127
- vals[3] = vals[2]
128
- vals[2] = vals[1]
129
- vals[1] = vals[0]
130
- vals[0] = val
131
- self.pglog(' '.join(vals), self.LOGWRN)
132
-
96
+
133
97
  # get a snapshot of a PBS batch process status
134
98
  def pbs_snapshot(self):
135
99
  qopts = ''
@@ -138,7 +102,7 @@ class RdaPs(PgFile):
138
102
  if self.RDAPS['p']:
139
103
  if qopts: qopts += ' '
140
104
  qopts += str(self.RDAPS['p'])
141
- if not qopts: qopts = 'rda'
105
+ if not qopts: qopts = 'gdex'
142
106
  stat = self.get_pbs_info(qopts, 1, self.LOGWRN)
143
107
  if not stat:
144
108
  if self.PGLOG['SYSERR']: self.pglog(self.PGLOG['SYSERR'], self.LGEREX)
@@ -7,7 +7,7 @@
7
7
  - Option -a, application name of the process;
8
8
 
9
9
  - Option -h, hostname the process is on; omit it for local process,
10
- but it is mandatory if the process id is a SLURM/PBS bactch id.
10
+ but it is mandatory if the process id is a PBS bactch id.
11
11
 
12
12
  - Option -p, the local process or batch job id to be checked;
13
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_miscs
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: RDA Python package to hold RDA miscellaneous utility programs
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-miscs