rda-python-miscs 3.0.1__py3-none-any.whl → 3.0.2__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.
- rda_python_miscs/{rdacp.py → gdexcp.py} +13 -13
- rda_python_miscs/{rdacp.usg → gdexcp.usg} +8 -8
- rda_python_miscs/{rdakill.py → gdexkill.py} +10 -10
- rda_python_miscs/{rdakill.usg → gdexkill.usg} +9 -9
- rda_python_miscs/{rdamod.py → gdexmod.py} +16 -16
- rda_python_miscs/{rdamod.usg → gdexmod.usg} +13 -13
- rda_python_miscs/{rdaown.py → gdexown.py} +19 -19
- rda_python_miscs/{rdaown.usg → gdexown.usg} +12 -12
- rda_python_miscs/{rdaps.py → gdexps.py} +8 -8
- rda_python_miscs/{rdaps.usg → gdexps.usg} +8 -8
- rda_python_miscs/{rdasub.py → gdexsub.py} +6 -6
- rda_python_miscs/{rdasub.usg → gdexsub.usg} +7 -7
- rda_python_miscs/{rdazip.py → gdexzip.py} +8 -8
- rda_python_miscs/{rdazip.usg → gdexzip.usg} +7 -7
- {rda_python_miscs-3.0.1.dist-info → rda_python_miscs-3.0.2.dist-info}/METADATA +9 -9
- {rda_python_miscs-3.0.1.dist-info → rda_python_miscs-3.0.2.dist-info}/RECORD +20 -20
- rda_python_miscs-3.0.2.dist-info/entry_points.txt +20 -0
- rda_python_miscs-3.0.1.dist-info/entry_points.txt +0 -20
- {rda_python_miscs-3.0.1.dist-info → rda_python_miscs-3.0.2.dist-info}/WHEEL +0 -0
- {rda_python_miscs-3.0.1.dist-info → rda_python_miscs-3.0.2.dist-info}/licenses/LICENSE +0 -0
- {rda_python_miscs-3.0.1.dist-info → rda_python_miscs-3.0.2.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
##################################################################################
|
|
3
|
-
# Title:
|
|
3
|
+
# Title: gdexcp
|
|
4
4
|
# Author: Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date: 10/24/2020
|
|
6
6
|
# 2025-03-10 transferred to package rda_python_miscs from
|
|
7
7
|
# https://github.com/NCAR/rda-utility-programs.git
|
|
8
|
-
# Purpose: copy files locally and remotely by '
|
|
8
|
+
# Purpose: copy files locally and remotely by 'gdexdata'
|
|
9
9
|
# Github: https://github.com/NCAR/rda-python-miscs.git
|
|
10
10
|
##################################################################################
|
|
11
11
|
import re
|
|
@@ -14,16 +14,16 @@ import sys
|
|
|
14
14
|
from os import path as op
|
|
15
15
|
from rda_python_common.pg_file import PgFile
|
|
16
16
|
|
|
17
|
-
class
|
|
18
|
-
"""Copy files and directories locally or between remote hosts via '
|
|
17
|
+
class GdexCp(PgFile):
|
|
18
|
+
"""Copy files and directories locally or between remote hosts via 'gdexdata'.
|
|
19
19
|
|
|
20
20
|
Supports local-to-local, local-to-remote, remote-to-local, and Object Store /
|
|
21
|
-
Globus transfers. Target files are owned by '
|
|
21
|
+
Globus transfers. Target files are owned by 'gdexdata' and created with
|
|
22
22
|
configurable permission modes. Recursive copying is controlled by -r / -R.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
def __init__(self):
|
|
26
|
-
"""Initialize
|
|
26
|
+
"""Initialize GdexCp with default copy options and runtime state."""
|
|
27
27
|
super().__init__()
|
|
28
28
|
self.RDACP = {
|
|
29
29
|
'fh': None, # from host name, default to localhost
|
|
@@ -64,8 +64,8 @@ class RdaCp(PgFile):
|
|
|
64
64
|
argv = sys.argv[1:]
|
|
65
65
|
self.set_suid(self.PGLOG['EUID'])
|
|
66
66
|
self.set_help_path(__file__)
|
|
67
|
-
self.PGLOG['LOGFILE'] = "
|
|
68
|
-
self.cmdlog("
|
|
67
|
+
self.PGLOG['LOGFILE'] = "gdexcp.log" # set different log file
|
|
68
|
+
self.cmdlog("gdexcp {} ({})".format(' '.join(argv), self.CINFO['curdir']))
|
|
69
69
|
defopt = option = 'f'
|
|
70
70
|
for arg in argv:
|
|
71
71
|
if re.match(r'-(h|-help)$', arg, re.I):
|
|
@@ -95,7 +95,7 @@ class RdaCp(PgFile):
|
|
|
95
95
|
elif option == 'fh':
|
|
96
96
|
self.CINFO['fhost'] = arg + '-'
|
|
97
97
|
option = defopt
|
|
98
|
-
if dohelp or not self.RDACP['f']: self.show_usage("
|
|
98
|
+
if dohelp or not self.RDACP['f']: self.show_usage("gdexcp")
|
|
99
99
|
|
|
100
100
|
# function to start actions
|
|
101
101
|
def start_actions(self):
|
|
@@ -106,7 +106,7 @@ class RdaCp(PgFile):
|
|
|
106
106
|
when specified, then calls copy_top_list. Logs a summary count on completion.
|
|
107
107
|
"""
|
|
108
108
|
self.dssdb_dbname()
|
|
109
|
-
self.validate_decs_group('
|
|
109
|
+
self.validate_decs_group('gdexcp', self.PGLOG['CURUID'], 1)
|
|
110
110
|
if not self.RDACP['R'] and self.RDACP['r']: self.RDACP['R'] = 1000
|
|
111
111
|
if not self.RDACP['t']:
|
|
112
112
|
self.CINFO['tpath'] = self.RDACP['t'] = "."
|
|
@@ -232,10 +232,10 @@ class RdaCp(PgFile):
|
|
|
232
232
|
|
|
233
233
|
# main function to execute this script
|
|
234
234
|
def main():
|
|
235
|
-
"""Entry point: instantiate
|
|
235
|
+
"""Entry point: instantiate GdexCp, parse arguments, run, and exit."""
|
|
236
236
|
from rda_python_setuid.setup_guide import show_setup_guide
|
|
237
|
-
object =
|
|
238
|
-
show_setup_guide(object, 'rda_python_miscs', ['
|
|
237
|
+
object = GdexCp()
|
|
238
|
+
show_setup_guide(object, 'rda_python_miscs', ['gdexcp', 'gdexkill', 'gdexmod'])
|
|
239
239
|
object.read_parameters()
|
|
240
240
|
object.start_actions()
|
|
241
241
|
object.pgexit(0)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
Copy files and directories to a target location. Source and target may each
|
|
3
3
|
reside on the local host, a remote host, an Object Store bucket, or a Globus
|
|
4
|
-
endpoint. Target files are owned by '
|
|
4
|
+
endpoint. Target files are owned by 'gdexdata' and created with configurable
|
|
5
5
|
permission modes.
|
|
6
6
|
|
|
7
|
-
Usage:
|
|
7
|
+
Usage: gdexcp [-f] FromDirectories/Files [-t ToDirectory/FileName] \
|
|
8
8
|
[-fh FromHostName] [-th ToHostName] \
|
|
9
9
|
[-fb FromBucket] [-tb ToBucket] \
|
|
10
10
|
[-fp FromGlobusEndpoint] [-tp ToGlobusEndpoint] \
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
default option, so paths may be given without the -f flag.
|
|
15
15
|
Shell wildcards are supported. Use './' or '*' to copy everything
|
|
16
16
|
in the current directory. Source paths must be readable by user
|
|
17
|
-
'
|
|
17
|
+
'gdexdata'; gdexcp will attempt to fix the mode if they are not;
|
|
18
18
|
|
|
19
19
|
- Option -t, target directory or file name. Defaults to '.' (current
|
|
20
20
|
directory). Multiple source files cannot be copied to a single
|
|
@@ -57,21 +57,21 @@
|
|
|
57
57
|
1. Copy all files and subdirectories under the current directory to a
|
|
58
58
|
remote host:
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
gdexcp -r -f * -t /PathTo/d277006/ -th castle
|
|
61
61
|
|
|
62
62
|
2. Copy the contents of a specific local directory to a remote location
|
|
63
63
|
(trailing '/' on source omits the directory entry itself):
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
gdexcp -r -f /PathTo/DirectoryName/ -t /PathTo/d277006/ -th castle
|
|
66
66
|
|
|
67
67
|
Without the trailing '/', DirectoryName itself is also copied:
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
gdexcp -r -f /PathTo/DirectoryName -t /PathTo/d277006/ -th castle
|
|
70
70
|
|
|
71
71
|
3. Copy a single file to an Object Store bucket:
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
gdexcp -f /PathTo/myfile.nc -tb my-bucket -t myfile.nc
|
|
74
74
|
|
|
75
75
|
4. Copy files from a remote host to the local current directory:
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
gdexcp -fh castle -f /PathTo/d277006/myfile.nc
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
##################################################################################
|
|
3
|
-
# Title:
|
|
3
|
+
# Title: gdexkill
|
|
4
4
|
# Author: Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date: 10/24/2020
|
|
6
6
|
# 2025-03-10 transferred to package rda_python_miscs from
|
|
7
7
|
# https://github.com/NCAR/rda-utility-programs.git
|
|
8
8
|
# Purpose: kill a local or batch process and its child processes for a given
|
|
9
|
-
# running process ID by '
|
|
9
|
+
# running process ID by 'gdexdata'
|
|
10
10
|
# Github: https://github.com/NCAR/rda-python-miscs.git
|
|
11
11
|
##################################################################################
|
|
12
12
|
import re
|
|
@@ -14,7 +14,7 @@ import sys
|
|
|
14
14
|
import time
|
|
15
15
|
from rda_python_common.pg_file import PgFile
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class GdexKill(PgFile):
|
|
18
18
|
"""Kill local processes or PBS batch jobs by process ID, parent PID, or status.
|
|
19
19
|
|
|
20
20
|
For local processes, sends SIGKILL (-9) to the matched process and all its
|
|
@@ -24,7 +24,7 @@ class RdaKill(PgFile):
|
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
def __init__(self):
|
|
27
|
-
"""Initialize
|
|
27
|
+
"""Initialize GdexKill with default kill options."""
|
|
28
28
|
super().__init__()
|
|
29
29
|
self.RDAKILL = {
|
|
30
30
|
'a': None, # application name
|
|
@@ -52,8 +52,8 @@ class RdaKill(PgFile):
|
|
|
52
52
|
self.dssdb_dbname()
|
|
53
53
|
self.set_suid(self.PGLOG['EUID'])
|
|
54
54
|
self.set_help_path(__file__)
|
|
55
|
-
self.PGLOG['LOGFILE'] = "
|
|
56
|
-
self.cmdlog("
|
|
55
|
+
self.PGLOG['LOGFILE'] = "gdexkill.log" # set different log file
|
|
56
|
+
self.cmdlog("gdexkill {}".format(' '.join(argv)))
|
|
57
57
|
for arg in argv:
|
|
58
58
|
ms = re.match(r'-([ahpPqsu])$', arg)
|
|
59
59
|
if ms:
|
|
@@ -79,7 +79,7 @@ class RdaKill(PgFile):
|
|
|
79
79
|
optcnt += 1
|
|
80
80
|
else:
|
|
81
81
|
self.pglog(arg + ": pass in value without Option", self.LGEREX)
|
|
82
|
-
if not optcnt: self.show_usage("
|
|
82
|
+
if not optcnt: self.show_usage("gdexkill")
|
|
83
83
|
|
|
84
84
|
# function to start actions
|
|
85
85
|
def start_actions(self):
|
|
@@ -257,10 +257,10 @@ class RdaKill(PgFile):
|
|
|
257
257
|
|
|
258
258
|
# main function to execute this script
|
|
259
259
|
def main():
|
|
260
|
-
"""Entry point: instantiate
|
|
260
|
+
"""Entry point: instantiate GdexKill, parse arguments, run, and exit."""
|
|
261
261
|
from rda_python_setuid.setup_guide import show_setup_guide
|
|
262
|
-
object =
|
|
263
|
-
show_setup_guide(object, 'rda_python_miscs', ['
|
|
262
|
+
object = GdexKill()
|
|
263
|
+
show_setup_guide(object, 'rda_python_miscs', ['gdexcp', 'gdexkill', 'gdexmod'])
|
|
264
264
|
object.read_parameters()
|
|
265
265
|
object.start_actions()
|
|
266
266
|
object.pgexit(0)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
other filter criteria; or cancel one or more PBS batch jobs by job ID or by
|
|
4
4
|
job status. For PBS operations the -h option must specify the PBS node name.
|
|
5
5
|
|
|
6
|
-
Usage:
|
|
6
|
+
Usage: gdexkill [-h HostName] [-p ProcessID] [-P ParentProcessID] \
|
|
7
7
|
[-s BatchStatus] [-q BatchQueue] [-r] \
|
|
8
8
|
[-u ProcessOwner] [-a ApplicationName]
|
|
9
9
|
|
|
@@ -36,31 +36,31 @@
|
|
|
36
36
|
Without this option all users are included;
|
|
37
37
|
|
|
38
38
|
For local processes, all child processes are also terminated recursively.
|
|
39
|
-
Usage is displayed if
|
|
39
|
+
Usage is displayed if gdexkill is run without any options or arguments.
|
|
40
40
|
|
|
41
41
|
Examples:
|
|
42
42
|
|
|
43
43
|
1. Kill a local process by PID:
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
gdexkill -p 13199
|
|
46
|
+
gdexkill 13199
|
|
47
47
|
|
|
48
48
|
2. Kill a local process by PID and verify it matches a specific application:
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
gdexkill -p 13199 -a dsrqst
|
|
51
51
|
|
|
52
52
|
3. Kill all local processes (and their children) owned by a user:
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
gdexkill -u zji -a dsrqst
|
|
55
55
|
|
|
56
56
|
4. Kill a PBS batch job by job ID:
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
gdexkill -h casper-pbs -p 334323
|
|
59
59
|
|
|
60
60
|
5. Kill all running PBS batch jobs for a user in the default queue:
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
gdexkill -h casper-pbs -s RUN -u zji
|
|
63
63
|
|
|
64
64
|
6. Kill all pending PBS batch jobs in a specific queue:
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
gdexkill -h casper-pbs -s PEND -q gdex
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
##################################################################################
|
|
3
|
-
# Title:
|
|
3
|
+
# Title: gdexmod
|
|
4
4
|
# Author: Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date: 10/24/2020
|
|
6
6
|
# 2025-03-10 transferred to package rda_python_miscs from
|
|
7
7
|
# https://github.com/NCAR/rda-utility-programs.git
|
|
8
8
|
# Purpose: change file/directory modes in given one or multiple local directories
|
|
9
|
-
# owned by '
|
|
9
|
+
# owned by 'gdexdata'
|
|
10
10
|
# Github: https://github.com/NCAR/rda-python-miscs.git
|
|
11
11
|
##################################################################################
|
|
12
12
|
import re
|
|
@@ -15,17 +15,17 @@ import sys
|
|
|
15
15
|
from os import path as op
|
|
16
16
|
from rda_python_common.pg_file import PgFile
|
|
17
17
|
|
|
18
|
-
class
|
|
19
|
-
"""Change file and directory permission modes for paths owned by '
|
|
18
|
+
class GdexMod(PgFile):
|
|
19
|
+
"""Change file and directory permission modes for paths owned by 'gdexdata'.
|
|
20
20
|
|
|
21
|
-
Only items owned by '
|
|
21
|
+
Only items owned by 'gdexdata' are changed; items with a different owner are
|
|
22
22
|
logged as errors. Items already at the target mode are silently skipped.
|
|
23
23
|
A leading letter ('D' or 'F') is logged with each changed path to indicate
|
|
24
24
|
its type.
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
def __init__(self):
|
|
28
|
-
"""Initialize
|
|
28
|
+
"""Initialize GdexMod with default mode-change options and runtime state."""
|
|
29
29
|
super().__init__()
|
|
30
30
|
self.RDAMOD = {
|
|
31
31
|
'd': 0, # 1 to change directory mode
|
|
@@ -55,9 +55,9 @@ class RdaMod(PgFile):
|
|
|
55
55
|
"""
|
|
56
56
|
self.set_suid(self.PGLOG['EUID'])
|
|
57
57
|
self.set_help_path(__file__)
|
|
58
|
-
self.PGLOG['LOGFILE'] = "
|
|
58
|
+
self.PGLOG['LOGFILE'] = "gdexmod.log" # set different log file
|
|
59
59
|
argv = sys.argv[1:]
|
|
60
|
-
self.cmdlog("
|
|
60
|
+
self.cmdlog("gdexmod {} ({})".format(' '.join(argv), self.MINFO['curdir']))
|
|
61
61
|
option = defopt = 'l'
|
|
62
62
|
for arg in argv:
|
|
63
63
|
ms = re.match(r'-(\w)$', arg)
|
|
@@ -80,7 +80,7 @@ class RdaMod(PgFile):
|
|
|
80
80
|
else:
|
|
81
81
|
self.RDAMOD[option] = arg
|
|
82
82
|
option = defopt
|
|
83
|
-
if self.RDAMOD['h'] or not self.MINFO['files']: self.show_usage("
|
|
83
|
+
if self.RDAMOD['h'] or not self.MINFO['files']: self.show_usage("gdexmod")
|
|
84
84
|
|
|
85
85
|
# function to start actions
|
|
86
86
|
def start_actions(self):
|
|
@@ -89,7 +89,7 @@ class RdaMod(PgFile):
|
|
|
89
89
|
if not (self.RDAMOD['d'] or self.RDAMOD['f']):
|
|
90
90
|
self.RDAMOD['d'] = self.RDAMOD['f'] = 1 # both directories and files as default
|
|
91
91
|
if not self.RDAMOD['R'] and self.RDAMOD['r']: self.RDAMOD['R'] = 1000
|
|
92
|
-
self.validate_decs_group('
|
|
92
|
+
self.validate_decs_group('gdexmod', self.PGLOG['CURUID'], 1)
|
|
93
93
|
self.change_top_list(self.MINFO['files'])
|
|
94
94
|
if (self.MINFO['dcnt'] + self.MINFO['fcnt']) > 1:
|
|
95
95
|
msg = ''
|
|
@@ -159,7 +159,7 @@ class RdaMod(PgFile):
|
|
|
159
159
|
"""Change the permission mode of one file or directory.
|
|
160
160
|
|
|
161
161
|
Skips the item if the -f/-d flag for its type is not set, if it is not
|
|
162
|
-
owned by '
|
|
162
|
+
owned by 'gdexdata', or if its current mode already matches the target.
|
|
163
163
|
Logs the old-to-new mode transition on success or an error on owner mismatch.
|
|
164
164
|
Updates MINFO['fcnt'] for files and MINFO['dcnt'] for directories on success.
|
|
165
165
|
|
|
@@ -180,8 +180,8 @@ class RdaMod(PgFile):
|
|
|
180
180
|
if not self.RDAMOD['d']: return 0
|
|
181
181
|
fname = "D" + fname
|
|
182
182
|
mode = self.RDAMOD['D']
|
|
183
|
-
if info['logname'] != "
|
|
184
|
-
return self.pglog("{}: owner {} not
|
|
183
|
+
if info['logname'] != "gdexdata":
|
|
184
|
+
return self.pglog("{}: owner {} not gdexdata".format(fname, info['logname']), self.LOGERR)
|
|
185
185
|
if info['mode'] == mode: return 0 # no need change mode
|
|
186
186
|
if self.set_local_mode(file, info['isfile'], mode, info['mode'], info['logname'], self.LOGWRN):
|
|
187
187
|
if info['isfile']:
|
|
@@ -193,10 +193,10 @@ class RdaMod(PgFile):
|
|
|
193
193
|
|
|
194
194
|
# main function to execute this script
|
|
195
195
|
def main():
|
|
196
|
-
"""Entry point: instantiate
|
|
196
|
+
"""Entry point: instantiate GdexMod, parse arguments, run, and exit."""
|
|
197
197
|
from rda_python_setuid.setup_guide import show_setup_guide
|
|
198
|
-
object =
|
|
199
|
-
show_setup_guide(object, 'rda_python_miscs', ['
|
|
198
|
+
object = GdexMod()
|
|
199
|
+
show_setup_guide(object, 'rda_python_miscs', ['gdexcp', 'gdexkill', 'gdexmod'])
|
|
200
200
|
object.read_parameters()
|
|
201
201
|
object.start_actions()
|
|
202
202
|
object.pgexit(0)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
Change permission modes for files and directories owned by '
|
|
3
|
-
items owned by '
|
|
2
|
+
Change permission modes for files and directories owned by 'gdexdata'. Only
|
|
3
|
+
items owned by 'gdexdata' are changed; items with a different owner are logged
|
|
4
4
|
as errors. Items already at the target mode are silently skipped. A leading
|
|
5
5
|
letter is displayed in front of each changed path to indicate its type: 'D'
|
|
6
6
|
for a directory and 'F' for a file.
|
|
7
7
|
|
|
8
|
-
Usage:
|
|
8
|
+
Usage: gdexmod [-d] [-f] [-D DirectoryMode] [-F FileMode] [-h] [-r] \
|
|
9
9
|
[-R RecursiveLevel] Directory/File List
|
|
10
10
|
|
|
11
11
|
- Option -d, change directory modes only. Both directories and files are
|
|
@@ -33,39 +33,39 @@
|
|
|
33
33
|
in the current directory.
|
|
34
34
|
|
|
35
35
|
This utility can be run from any directory. No mode is changed if all
|
|
36
|
-
matched items are already at the target mode or if none are owned by '
|
|
36
|
+
matched items are already at the target mode or if none are owned by 'gdexdata'.
|
|
37
37
|
|
|
38
38
|
Examples:
|
|
39
39
|
|
|
40
40
|
1. Change into the dataset home directory and change modes of all
|
|
41
41
|
immediate contents:
|
|
42
42
|
|
|
43
|
-
cd /PathTo/
|
|
44
|
-
|
|
43
|
+
cd /PathTo/d277006
|
|
44
|
+
gdexmod ./
|
|
45
45
|
|
|
46
46
|
Add -r to recurse into sub-directories:
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
gdexmod -r ./
|
|
49
49
|
|
|
50
50
|
2. Pass an absolute path with a trailing '/' to process the directory's
|
|
51
51
|
contents (the directory entry itself is not changed):
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
gdexmod /PathTo/d277006/
|
|
54
54
|
|
|
55
55
|
Without the trailing '/', the directory entry itself is also changed
|
|
56
56
|
unless -r or -R is given:
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
gdexmod /PathTo/d277006
|
|
59
59
|
|
|
60
60
|
3. Use a relative path from a neighbouring directory:
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
gdexmod ../d277006/
|
|
63
|
+
gdexmod ../d277006/*
|
|
64
64
|
|
|
65
65
|
4. Change file modes only, with a non-default target mode:
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
gdexmod -f -F 660 -r /PathTo/d277006/
|
|
68
68
|
|
|
69
69
|
5. Change directory modes only, recursively:
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
gdexmod -d -r /PathTo/d277006/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
##################################################################################
|
|
3
|
-
# Title:
|
|
3
|
+
# Title: gdexown
|
|
4
4
|
# Author: Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date: 10/24/2020
|
|
6
6
|
# 2025-03-10 transferred to package rda_python_miscs from
|
|
7
7
|
# https://github.com/NCAR/rda-utility-programs.git
|
|
8
|
-
# Purpose: change file/directory ownership to '
|
|
8
|
+
# Purpose: change file/directory ownership to 'gdexdata' in given one or multiple
|
|
9
9
|
# local directories that are owned by decs specialists. it needs
|
|
10
10
|
# super user privilege to execute.
|
|
11
11
|
# Github: https://github.com/NCAR/rda-python-miscs.git
|
|
@@ -17,16 +17,16 @@ import glob
|
|
|
17
17
|
from os import path as op
|
|
18
18
|
from rda_python_common.pg_file import PgFile
|
|
19
19
|
|
|
20
|
-
class
|
|
21
|
-
"""Change file and directory ownership to '
|
|
20
|
+
class GdexOwn(PgFile):
|
|
21
|
+
"""Change file and directory ownership to 'gdexdata' for a given path list.
|
|
22
22
|
|
|
23
23
|
Must be run as root. Only items currently owned by DECS specialists are
|
|
24
|
-
changed; items already owned by '
|
|
24
|
+
changed; items already owned by 'gdexdata' are silently skipped. A leading
|
|
25
25
|
letter ('D' or 'F') is logged with each changed path to indicate its type.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
def __init__(self):
|
|
29
|
-
"""Initialize
|
|
29
|
+
"""Initialize GdexOwn with default ownership-change options and runtime state."""
|
|
30
30
|
super().__init__()
|
|
31
31
|
self.RDAOWN = {
|
|
32
32
|
'd': 0, # 1 to change directory owner
|
|
@@ -56,8 +56,8 @@ class RdaOwn(PgFile):
|
|
|
56
56
|
"""
|
|
57
57
|
argv = sys.argv[1:]
|
|
58
58
|
self.set_help_path(__file__)
|
|
59
|
-
self.PGLOG['LOGFILE'] = "
|
|
60
|
-
self.cmdlog("
|
|
59
|
+
self.PGLOG['LOGFILE'] = "gdexown.log" # set different log file
|
|
60
|
+
self.cmdlog("gdexown {} ({})".format(' '.join(argv), self.OINFO['curdir']))
|
|
61
61
|
option = defopt = 'l'
|
|
62
62
|
for arg in argv:
|
|
63
63
|
ms = re.match(r'-(\w+)$', arg)
|
|
@@ -75,9 +75,9 @@ class RdaOwn(PgFile):
|
|
|
75
75
|
else:
|
|
76
76
|
self.OINFO['files'].append(arg)
|
|
77
77
|
defopt = None
|
|
78
|
-
if self.RDAOWN['h'] or not self.OINFO['files']: self.show_usage("
|
|
78
|
+
if self.RDAOWN['h'] or not self.OINFO['files']: self.show_usage("gdexown")
|
|
79
79
|
if self.PGLOG['CURUID'] != "root":
|
|
80
|
-
self.pglog(self.PGLOG['CURUID'] + ": you must execute '
|
|
80
|
+
self.pglog(self.PGLOG['CURUID'] + ": you must execute 'gdexown' as 'root'!", self.LGEREX)
|
|
81
81
|
if not (self.RDAOWN['d'] or self.RDAOWN['f']):
|
|
82
82
|
self.RDAOWN['d'] = self.RDAOWN['f'] = 1 # list both directories and files as default
|
|
83
83
|
if not self.RDAOWN['R'] and self.RDAOWN['r']: self.RDAOWN['R'] = 1000
|
|
@@ -152,11 +152,11 @@ class RdaOwn(PgFile):
|
|
|
152
152
|
|
|
153
153
|
# change owner for a single file or directory
|
|
154
154
|
def change_owner(self, file, info):
|
|
155
|
-
"""Change ownership of one file or directory to '
|
|
155
|
+
"""Change ownership of one file or directory to 'gdexdata' using chown.
|
|
156
156
|
|
|
157
|
-
Skips the item if it is already owned by '
|
|
157
|
+
Skips the item if it is already owned by 'gdexdata' or if the current owner
|
|
158
158
|
is not a registered DECS specialist in the dssgrp table. Logs the result
|
|
159
|
-
as 'owner =>
|
|
159
|
+
as 'owner => gdexdata' on success or an error message on failure. Updates
|
|
160
160
|
OINFO['fcnt'] for files and OINFO['dcnt'] for directories on success.
|
|
161
161
|
|
|
162
162
|
Args:
|
|
@@ -174,23 +174,23 @@ class RdaOwn(PgFile):
|
|
|
174
174
|
else:
|
|
175
175
|
if not self.RDAOWN['d']: return 0
|
|
176
176
|
fname = "D" + fname
|
|
177
|
-
if info['logname'] == "
|
|
177
|
+
if info['logname'] == "gdexdata": return 0
|
|
178
178
|
if not self.pgget("dssgrp", "", "logname = '{}'".format(info['logname']), self.LGEREX):
|
|
179
179
|
return self.pglog("{}: owner {} not a DECS Specialist!".format(fname, info['logname']), self.LOGERR)
|
|
180
|
-
if self.pgsystem("su root -c 'chown
|
|
181
|
-
self.pglog("{}: {} =>
|
|
180
|
+
if self.pgsystem("su root -c 'chown gdexdata {}'".format(file), self.LOGWRN, 4):
|
|
181
|
+
self.pglog("{}: {} => gdexdata".format(fname, info['logname']), self.LOGWRN)
|
|
182
182
|
if info['isfile']:
|
|
183
183
|
self.OINFO['fcnt'] += 1
|
|
184
184
|
return 1
|
|
185
185
|
else:
|
|
186
186
|
self.OINFO['dcnt'] += 1
|
|
187
187
|
return 0
|
|
188
|
-
return self.pglog("{}: Error change owner {} to
|
|
188
|
+
return self.pglog("{}: Error change owner {} to gdexdata".format(fname, info['logname']), self.LOGERR)
|
|
189
189
|
|
|
190
190
|
# main function to execute this script
|
|
191
191
|
def main():
|
|
192
|
-
"""Entry point: instantiate
|
|
193
|
-
object =
|
|
192
|
+
"""Entry point: instantiate GdexOwn, parse arguments, run, and exit."""
|
|
193
|
+
object = GdexOwn()
|
|
194
194
|
object.read_parameters()
|
|
195
195
|
object.start_actions()
|
|
196
196
|
object.pgexit(0)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
Change ownership of files and directories to '
|
|
2
|
+
Change ownership of files and directories to 'gdexdata'. Must be run as root.
|
|
3
3
|
Only items currently owned by DECS specialists are changed; items already owned
|
|
4
|
-
by '
|
|
4
|
+
by 'gdexdata' or owned by non-specialists are skipped. A leading letter is
|
|
5
5
|
displayed in front of each changed path to indicate its type: 'D' for a
|
|
6
6
|
directory and 'F' for a file.
|
|
7
7
|
|
|
8
|
-
Usage:
|
|
8
|
+
Usage: gdexown [-d] [-f] [-h] [-r] [-R RecursiveLevel] Directory/File List
|
|
9
9
|
|
|
10
10
|
- Option -d, change directory ownership only. Both directories and files
|
|
11
11
|
are processed by default; this option suppresses file ownership changes;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
in the current directory.
|
|
26
26
|
|
|
27
27
|
This utility can be run from any directory. No ownership is changed if all
|
|
28
|
-
matched items are already owned by '
|
|
28
|
+
matched items are already owned by 'gdexdata' or if none of their current owners
|
|
29
29
|
are registered DECS specialists.
|
|
30
30
|
|
|
31
31
|
Examples:
|
|
@@ -33,28 +33,28 @@
|
|
|
33
33
|
1. Change into the dataset home directory and change ownership of all
|
|
34
34
|
immediate contents:
|
|
35
35
|
|
|
36
|
-
cd /PathTo/
|
|
37
|
-
|
|
36
|
+
cd /PathTo/d277006
|
|
37
|
+
gdexown ./
|
|
38
38
|
|
|
39
39
|
Add -r to recurse into sub-directories:
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
gdexown -r ./
|
|
42
42
|
|
|
43
43
|
2. Pass an absolute path with a trailing '/' to process the directory's
|
|
44
44
|
contents (the directory entry itself is not changed):
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
gdexown /PathTo/d277006/
|
|
47
47
|
|
|
48
48
|
Without the trailing '/', the directory entry itself is also changed
|
|
49
49
|
unless -r or -R is given:
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
gdexown /PathTo/d277006
|
|
52
52
|
|
|
53
53
|
3. Use a relative path from a neighbouring directory:
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
gdexown ../d277006/
|
|
56
|
+
gdexown ../d277006/*
|
|
57
57
|
|
|
58
58
|
4. Change ownership of files only, recursively:
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
gdexown -f -r /PathTo/d277006/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
##################################################################################
|
|
3
|
-
# Title:
|
|
3
|
+
# Title: gdexps
|
|
4
4
|
# Author: Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date: 10/24/2020
|
|
6
6
|
# 2025-03-10 transferred to package rda_python_miscs from
|
|
@@ -13,7 +13,7 @@ import os
|
|
|
13
13
|
import sys
|
|
14
14
|
from rda_python_common.pg_file import PgFile
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class GdexPs(PgFile):
|
|
17
17
|
"""Show process status for local or PBS batch processes on any accessible host.
|
|
18
18
|
|
|
19
19
|
Wraps the system 'ps' command for local processes and 'qstat' for PBS batch
|
|
@@ -22,7 +22,7 @@ class RdaPs(PgFile):
|
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
24
|
def __init__(self):
|
|
25
|
-
"""Initialize
|
|
25
|
+
"""Initialize GdexPs with default process query options."""
|
|
26
26
|
super().__init__()
|
|
27
27
|
self.RDAPS = {
|
|
28
28
|
'a' : None, # application name
|
|
@@ -44,8 +44,8 @@ class RdaPs(PgFile):
|
|
|
44
44
|
argv = sys.argv[1:]
|
|
45
45
|
self.set_suid(self.PGLOG['EUID'])
|
|
46
46
|
self.set_help_path(__file__)
|
|
47
|
-
self.PGLOG['LOGFILE'] = "
|
|
48
|
-
self.cmdlog("
|
|
47
|
+
self.PGLOG['LOGFILE'] = "gdexps.log" # set different log file
|
|
48
|
+
self.cmdlog("gdexps {}".format(' '.join(argv)))
|
|
49
49
|
for arg in argv:
|
|
50
50
|
ms = re.match(r'-([ahpPu])$', arg)
|
|
51
51
|
if ms:
|
|
@@ -69,7 +69,7 @@ class RdaPs(PgFile):
|
|
|
69
69
|
optcnt += 1
|
|
70
70
|
else:
|
|
71
71
|
self.pglog(arg + ": Value passed in without Option", self.LGEREX)
|
|
72
|
-
if not optcnt: self.show_usage("
|
|
72
|
+
if not optcnt: self.show_usage("gdexps")
|
|
73
73
|
|
|
74
74
|
# function to start actions
|
|
75
75
|
def start_actions(self):
|
|
@@ -159,8 +159,8 @@ class RdaPs(PgFile):
|
|
|
159
159
|
|
|
160
160
|
# main function to execute this script
|
|
161
161
|
def main():
|
|
162
|
-
"""Entry point: instantiate
|
|
163
|
-
object =
|
|
162
|
+
"""Entry point: instantiate GdexPs, parse arguments, run, and exit."""
|
|
163
|
+
object = GdexPs()
|
|
164
164
|
object.read_parameters()
|
|
165
165
|
object.start_actions()
|
|
166
166
|
object.pgexit(0)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
a hostname, 'ps' is run on the local machine. When the hostname matches the
|
|
5
5
|
PBS node name, 'qstat' is used instead.
|
|
6
6
|
|
|
7
|
-
Usage:
|
|
7
|
+
Usage: gdexps [-h HostName] [-p ProcessID] [-P ParentProcessID] \
|
|
8
8
|
[-u ProcessOwner] [-a ApplicationName]
|
|
9
9
|
|
|
10
10
|
- Option -a, filter results by application (command) name. For local
|
|
@@ -31,25 +31,25 @@
|
|
|
31
31
|
|
|
32
32
|
1. Check a local process by PID (with or without the -p flag):
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
gdexps -p 13199
|
|
35
|
+
gdexps 13199
|
|
36
36
|
|
|
37
37
|
2. Filter by PID and application name on the local host:
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
gdexps -p 13199 -a dsrqst
|
|
40
40
|
|
|
41
41
|
3. List all local processes owned by a specific user:
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
gdexps -u zji
|
|
44
44
|
|
|
45
45
|
4. Query a PBS batch job by job ID:
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
gdexps -h casper-pbs -p 334323
|
|
48
48
|
|
|
49
49
|
5. List all PBS batch jobs for a user:
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
gdexps -h casper-pbs -u zji
|
|
52
52
|
|
|
53
53
|
6. List all PBS batch jobs for a user filtered by job name:
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
gdexps -h casper-pbs -u zji -a dsrqst
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
##################################################################################
|
|
3
|
-
# Title:
|
|
3
|
+
# Title: gdexsub
|
|
4
4
|
# Author: Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date: 03/31/2021
|
|
6
6
|
# 2025-03-10 transferred to package rda_python_miscs from
|
|
@@ -15,7 +15,7 @@ import re
|
|
|
15
15
|
import time
|
|
16
16
|
from rda_python_common.pg_file import PgFile
|
|
17
17
|
|
|
18
|
-
class
|
|
18
|
+
class GdexSub(PgFile):
|
|
19
19
|
"""Submit a command as a nohup background process on the local machine.
|
|
20
20
|
|
|
21
21
|
Wraps the command in 'nohup ... > /dev/null 2>&1 &' and logs the resulting
|
|
@@ -24,7 +24,7 @@ class RdaSub(PgFile):
|
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
def __init__(self):
|
|
27
|
-
"""Initialize
|
|
27
|
+
"""Initialize GdexSub with empty customized options and argument string."""
|
|
28
28
|
super().__init__()
|
|
29
29
|
self.coptions = {'cmd': None, 'cwd': None, 'env': None} # cmd: command to run,
|
|
30
30
|
# cwd: working directory,
|
|
@@ -41,7 +41,7 @@ class RdaSub(PgFile):
|
|
|
41
41
|
arguments are given; errors if -cmd is not provided. Arguments containing
|
|
42
42
|
spaces are automatically quoted.
|
|
43
43
|
"""
|
|
44
|
-
aname = '
|
|
44
|
+
aname = 'gdexsub'
|
|
45
45
|
self.set_help_path(__file__)
|
|
46
46
|
copts = '|'.join(self.coptions)
|
|
47
47
|
option = None
|
|
@@ -139,8 +139,8 @@ class RdaSub(PgFile):
|
|
|
139
139
|
|
|
140
140
|
# main function to execute this script
|
|
141
141
|
def main():
|
|
142
|
-
"""Entry point: instantiate
|
|
143
|
-
object =
|
|
142
|
+
"""Entry point: instantiate GdexSub, parse arguments, run, and exit."""
|
|
143
|
+
object = GdexSub()
|
|
144
144
|
object.read_parameters()
|
|
145
145
|
object.start_actions()
|
|
146
146
|
object.pgexit(0)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
running after the shell exits and all output is discarded. The PID of the
|
|
5
5
|
submitted job is logged once the process is detected.
|
|
6
6
|
|
|
7
|
-
Usage:
|
|
7
|
+
Usage: gdexsub [-cwd WorkDir] [-env EnvironmentPairs] [-b] -cmd Command [cmd-options]
|
|
8
8
|
|
|
9
9
|
- Option -cmd, (mandatory) command to run in the background. Must be an
|
|
10
10
|
executable reachable via PATH or given as an absolute path. All
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
- Option -env, environment variable name/value pairs to set before the
|
|
19
19
|
command runs, separated by ',', e.g. -env KEY1=val1,KEY2=val2;
|
|
20
20
|
|
|
21
|
-
- Option -b, submit
|
|
21
|
+
- Option -b, submit gdexsub itself to the background first, then launch
|
|
22
22
|
the command;
|
|
23
23
|
|
|
24
24
|
- cmd-options, any options and arguments to pass to the command. Place
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
|
|
31
31
|
1. Run a script in the background from the current directory:
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
gdexsub -cmd /path/to/myscript.sh
|
|
34
34
|
|
|
35
35
|
2. Run a command with arguments in the background:
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
gdexsub -cmd dsrqst d277006 SP -RI 750748 -b -d
|
|
38
38
|
|
|
39
39
|
3. Run a command in a specific working directory:
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
gdexsub -cwd /glade/work/zji/jobs -cmd ./process.sh -input data.nc
|
|
42
42
|
|
|
43
43
|
4. Run a command with environment variables set:
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
gdexsub -env LANG=en_US,TZ=UTC -cmd /path/to/myscript.sh
|
|
46
46
|
|
|
47
47
|
5. Run a Python module entry point in the background:
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
gdexsub -cwd /glade/work/zji -cmd python myscript.py --config cfg.yaml
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
##################################################################################
|
|
3
|
-
# Title:
|
|
3
|
+
# Title: gdexzip
|
|
4
4
|
# Author: Zaihua Ji, zji@ucar.edu
|
|
5
5
|
# Date: 10/24/2020
|
|
6
6
|
# 2025-03-17 transferred to package rda_python_miscs from
|
|
@@ -14,7 +14,7 @@ import os
|
|
|
14
14
|
import sys
|
|
15
15
|
from rda_python_common.pg_file import PgFile
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class GdexZip(PgFile):
|
|
18
18
|
"""Compress or uncompress files using a supported format (gz, Z, bz2, zip).
|
|
19
19
|
|
|
20
20
|
When a target format is specified via -f, files are compressed to that format.
|
|
@@ -23,7 +23,7 @@ class RdaZip(PgFile):
|
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
def __init__(self):
|
|
26
|
-
"""Initialize
|
|
26
|
+
"""Initialize GdexZip with default action (uncompress), no format, and empty file list."""
|
|
27
27
|
super().__init__()
|
|
28
28
|
self.action = 0 # 0 - uncompress, 1 - compress to self.format
|
|
29
29
|
self.format = None # target compression format (gz, Z, bz2, zip)
|
|
@@ -40,8 +40,8 @@ class RdaZip(PgFile):
|
|
|
40
40
|
"""
|
|
41
41
|
argv = sys.argv[1:]
|
|
42
42
|
self.set_help_path(__file__)
|
|
43
|
-
self.PGLOG['LOGFILE'] = "
|
|
44
|
-
self.cmdlog("
|
|
43
|
+
self.PGLOG['LOGFILE'] = "gdexzip.log" # set different log file
|
|
44
|
+
self.cmdlog("gdexzip {}".format(' '.join(argv)))
|
|
45
45
|
option = None
|
|
46
46
|
for arg in argv:
|
|
47
47
|
ms = re.match(r'-(\w+)$', arg)
|
|
@@ -61,7 +61,7 @@ class RdaZip(PgFile):
|
|
|
61
61
|
else:
|
|
62
62
|
if not os.path.isfile(arg): self.pglog(arg + ": file not exists", self.LGEREX)
|
|
63
63
|
self.files.append(arg)
|
|
64
|
-
if not self.files: self.show_usage("
|
|
64
|
+
if not self.files: self.show_usage("gdexzip")
|
|
65
65
|
|
|
66
66
|
# function to start actions
|
|
67
67
|
def start_actions(self):
|
|
@@ -72,8 +72,8 @@ class RdaZip(PgFile):
|
|
|
72
72
|
|
|
73
73
|
# main function to execute this script
|
|
74
74
|
def main():
|
|
75
|
-
"""Entry point: instantiate
|
|
76
|
-
object =
|
|
75
|
+
"""Entry point: instantiate GdexZip, parse arguments, run, and exit."""
|
|
76
|
+
object = GdexZip()
|
|
77
77
|
object.read_parameters()
|
|
78
78
|
object.start_actions()
|
|
79
79
|
object.pgexit(0)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Supported formats: gz, Z, bz2, zip
|
|
8
8
|
|
|
9
|
-
Usage:
|
|
9
|
+
Usage: gdexzip [-f CompressFormat] [-b] FileList
|
|
10
10
|
|
|
11
11
|
- Option -f, target compression format. Providing this option selects
|
|
12
12
|
compress mode; omitting it selects uncompress mode. Supported values:
|
|
@@ -28,29 +28,29 @@
|
|
|
28
28
|
|
|
29
29
|
1. Compress a file with gzip:
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
gdexzip -f gz testfile.txt
|
|
32
32
|
# result: testfile.txt => testfile.txt.gz
|
|
33
33
|
|
|
34
34
|
2. Uncompress a gzip file (format detected from extension):
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
gdexzip testfile.txt.gz
|
|
37
37
|
# result: testfile.txt.gz => testfile.txt
|
|
38
38
|
|
|
39
39
|
3. Compress a file with bzip2:
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
gdexzip -f bz2 testfile.txt
|
|
42
42
|
# result: testfile.txt => testfile.txt.bz2
|
|
43
43
|
|
|
44
44
|
4. Uncompress a bzip2 file:
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
gdexzip testfile.txt.bz2
|
|
47
47
|
# result: testfile.txt.bz2 => testfile.txt
|
|
48
48
|
|
|
49
49
|
5. Convert from compress (.Z) format to gzip (.gz):
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
gdexzip -f gz testfile.txt.Z
|
|
52
52
|
# result: testfile.txt.Z => testfile.txt.gz
|
|
53
53
|
|
|
54
54
|
6. Compress multiple files with gzip in the background:
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
gdexzip -b -f gz file1.txt file2.txt file3.txt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_miscs
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.2
|
|
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
|
|
@@ -30,21 +30,21 @@ The package provides two categories of programs:
|
|
|
30
30
|
|---------|-------|-------------|
|
|
31
31
|
| `bashqsub` | | Submit a job as a bash batch job on a PBS node via qsub |
|
|
32
32
|
| `tcshqsub` | | Submit a job as a tcsh batch job on a PBS node via qsub |
|
|
33
|
-
| `
|
|
33
|
+
| `gdexsub` | `rdasub` | Submit a command as a nohup background process on the local machine |
|
|
34
34
|
| `pgwget` | | Download remote files by root name pattern, combining downloaded parts into a single file |
|
|
35
35
|
| `gdexls` | | List local files and directories with matching metadata from the GDEX database |
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
36
|
+
| `gdexps` | `rdaps` | Show process status for local or PBS batch processes, with filtering by PID, owner, or name |
|
|
37
|
+
| `gdexzip` | `rdazip` | Compress or uncompress files using a supported format |
|
|
38
|
+
| `gdexown` | `rdaown` | Change ownership of files and directories to gdexdata (must be run as root) |
|
|
39
39
|
| `pgrst` | | Convert .usg files to RST and push to gdex-docs-* repos on GitHub for readthedocs.io |
|
|
40
40
|
|
|
41
41
|
**Run as gdexdata via setuid (requires setup below):**
|
|
42
42
|
|
|
43
43
|
| Command | Alias | Connector script | Description |
|
|
44
44
|
|---------|-------|-----------------|-------------|
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
45
|
+
| `gdexcp` | `rdacp` | `setuid_gdexcp` / `setuid_rdacp` | Copy files and directories across local, remote, Object Store, or Globus endpoints |
|
|
46
|
+
| `gdexkill` | `rdakill` | `setuid_gdexkill` / `setuid_rdakill` | Kill local processes and their children, or cancel PBS batch jobs |
|
|
47
|
+
| `gdexmod` | `rdamod` | `setuid_gdexmod` / `setuid_rdamod` | Change permission modes for files and directories owned by gdexdata |
|
|
48
48
|
|
|
49
49
|
## Environment setup
|
|
50
50
|
|
|
@@ -103,7 +103,7 @@ pip install rda_python_miscs
|
|
|
103
103
|
|
|
104
104
|
## Setuid Setup
|
|
105
105
|
|
|
106
|
-
The setuid programs (`
|
|
106
|
+
The setuid programs (`gdexcp`, `gdexkill`, `gdexmod` and their `rda*` aliases)
|
|
107
107
|
execute as the common user `PGLOG['COMMONUSER']` (default `gdexdata`) via
|
|
108
108
|
the `rda_python_setuid` mechanism, which is pulled in automatically as a
|
|
109
109
|
dependency. After `pip install` above, choose one of the wiring options
|
|
@@ -3,9 +3,23 @@ rda_python_miscs/bash_qsub.py,sha256=NsYg1A7zeRy3mR_rAaJEQoWSDaWFxE7cpHNc4mA_JwA
|
|
|
3
3
|
rda_python_miscs/bashqsub.py,sha256=SadPwz1ZXHx2zGNYb2VityItQjMEYj-Favq3xDrPBK0,10127
|
|
4
4
|
rda_python_miscs/bashqsub.usg,sha256=QDaFr1FiQ-5FC9UzCRQ0geYjsPXBnVMhe3lM8qH1xss,2176
|
|
5
5
|
rda_python_miscs/gdex_ls.py,sha256=fg9jfYajOT8ps6eEhFUUqmQ791BdGwBkrT_pyjmGGvQ,8860
|
|
6
|
+
rda_python_miscs/gdexcp.py,sha256=b8ZJspBKDP_u8nH15eWkwI0CSABLSX0MzPw2CVyFJYY,10933
|
|
7
|
+
rda_python_miscs/gdexcp.usg,sha256=O-qXc6vMvojEmBWQIqns1pntI2AqxPB4d7LJw4AqV6M,3197
|
|
8
|
+
rda_python_miscs/gdexkill.py,sha256=sWa5MCBXvDpN-5iqVBLNrfO8og1vZMZhu7HlCR9c7bI,11607
|
|
9
|
+
rda_python_miscs/gdexkill.usg,sha256=ptx_1GuFNI9ISi4mjMVTc4aDj9J4JpMG0gvzKbhDJqA,2459
|
|
6
10
|
rda_python_miscs/gdexls.py,sha256=Z-iB3nC0zUm2fOUIkhpZd_N82j-5WPRbjDcmGKTRGhY,14396
|
|
7
11
|
rda_python_miscs/gdexls.usg,sha256=OSHTdj_E4MJmlg-4u3IbOsE5RO-Cq_PUMmEKR5gen3M,2813
|
|
8
12
|
rda_python_miscs/gdexls_standalone.py,sha256=YcKnJ0Zm0SbZET4X8IQnrEyoAsHp5estUpOfWEIToQU,453
|
|
13
|
+
rda_python_miscs/gdexmod.py,sha256=rWjU3OdJc2X1FAI8a__EnagAPFWq8n5fk-ksN8HlZrE,8722
|
|
14
|
+
rda_python_miscs/gdexmod.usg,sha256=qVMcOseVL0nQvDfKOitAE5b2T0NhzL5qDVHWnUqNXY4,2532
|
|
15
|
+
rda_python_miscs/gdexown.py,sha256=mX7doxH7A5n8FD3GTSnTfvk3BH26Doudt_Db25fXVOI,8788
|
|
16
|
+
rda_python_miscs/gdexown.usg,sha256=Hgyox1eNp9y2ZHI-WTLY102IGZlINVG6rvuPO4sD8b0,2194
|
|
17
|
+
rda_python_miscs/gdexps.py,sha256=tw9rMiIDvhW5KN5gMwpQbC-r9Agwho1vNlui1kjvPyY,6641
|
|
18
|
+
rda_python_miscs/gdexps.usg,sha256=HvjCnmpe43TTzMzvd_FUsnhewByo4ZOMzxX4L0IxA2M,1934
|
|
19
|
+
rda_python_miscs/gdexsub.py,sha256=9_9XMjLLj4IScNZvKBVfCljY9r7Se6md5BEEgapJ7pQ,6656
|
|
20
|
+
rda_python_miscs/gdexsub.usg,sha256=SChXnDzo6larOdpR9eZ2CMu8ExJYQUdfFHUzxcGoqJ0,1942
|
|
21
|
+
rda_python_miscs/gdexzip.py,sha256=wzMVTqeahXAUHsKAtqYG6wrM4J2EahnncrpliCqFyNQ,3252
|
|
22
|
+
rda_python_miscs/gdexzip.usg,sha256=cG1Uwa8WZ3KQNSaSkr29edUEaaLb_4cHTU3GRoZSQ84,1918
|
|
9
23
|
rda_python_miscs/pg_docs.py,sha256=_AoqrWroUu7FQMVWaTSTZBQMwi1BH1-RjKb1nDHgxOI,25369
|
|
10
24
|
rda_python_miscs/pg_rst.py,sha256=XldjKneKuciYvZxrHC3h3_OHwyhh51LKYOuKr0s_2Gg,48480
|
|
11
25
|
rda_python_miscs/pg_rst.usg,sha256=oYvVEqzHeVmDntN7hfpM8vc6eoYRyQTruQQg2mPfOo4,2484
|
|
@@ -19,30 +33,16 @@ rda_python_miscs/rda_own.py,sha256=bm2qvMWCFe5xbTriue6ZeVvfikGBoICjeOwAyt-Ct-g,5
|
|
|
19
33
|
rda_python_miscs/rda_ps.py,sha256=SQQonJ5lyvGeqo_BqOpeosY5ACNXKFag5JXyRdEoYa0,5591
|
|
20
34
|
rda_python_miscs/rda_sub.py,sha256=Oa1xohozShVxLgooUEQj_DvyD0d3JDkknrJ4XkTq4H0,4083
|
|
21
35
|
rda_python_miscs/rda_zip.py,sha256=mm1mTSflEJX72by9rAHZ5vjDJZ9q7xjREBXYHoJJ6k4,1776
|
|
22
|
-
rda_python_miscs/rdacp.py,sha256=3g_zxY6Z-VCPO54ScKtFm_rd1R5ueTBeLapf4MkN8BY,10918
|
|
23
|
-
rda_python_miscs/rdacp.usg,sha256=X8wUnoNoxsuDkZlHHNKJ40wXdhTzsSAPDWfH4JCQCNU,3188
|
|
24
|
-
rda_python_miscs/rdakill.py,sha256=RuZLP7KVvvfL5-X96f5ClCs6W3y5ZJKvsYux-yvn4oc,11595
|
|
25
|
-
rda_python_miscs/rdakill.usg,sha256=jNf-xW1y8XCxKgDohbDZr4kJPjhEoWuHjZc2Sjn3DJk,2450
|
|
26
36
|
rda_python_miscs/rdals.py,sha256=2TzHOyyIkgeyY-6flXT9x5kp4hKJal-LzD1N7GpEhGU,8793
|
|
27
37
|
rda_python_miscs/rdals.usg,sha256=ChF-nn3Qb2pds3wMXIWubB_tjwZslxHfSha0dTDqOiY,2984
|
|
28
|
-
rda_python_miscs/rdamod.py,sha256=pS6jMX9qQCxRpQfRCiAuW0iTLY8hYZPJxer-sbPmUXk,8707
|
|
29
|
-
rda_python_miscs/rdamod.usg,sha256=c0JrZqVddO75ba_vfTyAnu5JjGtabg1fRGEkZej2Bsg,2520
|
|
30
|
-
rda_python_miscs/rdaown.py,sha256=LmX2Zgat4DVWcdQ6VptUVd1rzJhgoY21IIFEPMg988k,8772
|
|
31
|
-
rda_python_miscs/rdaown.usg,sha256=XfhK4004Nns4wS7wYotoXDsEr1qN9n_cJxD1LlKVyXI,2183
|
|
32
|
-
rda_python_miscs/rdaps.py,sha256=5EM7TdGQCCeaBFAlDklYKclIWSwwQG-nZxnciLcLaeA,6633
|
|
33
|
-
rda_python_miscs/rdaps.usg,sha256=NnK3dmMhzr_BqRN9y-J8hC8RHXd2mY6nE4_P-fB5CxA,1926
|
|
34
|
-
rda_python_miscs/rdasub.py,sha256=9R-GRLVZShs_0JO1ALhS7dKTmkhcm27P7i9Icuh_9UM,6650
|
|
35
|
-
rda_python_miscs/rdasub.usg,sha256=oL6uCea5jkyYRMf2o1NfCVF7J4JNvxdQrWX3HxT1Hag,1935
|
|
36
|
-
rda_python_miscs/rdazip.py,sha256=SGcAyjZLHiAua6mcV1CFB0XKCj-wTVu8cl7RY3hJy3I,3244
|
|
37
|
-
rda_python_miscs/rdazip.usg,sha256=DZ3Dzowx7GjSBPdbf6ebPAJIY1T8jkE5hXVpCAcwPcQ,1911
|
|
38
38
|
rda_python_miscs/tcsh_qsub.py,sha256=P4Obzbp5Dvy-N0eRR5F51R9yj3ttWJo6g1NqyVDO6-Y,6670
|
|
39
39
|
rda_python_miscs/tcshqsub.py,sha256=QxBq9MdVIUs9t2d6vHhkxM1nrcLwRNqcq1lJiWhXKUM,10124
|
|
40
40
|
rda_python_miscs/tcshqsub.usg,sha256=JYfhrK7cqme-Sij_JfquONOs3HMu-d5dDGI9K_RdudU,2180
|
|
41
41
|
rda_python_miscs/rst_templates/index.rst.temp,sha256=YSa1JM6X9x2SC6UiqJu_9xRrVYGLKwNI43DBJEGDX08,523
|
|
42
42
|
rda_python_miscs/rst_templates/section.rst.temp,sha256=-CUtutvctG2tIdkqrkFxVEzmNN3atRJXBDQaTnMJ6Gw,572
|
|
43
|
-
rda_python_miscs-3.0.
|
|
44
|
-
rda_python_miscs-3.0.
|
|
45
|
-
rda_python_miscs-3.0.
|
|
46
|
-
rda_python_miscs-3.0.
|
|
47
|
-
rda_python_miscs-3.0.
|
|
48
|
-
rda_python_miscs-3.0.
|
|
43
|
+
rda_python_miscs-3.0.2.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
|
|
44
|
+
rda_python_miscs-3.0.2.dist-info/METADATA,sha256=2rjjjAkl_aCtq1tCb880gu1r2oHlZCEy5iLKRg2IpRc,5803
|
|
45
|
+
rda_python_miscs-3.0.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
46
|
+
rda_python_miscs-3.0.2.dist-info/entry_points.txt,sha256=pBgb-_g4yZhm6YynwDHtNTAzxVrb8SoDMd7Eiys8gv4,806
|
|
47
|
+
rda_python_miscs-3.0.2.dist-info/top_level.txt,sha256=W5rz7DrWb7hXABUbGgWcwe6D644X338LR8_zdgmtLhg,17
|
|
48
|
+
rda_python_miscs-3.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[console_scripts]
|
|
2
|
+
bashqsub = rda_python_miscs.bashqsub:main
|
|
3
|
+
gdexls = rda_python_miscs.gdexls:main
|
|
4
|
+
gdexown = rda_python_miscs.gdexown:main
|
|
5
|
+
gdexps = rda_python_miscs.gdexps:main
|
|
6
|
+
gdexsub = rda_python_miscs.gdexsub:main
|
|
7
|
+
gdexzip = rda_python_miscs.gdexzip:main
|
|
8
|
+
pgrst = rda_python_miscs.pg_rst:main
|
|
9
|
+
pgwget = rda_python_miscs.pgwget:main
|
|
10
|
+
rdaown = rda_python_miscs.gdexown:main
|
|
11
|
+
rdaps = rda_python_miscs.gdexps:main
|
|
12
|
+
rdasub = rda_python_miscs.gdexsub:main
|
|
13
|
+
rdazip = rda_python_miscs.gdexzip:main
|
|
14
|
+
setuid_gdexcp = rda_python_miscs.gdexcp:main
|
|
15
|
+
setuid_gdexkill = rda_python_miscs.gdexkill:main
|
|
16
|
+
setuid_gdexmod = rda_python_miscs.gdexmod:main
|
|
17
|
+
setuid_rdacp = rda_python_miscs.gdexcp:main
|
|
18
|
+
setuid_rdakill = rda_python_miscs.gdexkill:main
|
|
19
|
+
setuid_rdamod = rda_python_miscs.gdexmod:main
|
|
20
|
+
tcshqsub = rda_python_miscs.tcshqsub:main
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
[console_scripts]
|
|
2
|
-
bashqsub = rda_python_miscs.bashqsub:main
|
|
3
|
-
gdexls = rda_python_miscs.gdexls:main
|
|
4
|
-
gdexown = rda_python_miscs.rdaown:main
|
|
5
|
-
gdexps = rda_python_miscs.rdaps:main
|
|
6
|
-
gdexsub = rda_python_miscs.rdasub:main
|
|
7
|
-
gdexzip = rda_python_miscs.rdazip:main
|
|
8
|
-
pgrst = rda_python_miscs.pg_rst:main
|
|
9
|
-
pgwget = rda_python_miscs.pgwget:main
|
|
10
|
-
rdaown = rda_python_miscs.rdaown:main
|
|
11
|
-
rdaps = rda_python_miscs.rdaps:main
|
|
12
|
-
rdasub = rda_python_miscs.rdasub:main
|
|
13
|
-
rdazip = rda_python_miscs.rdazip:main
|
|
14
|
-
setuid_gdexcp = rda_python_miscs.rdacp:main
|
|
15
|
-
setuid_gdexkill = rda_python_miscs.rdakill:main
|
|
16
|
-
setuid_gdexmod = rda_python_miscs.rdamod:main
|
|
17
|
-
setuid_rdacp = rda_python_miscs.rdacp:main
|
|
18
|
-
setuid_rdakill = rda_python_miscs.rdakill:main
|
|
19
|
-
setuid_rdamod = rda_python_miscs.rdamod:main
|
|
20
|
-
tcshqsub = rda_python_miscs.tcshqsub:main
|
|
File without changes
|
|
File without changes
|
|
File without changes
|