moleditpy-job-server 0.3.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.
- job_server/__init__.py +18 -0
- job_server/__main__.py +61 -0
- job_server/_execution/COPYING +674 -0
- job_server/_execution/LICENSE +165 -0
- job_server/_execution/LICENSING.md +41 -0
- job_server/_execution/UPSTREAM_LICENSE +165 -0
- job_server/_execution/__init__.py +794 -0
- job_server/_execution/models.py +627 -0
- job_server/_execution/remote_paths.py +67 -0
- job_server/_execution/remote_runner.py +963 -0
- job_server/_execution/schedulers/__init__.py +49 -0
- job_server/_execution/schedulers/base.py +555 -0
- job_server/_execution/schedulers/pbs.py +170 -0
- job_server/_execution/schedulers/sge.py +138 -0
- job_server/_execution/schedulers/shell.py +98 -0
- job_server/_execution/schedulers/slurm.py +137 -0
- job_server/_execution/schedulers/windows.py +328 -0
- job_server/api.py +432 -0
- job_server/auth.py +273 -0
- job_server/client.py +372 -0
- job_server/core.py +110 -0
- job_server/credentials.py +75 -0
- job_server/db.py +88 -0
- job_server/errors.py +8 -0
- job_server/executor/__init__.py +1 -0
- job_server/executor/native.py +100 -0
- job_server/executor/windows.py +128 -0
- job_server/executor/wsl.py +62 -0
- job_server/files.py +129 -0
- job_server/instance.py +43 -0
- job_server/jobs.py +237 -0
- job_server/plugin.py +71 -0
- job_server/runtime.py +44 -0
- job_server/scheduler.py +202 -0
- job_server/schemas.py +94 -0
- job_server/server_app.py +44 -0
- job_server/server_backend.py +120 -0
- job_server/settings.py +116 -0
- job_server/ui/__init__.py +1 -0
- job_server/ui/_qt_callbacks.py +33 -0
- job_server/ui/dashboard.py +534 -0
- job_server/web/app.css +5 -0
- job_server/web/app.js +209 -0
- job_server/web/icon.png +0 -0
- job_server/web/index.html +37 -0
- job_server/worker.py +132 -0
- moleditpy_job_server-0.3.2.dist-info/METADATA +362 -0
- moleditpy_job_server-0.3.2.dist-info/RECORD +54 -0
- moleditpy_job_server-0.3.2.dist-info/WHEEL +5 -0
- moleditpy_job_server-0.3.2.dist-info/entry_points.txt +2 -0
- moleditpy_job_server-0.3.2.dist-info/licenses/COPYING +674 -0
- moleditpy_job_server-0.3.2.dist-info/licenses/LICENSE +165 -0
- moleditpy_job_server-0.3.2.dist-info/licenses/LICENSING.md +41 -0
- moleditpy_job_server-0.3.2.dist-info/top_level.txt +1 -0
job_server/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""MoleditPy Job Server: loading the plugin never starts a listener."""
|
|
2
|
+
|
|
3
|
+
PLUGIN_NAME = "Job Server"
|
|
4
|
+
PLUGIN_VERSION = "0.3.2"
|
|
5
|
+
PLUGIN_AUTHOR = "HiroYokoyama"
|
|
6
|
+
PLUGIN_DESCRIPTION = "Authenticated shared job queue and headless server for trusted users."
|
|
7
|
+
PLUGIN_CATEGORY = "Utility"
|
|
8
|
+
PLUGIN_TAGS = ["Utility"]
|
|
9
|
+
PLUGIN_DEPENDENCIES = ["fastapi", "uvicorn", "cryptography", "psutil", "packaging"]
|
|
10
|
+
PLUGIN_OPTIONAL_DEPENDENCIES = []
|
|
11
|
+
PLUGIN_SUPPORTED_MOLEDITPY_VERSION = ">=5.0.0, <6.0.0"
|
|
12
|
+
PLUGIN_SUPPORTED_OS = ["Windows", "Linux", "WSL"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def initialize(context):
|
|
16
|
+
from .plugin import initialize as register
|
|
17
|
+
|
|
18
|
+
register(context)
|
job_server/__main__.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import getpass
|
|
3
|
+
import json
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from .settings import Settings
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main():
|
|
11
|
+
parser = argparse.ArgumentParser(description="MoleditPy Job Server — LAN computational helper")
|
|
12
|
+
parser.add_argument("--config", type=Path)
|
|
13
|
+
sub = parser.add_subparsers(dest="action", required=True)
|
|
14
|
+
for name in ("serve", "status", "init", "create-admin"):
|
|
15
|
+
child = sub.add_parser(name)
|
|
16
|
+
child.add_argument("--config", type=Path, default=argparse.SUPPRESS)
|
|
17
|
+
args = parser.parse_args()
|
|
18
|
+
try:
|
|
19
|
+
if args.action == "init":
|
|
20
|
+
path = args.config or Path.home() / ".moleditpy" / "job_server" / "settings.json"
|
|
21
|
+
if path.exists():
|
|
22
|
+
raise RuntimeError("Configuration already exists")
|
|
23
|
+
Settings().validate().save(path)
|
|
24
|
+
print(f"Wrote {path}; listener remains OFF. Next: create-admin, then serve.")
|
|
25
|
+
return 0
|
|
26
|
+
settings = Settings.load(args.config)
|
|
27
|
+
if args.action == "serve":
|
|
28
|
+
from .server_app import serve
|
|
29
|
+
|
|
30
|
+
serve(settings)
|
|
31
|
+
elif args.action == "status":
|
|
32
|
+
from .client import JobServerClient
|
|
33
|
+
|
|
34
|
+
client = JobServerClient(f"http://127.0.0.1:{settings.port}", timeout=3)
|
|
35
|
+
print(json.dumps(client.request("GET", "/health", authenticated=False)))
|
|
36
|
+
elif args.action == "create-admin":
|
|
37
|
+
from .auth import Auth
|
|
38
|
+
from .db import Database
|
|
39
|
+
# Bootstrap uses local filesystem access and an atomic SQLite guard.
|
|
40
|
+
# It does not require stopping an already-running daemon.
|
|
41
|
+
db = Database(settings.root)
|
|
42
|
+
try:
|
|
43
|
+
if db.one("SELECT 1 FROM users WHERE role='admin' AND enabled=1"):
|
|
44
|
+
raise RuntimeError(
|
|
45
|
+
"An administrator already exists; use the authenticated admin API"
|
|
46
|
+
)
|
|
47
|
+
username = input("Administrator username: ").strip()
|
|
48
|
+
password = getpass.getpass("Initial password (12+ characters): ")
|
|
49
|
+
if password != getpass.getpass("Repeat password: "):
|
|
50
|
+
raise ValueError("Passwords differ")
|
|
51
|
+
print(json.dumps(Auth(db, settings).create_initial_admin(username, password)))
|
|
52
|
+
finally:
|
|
53
|
+
db.close()
|
|
54
|
+
except Exception as exc:
|
|
55
|
+
print(f"Error: {exc}", file=sys.stderr)
|
|
56
|
+
return 1
|
|
57
|
+
return 0
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if __name__ == "__main__":
|
|
61
|
+
raise SystemExit(main())
|