chappyner 0.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.
- chappyner-0.0.1/PKG-INFO +7 -0
- chappyner-0.0.1/README.md +10 -0
- chappyner-0.0.1/chappyner.egg-info/PKG-INFO +7 -0
- chappyner-0.0.1/chappyner.egg-info/SOURCES.txt +9 -0
- chappyner-0.0.1/chappyner.egg-info/dependency_links.txt +1 -0
- chappyner-0.0.1/chappyner.egg-info/entry_points.txt +2 -0
- chappyner-0.0.1/chappyner.egg-info/requires.txt +1 -0
- chappyner-0.0.1/chappyner.egg-info/top_level.txt +1 -0
- chappyner-0.0.1/chappyner.py +65 -0
- chappyner-0.0.1/pyproject.toml +25 -0
- chappyner-0.0.1/setup.cfg +4 -0
chappyner-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chappyner
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Chappyner
|
|
5
|
+
Author-email: Fabio Pitari <f.pitari@cineca.it>, Lucia Rodriguez Muñoz <l.rodriguezmunoz@cineca.it>, Antonio Memmolo <a.memmolo@cineca.it>
|
|
6
|
+
Maintainer-email: Fabio Pitari <f.pitari@cineca.it>, Lucia Rodriguez Muñoz <l.rodriguezmunoz@cineca.it>, Antonio Memmolo <a.memmolo@cineca.it>
|
|
7
|
+
Requires-Dist: PyYAML
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Chappyner
|
|
2
|
+
Chappyner allows to run http services on an HPC cluster.
|
|
3
|
+
|
|
4
|
+
TBC .....
|
|
5
|
+
|
|
6
|
+
## License
|
|
7
|
+
GPL3 or greater, to be added
|
|
8
|
+
|
|
9
|
+
## Authors
|
|
10
|
+
[Fabio Pitari](mailto:f.pitari@cineca.it?&subject=Chappyner), [Lucia Rodriguez Muñoz](mailto:l.rodriguezmunoz@cineca.it?&subject=Chappyner), [Antonio Memmolo](mailto:a.memmolo@cineca.it?&subject=Chappyner)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chappyner
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Chappyner
|
|
5
|
+
Author-email: Fabio Pitari <f.pitari@cineca.it>, Lucia Rodriguez Muñoz <l.rodriguezmunoz@cineca.it>, Antonio Memmolo <a.memmolo@cineca.it>
|
|
6
|
+
Maintainer-email: Fabio Pitari <f.pitari@cineca.it>, Lucia Rodriguez Muñoz <l.rodriguezmunoz@cineca.it>, Antonio Memmolo <a.memmolo@cineca.it>
|
|
7
|
+
Requires-Dist: PyYAML
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PyYAML
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chappyner
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import argparse, sys, subprocess
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
args = get_arguments()
|
|
8
|
+
|
|
9
|
+
print(f"Username: {args.user}")
|
|
10
|
+
print(f"Cluster: {args.cluster}")
|
|
11
|
+
print(f"Service: {args.service}")
|
|
12
|
+
|
|
13
|
+
def get_arguments():
|
|
14
|
+
parser = argparse.ArgumentParser(description='A description of the program.')
|
|
15
|
+
|
|
16
|
+
parser.add_argument('-c', '--cluster', metavar='CLUSTER',
|
|
17
|
+
dest='cluster', required=True,
|
|
18
|
+
help='Cluster to be used')
|
|
19
|
+
|
|
20
|
+
parser.add_argument('-u', '--user', "--username", metavar='USERNAME',
|
|
21
|
+
dest='user', required=True,
|
|
22
|
+
help='Username')
|
|
23
|
+
|
|
24
|
+
parser.add_argument('-s', '--service', metavar='SERVICE',
|
|
25
|
+
dest='service', required=True,
|
|
26
|
+
help='Service: vnc, jupyter, ttyd')
|
|
27
|
+
|
|
28
|
+
args = parser.parse_args()
|
|
29
|
+
|
|
30
|
+
return args
|
|
31
|
+
|
|
32
|
+
def run_local(command):
|
|
33
|
+
"""Run a local command and return stdout, stderr, and the exit code."""
|
|
34
|
+
result = subprocess.run(
|
|
35
|
+
command,
|
|
36
|
+
shell=True, # True if passing a single string; False if passing a list
|
|
37
|
+
capture_output=True, # capture both stdout and stderr
|
|
38
|
+
text=True # return strings instead of bytes
|
|
39
|
+
)
|
|
40
|
+
return result.stdout, result.stderr, result.returncode
|
|
41
|
+
|
|
42
|
+
def run_remote(host, user, command, keyfile=None):
|
|
43
|
+
"""
|
|
44
|
+
Run a command on a remote host via SSH using subprocess.
|
|
45
|
+
|
|
46
|
+
host: remote host (IP or hostname)
|
|
47
|
+
user: SSH username
|
|
48
|
+
command: command to execute remotely
|
|
49
|
+
keyfile: path to a private key file to use, optional
|
|
50
|
+
"""
|
|
51
|
+
ssh_cmd = ["ssh"]
|
|
52
|
+
if keyfile:
|
|
53
|
+
ssh_cmd += ["-i", keyfile]
|
|
54
|
+
ssh_cmd.append(f"{user}@{host}")
|
|
55
|
+
ssh_cmd.append(command)
|
|
56
|
+
|
|
57
|
+
result = subprocess.run(
|
|
58
|
+
ssh_cmd,
|
|
59
|
+
capture_output=True,
|
|
60
|
+
text=True
|
|
61
|
+
)
|
|
62
|
+
return result.stdout, result.stderr, result.returncode
|
|
63
|
+
|
|
64
|
+
if __name__ == "__main__":
|
|
65
|
+
main()
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "chappyner"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Chappyner"
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "Fabio Pitari", email = "f.pitari@cineca.it"},
|
|
11
|
+
{name = "Lucia Rodriguez Muñoz", email = "l.rodriguezmunoz@cineca.it"},
|
|
12
|
+
{name = "Antonio Memmolo", email = "a.memmolo@cineca.it"},
|
|
13
|
+
]
|
|
14
|
+
maintainers = [
|
|
15
|
+
{name = "Fabio Pitari", email = "f.pitari@cineca.it"},
|
|
16
|
+
{name = "Lucia Rodriguez Muñoz", email = "l.rodriguezmunoz@cineca.it"},
|
|
17
|
+
{name = "Antonio Memmolo", email = "a.memmolo@cineca.it"},
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
dependencies = [
|
|
21
|
+
"PyYAML",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
chappyner = "chappyner:main"
|