py-serverless-kit 2.3.2__py3-none-any.whl → 2.3.3__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.
@@ -1,2 +1,2 @@
1
- __version__ = "2.3.2"
1
+ __version__ = "2.3.3"
2
2
  __author__ = "Asif Khan @ Kavion.ai"
@@ -1,414 +1,461 @@
1
- """Talk to a deployed on-premises host's control API (``/__pskit/...``).
2
-
3
- Used by ``pskit logs``, ``pskit workflow ...`` and the live dashboard. The admin
4
- token is read from the generated ``pskit_host.json`` and only ever sent to the
5
- host itself.
6
- """
7
-
8
- from __future__ import annotations
9
-
10
- import base64
11
- import json
12
- import socket
13
- import subprocess
14
- import time
15
- from pathlib import Path
16
- from typing import Any, Dict, Optional, Tuple
17
- from urllib.error import HTTPError, URLError
18
- from urllib.parse import quote, urlencode, urlsplit
19
- from urllib.request import Request, urlopen
20
-
21
- from .onprem_servers import DEPLOYED_FILE, LOCAL, deployed_server
22
- from .project import WORK_DIR
23
-
24
- __all__ = [
25
- "DEPLOYED_FILE", "LOCAL", "HostControl", "HostUnavailable", "control_for", "control_url", "deployed_host",
26
- "deployed_on", "deployed_server", "host_spec", "record_key", "remember_deploy", "rendered_spec",
27
- ]
28
- _ROUTE_TTL = 120.0 # seconds a direct / SSH route decision is reused
29
- _ROUTES: Dict[str, Tuple[str, float]] = {}
30
-
31
- # Runs on the server over SSH: one HTTP request to the host on its loopback. The request (with the admin token)
32
- # arrives on stdin, so nothing secret is on a command line.
33
- _SSH_FETCH = (
34
- "import sys,json,base64,urllib.request,urllib.error\n"
35
- "r=json.loads(sys.stdin.readline())\n"
36
- "b=base64.b64decode(r['b']) if r.get('b') is not None else None\n"
37
- "q=urllib.request.Request(r['u'],data=b,method=r['m'],headers=r['h'])\n"
38
- "try:\n"
39
- " p=urllib.request.urlopen(q,timeout=r['t']);s=p.status;h=dict(p.headers);d=p.read()\n"
40
- "except urllib.error.HTTPError as e:\n"
41
- " s=e.code;h=dict(e.headers or {});d=e.read()\n"
42
- "except Exception as e:\n"
43
- " sys.stderr.write('pskit: no pskit host answers on port %s of this server (%s)\\n'"
44
- " % (r['u'].split(':')[2].split('/')[0],getattr(e,'reason',None) or e));sys.exit(3)\n"
45
- "sys.stdout.write(json.dumps({'s':s,'h':h,'b':base64.b64encode(d).decode()}))\n"
46
- )
47
-
48
-
49
- class HostUnavailable(OSError):
50
- """The host did not answer (not running, wrong address, firewall...)."""
51
-
52
-
53
- class HostControl:
54
- """Client for a host's ``/__pskit`` API.
55
-
56
- ``ssh`` (the deploy's SSH login) keeps a host on another machine reachable when its port is not: it binds
57
- 127.0.0.1 there (the default) or a firewall blocks the port. The request then runs on the server over SSH.
58
- """
59
-
60
- def __init__(
61
- self,
62
- base_url: str,
63
- token: str = "",
64
- timeout: float = 10.0,
65
- *,
66
- ssh: Optional[Dict[str, Any]] = None,
67
- remote_port: Optional[int] = None,
68
- remote_path: str = "",
69
- server: Optional[str] = None,
70
- force_ssh: bool = False,
71
- ) -> None:
72
- if not base_url.lower().startswith(("http://", "https://")):
73
- raise ValueError(f"on-prem control URL must be http(s), got {base_url!r}")
74
- self.base_url = base_url.rstrip("/")
75
- self.token = token
76
- self.timeout = timeout
77
- self.ssh = ssh if ssh and ssh.get("host") else None
78
- self.remote_port = int(remote_port or urlsplit(self.base_url).port or 8080)
79
- self.remote_path = remote_path
80
- self.server = server
81
- self.force_ssh = force_ssh
82
-
83
- @property
84
- def where(self) -> str:
85
- """The saved server and URL, for messages."""
86
- return f"{self.base_url} (server {self.server})" if self.server else self.base_url
87
-
88
- # ------------------------------------------------------------------ transport
89
- def fetch(
90
- self,
91
- method: str,
92
- path: str,
93
- data: Optional[bytes] = None,
94
- headers: Optional[Dict[str, str]] = None,
95
- query: Optional[Dict[str, Any]] = None,
96
- timeout: Optional[float] = None,
97
- ) -> Tuple[int, Dict[str, str], bytes]:
98
- """One request: ``(status, headers, body)`` for any HTTP status, HostUnavailable when nothing answers."""
99
- params = {k: v for k, v in (query or {}).items() if v is not None and v != ""}
100
- suffix = path + ("?" + urlencode(params) if params else "")
101
- sent = dict(headers or {})
102
- if self.token:
103
- sent["x-pskit-token"] = self.token
104
- wait = timeout or self.timeout
105
- if self.ssh is not None and (self.force_ssh or self._route() == "ssh"):
106
- why = "" if self.force_ssh else "port not reachable from here"
107
- return self._fetch_ssh(method, suffix, data, sent, wait, direct_error=why)
108
- req = Request(self.base_url + suffix, data=data, method=method) # noqa: S310 - http(s) checked in __init__
109
- for key, value in sent.items():
110
- req.add_header(key, value)
111
- try:
112
- with urlopen(req, timeout=wait) as resp: # noqa: S310
113
- return resp.status, dict(resp.headers), resp.read()
114
- except HTTPError as exc:
115
- return exc.code, dict(exc.headers or {}), exc.read()
116
- except (URLError, OSError, ValueError) as exc:
117
- reason = getattr(exc, "reason", exc)
118
- if self.ssh is not None:
119
- _ROUTES[self.base_url] = ("ssh", time.monotonic() + _ROUTE_TTL)
120
- return self._fetch_ssh(method, suffix, data, sent, wait, direct_error=str(reason))
121
- raise HostUnavailable(f"on-prem host at {self.where} is not reachable: {reason}") from None
122
-
123
- def _route(self) -> str:
124
- """``direct`` when this machine can open the host's port, else ``ssh``; remembered for a while."""
125
- cached = _ROUTES.get(self.base_url)
126
- if cached and cached[1] > time.monotonic():
127
- return cached[0]
128
- parts = urlsplit(self.base_url)
129
- try:
130
- with socket.create_connection((parts.hostname or "", parts.port or 80), timeout=3):
131
- route = "direct"
132
- except OSError:
133
- route = "ssh"
134
- _ROUTES[self.base_url] = (route, time.monotonic() + _ROUTE_TTL)
135
- return route
136
-
137
- def _fetch_ssh(
138
- self, method: str, suffix: str, data: Optional[bytes], headers: Dict[str, str], timeout: float,
139
- direct_error: str = "",
140
- ) -> Tuple[int, Dict[str, str], bytes]:
141
- from ..providers.onprem_remote import _shq, _ssh_base, _target
142
-
143
- assert self.ssh is not None
144
- candidates = ([self.remote_path.rstrip("/") + "/python/bin/python3"] if self.remote_path else []) + [
145
- "python3", "python"]
146
- command = (
147
- 'export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"; '
148
- f"for p in {' '.join(_shq(c) for c in candidates)}; do "
149
- f'if command -v "$p" >/dev/null 2>&1; then exec "$p" -c {_shq(_SSH_FETCH)}; fi; done; '
150
- "echo 'pskit: no python3 on the server' >&2; exit 127"
151
- )
152
- request = {
153
- "m": method,
154
- "u": f"http://127.0.0.1:{self.remote_port}{suffix}",
155
- "h": headers,
156
- "b": None if data is None else base64.b64encode(data).decode("ascii"),
157
- "t": timeout,
158
- }
159
- argv = _ssh_base(self.ssh) + [_target(self.ssh), command]
160
- why = f" directly ({direct_error})" if direct_error else ""
161
- try:
162
- proc = subprocess.run( # noqa: S603 - explicit argv, no local shell
163
- argv, input=(json.dumps(request) + "\n").encode("utf-8"), capture_output=True, timeout=timeout + 40
164
- )
165
- except FileNotFoundError:
166
- raise HostUnavailable(
167
- f"on-prem host at {self.where} is not reachable{why}, and `{argv[0]}` is not installed here "
168
- "to reach it over SSH"
169
- ) from None
170
- except subprocess.TimeoutExpired:
171
- raise HostUnavailable(f"on-prem host at {self.where}: no answer over SSH in {int(timeout + 40)}s") from None
172
- err = proc.stderr.decode("utf-8", "replace").strip()
173
- if proc.returncode:
174
- detail = err.splitlines()[-1] if err else f"ssh exited with {proc.returncode}"
175
- redeploy = "pskit deploy" + (f" --server {self.server}" if self.server else "")
176
- raise HostUnavailable(
177
- f"on-prem host at {self.where} is not reachable{why}, nor over SSH to {self.ssh.get('host')}: "
178
- f"{detail}. If the host is not running there, redeploy it: {redeploy}"
179
- )
180
- try:
181
- out = json.loads(proc.stdout.decode("utf-8"))
182
- return int(out["s"]), dict(out.get("h") or {}), base64.b64decode(out.get("b") or "")
183
- except (ValueError, KeyError, TypeError):
184
- raise HostUnavailable(f"on-prem host at {self.where}: unexpected answer over SSH: {err[-300:]}") from None
185
-
186
- def request(
187
- self,
188
- method: str,
189
- path: str,
190
- body: Any = None,
191
- query: Optional[Dict[str, Any]] = None,
192
- timeout: Optional[float] = None,
193
- *,
194
- data: Optional[bytes] = None,
195
- ) -> Any:
196
- """A JSON call: ``body`` as JSON or ``data`` as raw bytes. 404 -> KeyError, 400/405/413 -> ValueError."""
197
- headers = {"accept": "application/json"}
198
- if body is not None:
199
- data = json.dumps(body, default=str).encode("utf-8")
200
- headers["content-type"] = "application/json"
201
- status, _headers, raw = self.fetch(method, path, data, headers, query, timeout)
202
- if status >= 400:
203
- message = _error_body(raw, status)
204
- if status == 404:
205
- raise KeyError(message)
206
- if status in (400, 405, 413):
207
- raise ValueError(message)
208
- if status == 401:
209
- raise PermissionError(f"{message} (check provider.options.admin_token)")
210
- raise HostUnavailable(f"{self.base_url} answered HTTP {status}: {message}")
211
- if not raw:
212
- return None
213
- try:
214
- return json.loads(raw.decode("utf-8"))
215
- except ValueError:
216
- raise HostUnavailable(f"{self.base_url} returned a non-JSON response") from None
217
-
218
- # ------------------------------------------------------------------ helpers
219
- def health(self) -> Dict[str, Any]:
220
- return dict(self.request("GET", "/__pskit/health", timeout=3) or {})
221
-
222
- def stats(self) -> Dict[str, Any]:
223
- return dict(self.request("GET", "/__pskit/stats") or {})
224
-
225
- def logs(
226
- self,
227
- since: int = 0,
228
- limit: int = 200,
229
- level: Optional[str] = None,
230
- function: Optional[str] = None,
231
- q: Optional[str] = None,
232
- source: Optional[str] = None,
233
- before: Optional[int] = None,
234
- local: bool = False,
235
- ) -> Dict[str, Any]:
236
- query = {
237
- "since": since,
238
- "limit": limit,
239
- "level": level,
240
- "function": function,
241
- "q": q,
242
- "source": source,
243
- "before": before,
244
- }
245
- path = "/__pskit/logs/local" if local else "/__pskit/logs"
246
- return dict(self.request("GET", path, query=query) or {})
247
-
248
- def log_streams(self) -> Dict[str, Any]:
249
- return dict(self.request("GET", "/__pskit/logs/streams") or {})
250
-
251
- def clear_logs(self, function: Optional[str] = None) -> Dict[str, Any]:
252
- return dict(self.request("DELETE", "/__pskit/logs", query={"function": function}) or {})
253
-
254
- def start_workflow(self, workflow: str, data: Any, wait: bool = False) -> Dict[str, Any]:
255
- path = "/__pskit/workflows/" + quote(workflow, safe="")
256
- return dict(
257
- self.request(
258
- "POST", path, body=data, query={"wait": "true" if wait else None}, timeout=None if wait else 15
259
- )
260
- or {}
261
- )
262
-
263
- def executions(
264
- self, workflow: Optional[str] = None, status: Optional[str] = None, limit: int = 20, offset: int = 0
265
- ) -> Dict[str, Any]:
266
- query = {"workflow": workflow, "status": status, "limit": limit, "offset": offset}
267
- return dict(self.request("GET", "/__pskit/executions", query=query) or {})
268
-
269
- def execution(self, execution_id: str) -> Dict[str, Any]:
270
- return dict(self.request("GET", "/__pskit/executions/" + quote(execution_id, safe="")) or {})
271
-
272
- def cancel(self, execution_id: str) -> Dict[str, Any]:
273
- return dict(self.request("POST", "/__pskit/executions/" + quote(execution_id, safe="") + "/cancel") or {})
274
-
275
-
276
- def _error_body(raw: bytes, status: int) -> str:
277
- try:
278
- payload = json.loads(raw.decode("utf-8"))
279
- except Exception: # noqa: BLE001
280
- return f"HTTP {status}"
281
- if isinstance(payload, dict):
282
- return str(payload.get("error") or payload.get("cause") or payload)
283
- return str(payload)
284
-
285
-
286
- def record_key(record: Dict[str, Any]) -> str:
287
- return str(record.get("key") or f"{record.get('provider')}-{record.get('stage')}")
288
-
289
-
290
- def host_spec(record: Dict[str, Any], root: Path) -> Optional[Dict[str, Any]]:
291
- """The spec the host was last *deployed* with, else the one last rendered (package / plan rewrite that)."""
292
- deployed = deployed_host(root, str(record.get("stage") or ""), record)
293
- if deployed is not None:
294
- return dict(deployed.get("spec") or {})
295
- return rendered_spec(Path(root) / WORK_DIR / record_key(record))
296
-
297
-
298
- def rendered_spec(work_dir: Path) -> Optional[Dict[str, Any]]:
299
- try:
300
- spec = json.loads((Path(work_dir) / "onprem_app" / "pskit_host.json").read_text("utf-8"))
301
- except (OSError, ValueError):
302
- return None
303
- return spec if isinstance(spec, dict) else None
304
-
305
-
306
- # ---------------------------------------------------------------------- where a stage was deployed
307
- _SPEC_KEYS = ("host", "port", "endpoint", "admin_token", "deploy", "unit_name", "service", "stage")
308
-
309
-
310
- def deployed_host(
311
- root: Path, stage: str, record: Optional[Dict[str, Any]] = None
312
- ) -> Optional[Dict[str, Any]]:
313
- """``{server, spec, deployed_at}`` written by the last successful ``pskit deploy`` of ``onprem-<stage>``."""
314
- key = record_key(record) if record else f"onprem-{stage}"
315
- try:
316
- data = json.loads((Path(root) / WORK_DIR / key / DEPLOYED_FILE).read_text("utf-8"))
317
- except (OSError, ValueError):
318
- return None
319
- return data if isinstance(data, dict) and isinstance(data.get("spec"), dict) else None
320
-
321
-
322
- def remember_deploy(work_dir: Path, server: Optional[str], cluster: Optional[str] = None) -> Optional[Dict[str, Any]]:
323
- """After a successful deploy: keep where the host runs, so trigger / logs / test and the next deploy use it.
324
- On a scaling cluster ``server`` is its master and ``cluster`` its name."""
325
- spec = rendered_spec(work_dir)
326
- if spec is None:
327
- return None
328
- data = {
329
- "server": server or None,
330
- "cluster": cluster or None,
331
- "deployed_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
332
- "spec": {k: spec[k] for k in _SPEC_KEYS if k in spec},
333
- }
334
- path = Path(work_dir) / DEPLOYED_FILE
335
- path.parent.mkdir(parents=True, exist_ok=True)
336
- path.write_bytes((json.dumps(data, indent=2, sort_keys=True) + "\n").encode("utf-8"))
337
- return data
338
-
339
-
340
- def deployed_on(spec: Dict[str, Any], server: Optional[str], cluster: Optional[str] = None) -> Dict[str, Any]:
341
- """The ``deployed_on`` summary kept in ``deployment.json`` (shown by deploy, info and the studio)."""
342
- deploy = spec.get("deploy") or {}
343
- method = str(deploy.get("method") or "local")
344
- ssh_host = str((deploy.get("ssh") or {}).get("host") or "")
345
- where = "this machine" if method == "local" or not ssh_host else ssh_host
346
- label = f"{server} ({where})" if server else where
347
- if cluster:
348
- label = f"cluster {cluster} (master {label})"
349
- return {"server": server or None, "cluster": cluster or None, "method": method, "host": ssh_host or None,
350
- "label": label, "endpoint": spec.get("endpoint")}
351
-
352
-
353
- def control_url(spec: Dict[str, Any], record: Optional[Dict[str, Any]] = None) -> str:
354
- """Loopback for a host on this machine, otherwise the advertised endpoint."""
355
- from ..runtime.onprem_host import health_url
356
-
357
- method = str((spec.get("deploy") or {}).get("method") or "local")
358
- if method == "local":
359
- return health_url(spec)[: -len("/__pskit/health")]
360
- endpoint = spec.get("endpoint") or (record or {}).get("endpoint")
361
- if not endpoint:
362
- return health_url(spec)[: -len("/__pskit/health")]
363
- return str(endpoint).rstrip("/")
364
-
365
-
366
- def _spec_ssh(spec: Dict[str, Any]) -> Tuple[Optional[Dict[str, Any]], str]:
367
- """The SSH login and remote folder of a host deployed over SSH (also docker on an SSH host)."""
368
- deploy = spec.get("deploy") or {}
369
- ssh = deploy.get("ssh") or {}
370
- if str(deploy.get("method") or "local") == "local" or not ssh.get("host") or not ssh.get("user"):
371
- return None, ""
372
- return dict(ssh), str(ssh.get("path") or "")
373
-
374
-
375
- def control_for(record: Dict[str, Any], root: Path, server: Optional[str] = None) -> Optional[HostControl]:
376
- """A client for the deployment's host, or None when it is not an on-prem deployment.
377
-
378
- Without ``server`` this is the host of the last successful deploy (its saved server, SSH host or this
379
- machine), even after ``package`` / ``plan`` re-rendered the spec for another target. ``server`` (or
380
- ``PSKIT_DEPLOY_SERVER``, set by ``--server``) picks the host on that saved SSH server instead: the same
381
- project deployed to several machines. ``local`` picks this machine. A host whose port cannot be reached
382
- from here is called over SSH.
383
- """
384
- import os
385
-
386
- if record.get("provider") != "onprem":
387
- return None
388
- from .onprem_servers import SERVER_ENV, get_server
389
-
390
- spec = host_spec(record, root)
391
- deployed = deployed_host(root, str(record.get("stage") or ""), record)
392
- token = str((spec or {}).get("admin_token") or "")
393
- port = int((spec or {}).get("port") or 8080)
394
- name = server or os.environ.get(SERVER_ENV) or None
395
- if name == LOCAL:
396
- from ..runtime.onprem_host import health_url
397
-
398
- return HostControl(health_url({**(spec or {}), "host": "127.0.0.1"})[: -len("/__pskit/health")], token=token)
399
- if name and name != (deployed or {}).get("server"):
400
- from .onprem_servers import server_target
401
- from .onprem_services import ssh_options
402
-
403
- item = get_server(root, name) # ServerError (a ValueError) for an unknown name
404
- _ssh, remote_path = _spec_ssh(spec or {})
405
- return HostControl(f"http://{item['host']}:{port}", token=token, ssh=ssh_options(server_target(root, name)),
406
- remote_port=port, remote_path=remote_path, server=name)
407
- if spec is None:
408
- endpoint = record.get("endpoint")
409
- if not endpoint:
410
- return None
411
- return HostControl(str(endpoint))
412
- ssh, remote_path = _spec_ssh(spec)
413
- return HostControl(control_url(spec, record), token=token, ssh=ssh, remote_port=port, remote_path=remote_path,
414
- server=(deployed or {}).get("server") or None)
1
+ """Talk to a deployed on-premises host's control API (``/__pskit/...``).
2
+
3
+ Used by ``pskit logs``, ``pskit workflow ...`` and the live dashboard. The admin
4
+ token is read from the generated ``pskit_host.json`` and only ever sent to the
5
+ host itself.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import base64
11
+ import json
12
+ import socket
13
+ import subprocess
14
+ import time
15
+ from pathlib import Path
16
+ from typing import Any, Dict, Optional, Tuple
17
+ from urllib.error import HTTPError, URLError
18
+ from urllib.parse import quote, urlencode, urlsplit
19
+ from urllib.request import Request, urlopen
20
+
21
+ from .onprem_servers import DEPLOYED_FILE, LOCAL, deployed_server
22
+ from .project import WORK_DIR
23
+
24
+ __all__ = [
25
+ "DEPLOYED_FILE", "LOCAL", "FunctionFailed", "HostControl", "HostUnavailable", "control_for", "control_url", "deployed_host",
26
+ "deployed_on", "deployed_server", "host_spec", "record_key", "remember_deploy", "rendered_spec",
27
+ ]
28
+ _ROUTE_TTL = 120.0 # seconds a direct / SSH route decision is reused
29
+ _ROUTES: Dict[str, Tuple[str, float]] = {}
30
+
31
+ # Runs on the server over SSH: one HTTP request to the host on its loopback. The request (with the admin token)
32
+ # arrives on stdin, so nothing secret is on a command line.
33
+ _SSH_FETCH = (
34
+ "import sys,json,base64,urllib.request,urllib.error\n"
35
+ "r=json.loads(sys.stdin.readline())\n"
36
+ "b=base64.b64decode(r['b']) if r.get('b') is not None else None\n"
37
+ "q=urllib.request.Request(r['u'],data=b,method=r['m'],headers=r['h'])\n"
38
+ "try:\n"
39
+ " p=urllib.request.urlopen(q,timeout=r['t']);s=p.status;h=dict(p.headers);d=p.read()\n"
40
+ "except urllib.error.HTTPError as e:\n"
41
+ " s=e.code;h=dict(e.headers or {});d=e.read()\n"
42
+ "except Exception as e:\n"
43
+ " sys.stderr.write('pskit: no pskit host answers on port %s of this server (%s)\\n'"
44
+ " % (r['u'].split(':')[2].split('/')[0],getattr(e,'reason',None) or e));sys.exit(3)\n"
45
+ "sys.stdout.write(json.dumps({'s':s,'h':h,'b':base64.b64encode(d).decode()}))\n"
46
+ )
47
+
48
+
49
+ class HostUnavailable(OSError):
50
+ """The host did not answer (not running, wrong address, firewall...)."""
51
+
52
+
53
+ class FunctionFailed(HostUnavailable):
54
+ """The host answered, but the function raised: ``error_type`` and ``cause`` are its exception's. (A
55
+ HostUnavailable so callers that report host errors report this too.)"""
56
+
57
+ def __init__(self, error_type: str, cause: str) -> None:
58
+ self.error_type = error_type
59
+ self.cause = cause
60
+ super().__init__(f"the function raised {error_type}: {cause}")
61
+
62
+
63
+ class HostControl:
64
+ """Client for a host's ``/__pskit`` API.
65
+
66
+ ``ssh`` (the deploy's SSH login) keeps a host on another machine reachable when its port is not: it binds
67
+ 127.0.0.1 there (the default) or a firewall blocks the port. The request then runs on the server over SSH.
68
+ """
69
+
70
+ def __init__(
71
+ self,
72
+ base_url: str,
73
+ token: str = "",
74
+ timeout: float = 10.0,
75
+ *,
76
+ ssh: Optional[Dict[str, Any]] = None,
77
+ remote_port: Optional[int] = None,
78
+ remote_path: str = "",
79
+ server: Optional[str] = None,
80
+ force_ssh: bool = False,
81
+ ) -> None:
82
+ if not base_url.lower().startswith(("http://", "https://")):
83
+ raise ValueError(f"on-prem control URL must be http(s), got {base_url!r}")
84
+ self.base_url = base_url.rstrip("/")
85
+ self.token = token
86
+ self.timeout = timeout
87
+ self.ssh = ssh if ssh and ssh.get("host") else None
88
+ self.remote_port = int(remote_port or urlsplit(self.base_url).port or 8080)
89
+ self.remote_path = remote_path
90
+ self.server = server
91
+ self.force_ssh = force_ssh
92
+
93
+ @property
94
+ def where(self) -> str:
95
+ """The saved server and URL, for messages."""
96
+ return f"{self.base_url} (server {self.server})" if self.server else self.base_url
97
+
98
+ # ------------------------------------------------------------------ transport
99
+ def fetch(
100
+ self,
101
+ method: str,
102
+ path: str,
103
+ data: Optional[bytes] = None,
104
+ headers: Optional[Dict[str, str]] = None,
105
+ query: Optional[Dict[str, Any]] = None,
106
+ timeout: Optional[float] = None,
107
+ ) -> Tuple[int, Dict[str, str], bytes]:
108
+ """One request: ``(status, headers, body)`` for any HTTP status, HostUnavailable when nothing answers."""
109
+ params = {k: v for k, v in (query or {}).items() if v is not None and v != ""}
110
+ suffix = path + ("?" + urlencode(params) if params else "")
111
+ sent = dict(headers or {})
112
+ if self.token:
113
+ sent["x-pskit-token"] = self.token
114
+ wait = timeout or self.timeout
115
+ if self.ssh is not None and (self.force_ssh or self._route() == "ssh"):
116
+ why = "" if self.force_ssh else "port not reachable from here"
117
+ return self._fetch_ssh(method, suffix, data, sent, wait, direct_error=why)
118
+ req = Request(self.base_url + suffix, data=data, method=method) # noqa: S310 - http(s) checked in __init__
119
+ for key, value in sent.items():
120
+ req.add_header(key, value)
121
+ try:
122
+ with urlopen(req, timeout=wait) as resp: # noqa: S310
123
+ return resp.status, dict(resp.headers), resp.read()
124
+ except HTTPError as exc:
125
+ return exc.code, dict(exc.headers or {}), exc.read()
126
+ except (URLError, OSError, ValueError) as exc:
127
+ reason = getattr(exc, "reason", exc)
128
+ if self.ssh is not None:
129
+ _ROUTES[self.base_url] = ("ssh", time.monotonic() + _ROUTE_TTL)
130
+ return self._fetch_ssh(method, suffix, data, sent, wait, direct_error=str(reason))
131
+ raise HostUnavailable(f"on-prem host at {self.where} is not reachable: {reason}") from None
132
+
133
+ def _route(self) -> str:
134
+ """``direct`` when this machine can open the host's port, else ``ssh``; remembered for a while."""
135
+ cached = _ROUTES.get(self.base_url)
136
+ if cached and cached[1] > time.monotonic():
137
+ return cached[0]
138
+ parts = urlsplit(self.base_url)
139
+ try:
140
+ with socket.create_connection((parts.hostname or "", parts.port or 80), timeout=3):
141
+ route = "direct"
142
+ except OSError:
143
+ route = "ssh"
144
+ _ROUTES[self.base_url] = (route, time.monotonic() + _ROUTE_TTL)
145
+ return route
146
+
147
+ def _fetch_ssh(
148
+ self, method: str, suffix: str, data: Optional[bytes], headers: Dict[str, str], timeout: float,
149
+ direct_error: str = "",
150
+ ) -> Tuple[int, Dict[str, str], bytes]:
151
+ from ..providers.onprem_remote import _shq, _ssh_base, _target
152
+
153
+ assert self.ssh is not None
154
+ candidates = ([self.remote_path.rstrip("/") + "/python/bin/python3"] if self.remote_path else []) + [
155
+ "python3", "python"]
156
+ command = (
157
+ 'export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"; '
158
+ f"for p in {' '.join(_shq(c) for c in candidates)}; do "
159
+ f'if command -v "$p" >/dev/null 2>&1; then exec "$p" -c {_shq(_SSH_FETCH)}; fi; done; '
160
+ "echo 'pskit: no python3 on the server' >&2; exit 127"
161
+ )
162
+ request = {
163
+ "m": method,
164
+ "u": f"http://127.0.0.1:{self.remote_port}{suffix}",
165
+ "h": headers,
166
+ "b": None if data is None else base64.b64encode(data).decode("ascii"),
167
+ "t": timeout,
168
+ }
169
+ argv = _ssh_base(self.ssh) + [_target(self.ssh), command]
170
+ why = f" directly ({direct_error})" if direct_error else ""
171
+ try:
172
+ proc = subprocess.run( # noqa: S603 - explicit argv, no local shell
173
+ argv, input=(json.dumps(request) + "\n").encode("utf-8"), capture_output=True, timeout=timeout + 40
174
+ )
175
+ except FileNotFoundError:
176
+ raise HostUnavailable(
177
+ f"on-prem host at {self.where} is not reachable{why}, and `{argv[0]}` is not installed here "
178
+ "to reach it over SSH"
179
+ ) from None
180
+ except subprocess.TimeoutExpired:
181
+ raise HostUnavailable(f"on-prem host at {self.where}: no answer over SSH in {int(timeout + 40)}s") from None
182
+ err = proc.stderr.decode("utf-8", "replace").strip()
183
+ if proc.returncode:
184
+ detail = err.splitlines()[-1] if err else f"ssh exited with {proc.returncode}"
185
+ redeploy = "pskit deploy" + (f" --server {self.server}" if self.server else "")
186
+ raise HostUnavailable(
187
+ f"on-prem host at {self.where} is not reachable{why}, nor over SSH to {self.ssh.get('host')}: "
188
+ f"{detail}. If the host is not running there, redeploy it: {redeploy}"
189
+ )
190
+ try:
191
+ out = json.loads(proc.stdout.decode("utf-8"))
192
+ return int(out["s"]), dict(out.get("h") or {}), base64.b64decode(out.get("b") or "")
193
+ except (ValueError, KeyError, TypeError):
194
+ raise HostUnavailable(f"on-prem host at {self.where}: unexpected answer over SSH: {err[-300:]}") from None
195
+
196
+ def request(
197
+ self,
198
+ method: str,
199
+ path: str,
200
+ body: Any = None,
201
+ query: Optional[Dict[str, Any]] = None,
202
+ timeout: Optional[float] = None,
203
+ *,
204
+ data: Optional[bytes] = None,
205
+ ) -> Any:
206
+ """A JSON call: ``body`` as JSON or ``data`` as raw bytes. 404 -> KeyError, 400/405/413 -> ValueError."""
207
+ headers = {"accept": "application/json"}
208
+ if body is not None:
209
+ data = json.dumps(body, default=str).encode("utf-8")
210
+ headers["content-type"] = "application/json"
211
+ status, _headers, raw = self.fetch(method, path, data, headers, query, timeout)
212
+ if status >= 400:
213
+ message = _error_body(raw, status)
214
+ if status == 404:
215
+ raise KeyError(message)
216
+ if status in (400, 405, 413):
217
+ raise ValueError(message)
218
+ if status == 401:
219
+ raise PermissionError(f"{message} (check provider.options.admin_token)")
220
+ failed = _function_error(raw)
221
+ if failed is not None:
222
+ raise failed
223
+ raise HostUnavailable(f"{self.base_url} answered HTTP {status}: {message}")
224
+ if not raw:
225
+ return None
226
+ try:
227
+ return json.loads(raw.decode("utf-8"))
228
+ except ValueError:
229
+ raise HostUnavailable(f"{self.base_url} returned a non-JSON response") from None
230
+
231
+ # ------------------------------------------------------------------ helpers
232
+ def health(self) -> Dict[str, Any]:
233
+ return dict(self.request("GET", "/__pskit/health", timeout=3) or {})
234
+
235
+ def stats(self) -> Dict[str, Any]:
236
+ return dict(self.request("GET", "/__pskit/stats") or {})
237
+
238
+ def logs(
239
+ self,
240
+ since: int = 0,
241
+ limit: int = 200,
242
+ level: Optional[str] = None,
243
+ function: Optional[str] = None,
244
+ q: Optional[str] = None,
245
+ source: Optional[str] = None,
246
+ before: Optional[int] = None,
247
+ local: bool = False,
248
+ ) -> Dict[str, Any]:
249
+ query = {
250
+ "since": since,
251
+ "limit": limit,
252
+ "level": level,
253
+ "function": function,
254
+ "q": q,
255
+ "source": source,
256
+ "before": before,
257
+ }
258
+ path = "/__pskit/logs/local" if local else "/__pskit/logs"
259
+ return dict(self.request("GET", path, query=query) or {})
260
+
261
+ def log_streams(self) -> Dict[str, Any]:
262
+ return dict(self.request("GET", "/__pskit/logs/streams") or {})
263
+
264
+ def clear_logs(self, function: Optional[str] = None) -> Dict[str, Any]:
265
+ return dict(self.request("DELETE", "/__pskit/logs", query={"function": function}) or {})
266
+
267
+ def start_workflow(self, workflow: str, data: Any, wait: bool = False) -> Dict[str, Any]:
268
+ path = "/__pskit/workflows/" + quote(workflow, safe="")
269
+ return dict(
270
+ self.request(
271
+ "POST", path, body=data, query={"wait": "true" if wait else None}, timeout=None if wait else 15
272
+ )
273
+ or {}
274
+ )
275
+
276
+ def executions(
277
+ self, workflow: Optional[str] = None, status: Optional[str] = None, limit: int = 20, offset: int = 0
278
+ ) -> Dict[str, Any]:
279
+ query = {"workflow": workflow, "status": status, "limit": limit, "offset": offset}
280
+ return dict(self.request("GET", "/__pskit/executions", query=query) or {})
281
+
282
+ def execution(self, execution_id: str) -> Dict[str, Any]:
283
+ return dict(self.request("GET", "/__pskit/executions/" + quote(execution_id, safe="")) or {})
284
+
285
+ def cancel(self, execution_id: str) -> Dict[str, Any]:
286
+ return dict(self.request("POST", "/__pskit/executions/" + quote(execution_id, safe="") + "/cancel") or {})
287
+
288
+
289
+ def _function_error(raw: bytes) -> Optional[FunctionFailed]:
290
+ """The host's answer when the function itself raised: ``{"errorType": ..., "cause": ...}``."""
291
+ try:
292
+ payload = json.loads(raw.decode("utf-8"))
293
+ except Exception: # noqa: BLE001
294
+ return None
295
+ if isinstance(payload, dict) and payload.get("errorType"):
296
+ return FunctionFailed(str(payload["errorType"]), str(payload.get("cause") or ""))
297
+ return None
298
+
299
+
300
+ def _error_body(raw: bytes, status: int) -> str:
301
+ try:
302
+ payload = json.loads(raw.decode("utf-8"))
303
+ except Exception: # noqa: BLE001
304
+ return f"HTTP {status}"
305
+ if isinstance(payload, dict):
306
+ return str(payload.get("error") or payload.get("cause") or payload)
307
+ return str(payload)
308
+
309
+
310
+ def record_key(record: Dict[str, Any]) -> str:
311
+ return str(record.get("key") or f"{record.get('provider')}-{record.get('stage')}")
312
+
313
+
314
+ def host_spec(record: Dict[str, Any], root: Path) -> Optional[Dict[str, Any]]:
315
+ """The spec the host was last *deployed* with, else the one last rendered (package / plan rewrite that)."""
316
+ deployed = deployed_host(root, str(record.get("stage") or ""), record)
317
+ if deployed is not None:
318
+ return dict(deployed.get("spec") or {})
319
+ return rendered_spec(Path(root) / WORK_DIR / record_key(record))
320
+
321
+
322
+ def rendered_spec(work_dir: Path) -> Optional[Dict[str, Any]]:
323
+ try:
324
+ spec = json.loads((Path(work_dir) / "onprem_app" / "pskit_host.json").read_text("utf-8"))
325
+ except (OSError, ValueError):
326
+ return None
327
+ return spec if isinstance(spec, dict) else None
328
+
329
+
330
+ # ---------------------------------------------------------------------- where a stage was deployed
331
+ _SPEC_KEYS = ("host", "port", "endpoint", "admin_token", "deploy", "unit_name", "service", "stage")
332
+
333
+
334
+ def deployed_host(
335
+ root: Path, stage: str, record: Optional[Dict[str, Any]] = None
336
+ ) -> Optional[Dict[str, Any]]:
337
+ """``{server, spec, deployed_at}`` written by the last successful ``pskit deploy`` of ``onprem-<stage>``."""
338
+ key = record_key(record) if record else f"onprem-{stage}"
339
+ try:
340
+ data = json.loads((Path(root) / WORK_DIR / key / DEPLOYED_FILE).read_text("utf-8"))
341
+ except (OSError, ValueError):
342
+ return None
343
+ return data if isinstance(data, dict) and isinstance(data.get("spec"), dict) else None
344
+
345
+
346
+ def remember_deploy(work_dir: Path, server: Optional[str], cluster: Optional[str] = None) -> Optional[Dict[str, Any]]:
347
+ """After a successful deploy: keep where the host runs, so trigger / logs / test and the next deploy use it.
348
+ On a scaling cluster ``server`` is its master and ``cluster`` its name."""
349
+ spec = rendered_spec(work_dir)
350
+ if spec is None:
351
+ return None
352
+ data = {
353
+ "server": server or None,
354
+ "cluster": cluster or None,
355
+ "deployed_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
356
+ "spec": {k: spec[k] for k in _SPEC_KEYS if k in spec},
357
+ }
358
+ path = Path(work_dir) / DEPLOYED_FILE
359
+ path.parent.mkdir(parents=True, exist_ok=True)
360
+ path.write_bytes((json.dumps(data, indent=2, sort_keys=True) + "\n").encode("utf-8"))
361
+ return data
362
+
363
+
364
+ def deployed_on(spec: Dict[str, Any], server: Optional[str], cluster: Optional[str] = None) -> Dict[str, Any]:
365
+ """The ``deployed_on`` summary kept in ``deployment.json`` (shown by deploy, info and the studio)."""
366
+ deploy = spec.get("deploy") or {}
367
+ method = str(deploy.get("method") or "local")
368
+ ssh_host = str((deploy.get("ssh") or {}).get("host") or "")
369
+ where = "this machine" if method == "local" or not ssh_host else ssh_host
370
+ label = f"{server} ({where})" if server else where
371
+ if cluster:
372
+ label = f"cluster {cluster} (master {label})"
373
+ return {"server": server or None, "cluster": cluster or None, "method": method, "host": ssh_host or None,
374
+ "label": label, "endpoint": spec.get("endpoint")}
375
+
376
+
377
+ def control_url(spec: Dict[str, Any], record: Optional[Dict[str, Any]] = None) -> str:
378
+ """Loopback for a host on this machine, otherwise the advertised endpoint."""
379
+ from ..runtime.onprem_host import health_url
380
+
381
+ method = str((spec.get("deploy") or {}).get("method") or "local")
382
+ if method == "local":
383
+ return health_url(spec)[: -len("/__pskit/health")]
384
+ endpoint = spec.get("endpoint") or (record or {}).get("endpoint")
385
+ if not endpoint:
386
+ return health_url(spec)[: -len("/__pskit/health")]
387
+ return str(endpoint).rstrip("/")
388
+
389
+
390
+ def _spec_ssh(spec: Dict[str, Any]) -> Tuple[Optional[Dict[str, Any]], str]:
391
+ """The SSH login and remote folder of a host deployed over SSH (also docker on an SSH host)."""
392
+ deploy = spec.get("deploy") or {}
393
+ ssh = deploy.get("ssh") or {}
394
+ if str(deploy.get("method") or "local") == "local" or not ssh.get("host") or not ssh.get("user"):
395
+ return None, ""
396
+ return dict(ssh), str(ssh.get("path") or "")
397
+
398
+
399
+ def control_for_group(record: Dict[str, Any], root: Path, group: str) -> Optional[HostControl]:
400
+ """A client for the host of placement group ``group`` (``provider.options.placement``): each server answers
401
+ only the routes of its own functions. None when the group is the default one (use ``control_for``) or its
402
+ spec is not here."""
403
+ from .onprem_placement import app_dir
404
+
405
+ main = host_spec(record, root) or {}
406
+ default = str(main.get("default_group") or "")
407
+ if not group or not default or group == default:
408
+ return None
409
+ try:
410
+ spec = json.loads((Path(root) / WORK_DIR / record_key(record) / app_dir(group, default) / "pskit_host.json")
411
+ .read_text("utf-8"))
412
+ except (OSError, ValueError):
413
+ return None
414
+ if not isinstance(spec, dict) or not spec.get("endpoint"):
415
+ return None
416
+ ssh, remote_path = _spec_ssh(spec)
417
+ port = int(spec.get("port") or 8080)
418
+ return HostControl(str(spec["endpoint"]), token=str(spec.get("admin_token") or ""), ssh=ssh, remote_port=port,
419
+ remote_path=remote_path)
420
+
421
+
422
+ def control_for(record: Dict[str, Any], root: Path, server: Optional[str] = None) -> Optional[HostControl]:
423
+ """A client for the deployment's host, or None when it is not an on-prem deployment.
424
+
425
+ Without ``server`` this is the host of the last successful deploy (its saved server, SSH host or this
426
+ machine), even after ``package`` / ``plan`` re-rendered the spec for another target. ``server`` (or
427
+ ``PSKIT_DEPLOY_SERVER``, set by ``--server``) picks the host on that saved SSH server instead: the same
428
+ project deployed to several machines. ``local`` picks this machine. A host whose port cannot be reached
429
+ from here is called over SSH.
430
+ """
431
+ import os
432
+
433
+ if record.get("provider") != "onprem":
434
+ return None
435
+ from .onprem_servers import SERVER_ENV, get_server
436
+
437
+ spec = host_spec(record, root)
438
+ deployed = deployed_host(root, str(record.get("stage") or ""), record)
439
+ token = str((spec or {}).get("admin_token") or "")
440
+ port = int((spec or {}).get("port") or 8080)
441
+ name = server or os.environ.get(SERVER_ENV) or None
442
+ if name == LOCAL:
443
+ from ..runtime.onprem_host import health_url
444
+
445
+ return HostControl(health_url({**(spec or {}), "host": "127.0.0.1"})[: -len("/__pskit/health")], token=token)
446
+ if name and name != (deployed or {}).get("server"):
447
+ from .onprem_servers import server_target
448
+ from .onprem_services import ssh_options
449
+
450
+ item = get_server(root, name) # ServerError (a ValueError) for an unknown name
451
+ _ssh, remote_path = _spec_ssh(spec or {})
452
+ return HostControl(f"http://{item['host']}:{port}", token=token, ssh=ssh_options(server_target(root, name)),
453
+ remote_port=port, remote_path=remote_path, server=name)
454
+ if spec is None:
455
+ endpoint = record.get("endpoint")
456
+ if not endpoint:
457
+ return None
458
+ return HostControl(str(endpoint))
459
+ ssh, remote_path = _spec_ssh(spec)
460
+ return HostControl(control_url(spec, record), token=token, ssh=ssh, remote_port=port, remote_path=remote_path,
461
+ server=(deployed or {}).get("server") or None)
@@ -618,14 +618,19 @@ def send(
618
618
  body = (payload if isinstance(payload, str) else _dumps(payload)).encode() if has_body else None
619
619
  headers = {"content-type": "application/json"} if body else {}
620
620
  if provider == "onprem":
621
- from .onprem_control import control_for
621
+ from .onprem_control import control_for, control_for_group
622
622
 
623
623
  # The host of the last deploy (or --server), not the URL in the record: package / plan may have
624
- # re-rendered it for another machine, and a closed port is reached over SSH.
625
- control = control_for(record or {}, project.root)
624
+ # re-rendered it for another machine, and a closed port is reached over SSH. With placement, the
625
+ # host of the function's group: a server answers only the routes of its own functions.
626
+ group_control = control_for_group(record or {}, project.root, str(fn_rec.get("group") or ""))
627
+ control = group_control or control_for(record or {}, project.root)
626
628
  if control is not None:
627
629
  endpoint = str((record or {}).get("endpoint") or "").rstrip("/")
628
- route = url[len(endpoint):] if endpoint and url.startswith(endpoint) else (path or trig["path"])
630
+ if group_control is not None:
631
+ route = path or trig["path"]
632
+ else:
633
+ route = url[len(endpoint):] if endpoint and url.startswith(endpoint) else (path or trig["path"])
629
634
  route = route if route.startswith("/") else "/" + route
630
635
  return {"kind": "http", "url": control.base_url + route,
631
636
  **_host_http(control, trig["method"], route, body, headers)}
@@ -646,6 +651,11 @@ def send(
646
651
  except TriggerError:
647
652
  raise
648
653
  except Exception as exc: # noqa: BLE001 - credentials, permissions, missing resources: report them
654
+ from .onprem_control import FunctionFailed
655
+
656
+ if isinstance(exc, FunctionFailed):
657
+ raise TriggerError(f"{function} raised {exc.error_type}: {exc.cause} (the host is up; the error is in the"
658
+ f" function's code, see pskit logs -f {function})") from None
649
659
  raise TriggerError(f"{type(exc).__name__}: {exc}") from None
650
660
  return {"kind": trig["type"], "summary": trig["summary"], **out}
651
661
 
@@ -2202,8 +2202,12 @@ class Host:
2202
2202
  data = json.loads(raw.decode("utf-8")) if raw else None
2203
2203
  except ValueError:
2204
2204
  data = raw.decode("utf-8", "replace")
2205
+ kind = EventType.INVOKE
2206
+ if isinstance(data, dict) and data.get("__pskit") in (EventType.INVOKE, EventType.SCHEDULE):
2207
+ # pskit trigger / the studio's Test send {"__pskit": kind, "data": ...}: the function gets data.
2208
+ kind, data = data["__pskit"], data.get("data")
2205
2209
  try:
2206
- result = host.invoke(function, Event(type=EventType.INVOKE, data=data, source="onprem.invoke"))
2210
+ result = host.invoke(function, Event(type=kind, data=data, source="onprem.invoke"))
2207
2211
  except KeyError as exc:
2208
2212
  return self._json(404, {"error": str(exc)})
2209
2213
  except Exception as exc: # noqa: BLE001
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pskit",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "py-serverless-kit runtime for Node.js and TypeScript handlers (vendored into every bundle).",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -388,7 +388,11 @@ HANDLER_TEMPLATES: Dict[str, str] = {
388
388
  "http": '''
389
389
 
390
390
  def {func}(event: Event, ctx: Context):
391
- """HTTP handler: event.http has method, path, query, path_params, headers and json()."""
391
+ """HTTP handler: event.http has method, path, query, path_params, headers and json().
392
+
393
+ Also called from a workflow step or invoke(): then event.http is None and event.data is the input."""
394
+ if event.http is None:
395
+ return {{"message": "Hello, world!", "input": event.data}}
392
396
  name = event.http.query.get("name", "world")
393
397
  return {{"message": f"Hello, {{name}}!"}}
394
398
  ''',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: py-serverless-kit
3
- Version: 2.3.2
3
+ Version: 2.3.3
4
4
  Summary: Write a Python serverless function once and deploy it to AWS, Azure, GCP, 7 more clouds, or an on-premises host with one YAML file, powered by Terraform.
5
5
  Project-URL: Homepage, https://github.com/ak9347128658/serverless_kit
6
6
  Project-URL: Documentation, https://github.com/ak9347128658/serverless_kit/tree/main/docs
@@ -1,6 +1,6 @@
1
1
  py_serverless_kit/__init__.py,sha256=S-Cyucn4rdyF0CTv274nSk22vJ6w8PR2yzczIsYUJ_8,1452
2
2
  py_serverless_kit/__main__.py,sha256=efQ6c0zP-ZF8iu2fR2QkuX5LVQTXyn3O-xZlq7cKX5A,38
3
- py_serverless_kit/_version.py,sha256=Pb5ViiprS_0CObV3W2E31peVECp-puAZ-pvfQTARRQw,59
3
+ py_serverless_kit/_version.py,sha256=qBzYFOGddEfQhpo03NIVhsH1GLaiqVeELvIwD86rs-0,59
4
4
  py_serverless_kit/client.py,sha256=mcphnzVZ3jGoFBgv9cU3A5GEav2YBF6MrqRZiD9hQPE,13747
5
5
  py_serverless_kit/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  py_serverless_kit/cli/main.py,sha256=rvmj20DvkQ7eDSYD4_XwuT5BkBo_NPR0FRWTFM6GVKs,141857
@@ -23,7 +23,7 @@ py_serverless_kit/core/onprem_clients.py,sha256=yKVaSHtyBUGMCCgHCDp8ygSbJLHmQGpa
23
23
  py_serverless_kit/core/onprem_cluster.py,sha256=2drUkiURsXFaYmqBT0Yv1301gkPezdN4iOeWazIwNZo,83429
24
24
  py_serverless_kit/core/onprem_cluster_scripts.py,sha256=DA1rr-5ZVmpMazV9DuifaaCFltUQu0rsEFmCtEO6WrA,36764
25
25
  py_serverless_kit/core/onprem_console.py,sha256=RYsx8BOEQIFxJm6Ci9b2TJ12t5gLW4A68Nhw7BYMCCA,16813
26
- py_serverless_kit/core/onprem_control.py,sha256=N_QBlxv5c9kY_at3cRsY37f2RYQ_464n_852qrLsTnc,19118
26
+ py_serverless_kit/core/onprem_control.py,sha256=PQX5VocUzecTJh4_HTBbipl2m46qZ5vo-y5H9nJoIcA,20800
27
27
  py_serverless_kit/core/onprem_lb.py,sha256=U27qX7YR3h15w9RvsEZn1S0IphJSwzVJmPhy0BDaQwU,29110
28
28
  py_serverless_kit/core/onprem_network.py,sha256=gP0EdVI6-XEVPsvfQHeT9Co33kDa79K9CINj66MbJ9M,22442
29
29
  py_serverless_kit/core/onprem_placement.py,sha256=RPpJfTp8xB5a6BKvauk6y37woKUW0OvnNKEZ-ZPG7o0,17289
@@ -41,7 +41,7 @@ py_serverless_kit/core/resource_usage.py,sha256=Qc_Ig69w0tEXkfIA6TxLsIA8tNzeCAoi
41
41
  py_serverless_kit/core/retain.py,sha256=Tjhtsgfod2IPCglPLNhWZLCH6jY76NmMbFeEi-eKYYI,8175
42
42
  py_serverless_kit/core/settings_bundle.py,sha256=qt7bKNiNxfhsJrarAUHFzLGQAauH4z5bAHCe6ha0iMU,19260
43
43
  py_serverless_kit/core/setup_check.py,sha256=9pg99p_R-iLBn066icYatKihHNbMSH23s6ZAWO3EhxY,40853
44
- py_serverless_kit/core/testing.py,sha256=03ZgvuZso4Ll2bqUXqJ9EOB-ZPde3587h7gcSXHi9Lw,47129
44
+ py_serverless_kit/core/testing.py,sha256=Qg8X_1hCAnUYYw3cRoDDQ9IrUpxaRttis_J2JJSwznk,47819
45
45
  py_serverless_kit/core/onprem_templates/kafka_queue.py.txt,sha256=KcnG95vLm0UDINapShNTsLsgsPUG4-pqQ-X2hasvphg,4212
46
46
  py_serverless_kit/core/onprem_templates/nats_queue.py.txt,sha256=pmeuI5l3onupSasaJWMb_GTpoQ7bfW-C_bLZ7jjeIFE,5469
47
47
  py_serverless_kit/core/onprem_templates/rabbitmq_queue.py.txt,sha256=A9B1cxmVZ0980vejKkjl5PY-F1Ep3RlqZCxfyaO8rbg,4644
@@ -89,7 +89,7 @@ py_serverless_kit/runtime/invoke.py,sha256=bDAkAUuXA4DPi_vltwVm-l2xIyahai0Xw853x
89
89
  py_serverless_kit/runtime/log.py,sha256=t1pv2gFquyMoDCPVTJdrXgmv8iI6r0QbWCKNSNSkWoI,2874
90
90
  py_serverless_kit/runtime/manifest.py,sha256=ZEYqytO1eay2kOFfdl1lgLGDqLnMteMJm6ZdzO_aG04,4126
91
91
  py_serverless_kit/runtime/node_worker.py,sha256=zoDbNRJ3hdgSNXYXJv4azfdgyWISrYtRkaoItv0bgmM,11209
92
- py_serverless_kit/runtime/onprem_host.py,sha256=uLd8vWexCwGtVLw-h2vNWRVcYD7bY6-6wUIjsRHalME,133561
92
+ py_serverless_kit/runtime/onprem_host.py,sha256=bvjVivZFeqNMT9k6yfhd5avjuUxbz3cs2VTtn8CVWEg,133882
93
93
  py_serverless_kit/runtime/peers.py,sha256=R2c_rMo6ssF3OJobJYwWdvsXJV2cdigyHZhNFlCMhQM,12164
94
94
  py_serverless_kit/runtime/resources.py,sha256=bEtpeAbjRWDxlA1hF4IPKNwTGW8yVwpPCM-6O62bxsI,3853
95
95
  py_serverless_kit/runtime/response.py,sha256=uybQq5Bdfxndx3iI0yd6uaVcC9Xjg9Lx50k8wrTX61U,6582
@@ -135,7 +135,7 @@ py_serverless_kit/runtime_js/invoke.js,sha256=DHA8vtnzWvP_G49GWT6TCljcUUg0aSOmAE
135
135
  py_serverless_kit/runtime_js/log.js,sha256=VLPNXkumduA1zaG4gsKLBORVlI-wlOtIdSB00p-K0n4,5114
136
136
  py_serverless_kit/runtime_js/manifest.js,sha256=4P_NS3yFc9gn-TTEd2wwhKRqDwXDW4YDaw8ETHIUzFA,4578
137
137
  py_serverless_kit/runtime_js/onprem.js,sha256=PWuQz6xU_boUzrJ75fi00kwkr4IeaIhBHnchDqndmiE,2798
138
- py_serverless_kit/runtime_js/package.json,sha256=tutAxCqPNdPjsKYUWPKhzDd5khF2FhUS24lgsaNLfBw,284
138
+ py_serverless_kit/runtime_js/package.json,sha256=2bHHkobkR3UGty0VIcAKdO6ISnKZ3pnk8wtF9mvObvw,284
139
139
  py_serverless_kit/runtime_js/resources.js,sha256=vqRjf4LhXYTiVMsOBA6SXnBhOvMwhrS2q38i5LqKeP8,3297
140
140
  py_serverless_kit/runtime_js/response.js,sha256=RagfQCspN3jdtyvOKt2F52Rwq8FBT4k_0OKWQYH6Wu4,5800
141
141
  py_serverless_kit/runtime_js/routing.js,sha256=IM8zv0SIYU-d2lXZiup3KPL4Wfqtcec9PEdpSOwKSp4,2084
@@ -161,7 +161,7 @@ py_serverless_kit/studio/discover.py,sha256=Jp6n3ovnIeWBY8g_dZdyuSu0LdHv3mU-tzA_
161
161
  py_serverless_kit/studio/files.py,sha256=WWrw8s4lcuqRKc7MBdKvE2r82ynr0TVqc0h0758r6TU,5042
162
162
  py_serverless_kit/studio/guides.py,sha256=3uf610asllhGC3ZNSLECkfYCTf7_jq9Nj1XYo-jrpP4,2634
163
163
  py_serverless_kit/studio/jobs.py,sha256=Emi2utNLA0uQjm8aHKx_8SLczwmyBtumALJvIu_1PcU,15345
164
- py_serverless_kit/studio/meta.py,sha256=h6QlfJ7BNTPKFA4XD3jkb1Eu895-pHvU-ajsd0W4af0,26158
164
+ py_serverless_kit/studio/meta.py,sha256=SD-8ce9UvBvkEz3WiIpC03wUxVpWJp_N1LXqq2-80eI,26356
165
165
  py_serverless_kit/studio/node_stubs.py,sha256=TDGwRF2WSDbfVsqi-6Qa6lTFGaqvNfGIF3CYJ7rmwPI,7139
166
166
  py_serverless_kit/studio/project.py,sha256=LJYOyRwp4M9oLBI75e-FTqFrt_NfUak-WYbrnAa8IYQ,16748
167
167
  py_serverless_kit/studio/server.py,sha256=FxD4FP3m7P3nV7ZSNiPVMx73csHV-321hBdFB5Ipk5w,48730
@@ -275,8 +275,8 @@ py_serverless_kit/studio/guides/tencent/database.md,sha256=i-ru3zul8msV8Ad2lZyOn
275
275
  py_serverless_kit/studio/guides/tencent/queue.md,sha256=Mn3P_E2i-ubCZL17V2vtAJXKsX6yZsI0Rv3seP6T-Mo,3556
276
276
  py_serverless_kit/studio/guides/tencent/storage.md,sha256=_JarrP9lnwP2TGc7UlWgQ17BbR7-X4A7ERP-W3oeowQ,4074
277
277
  py_serverless_kit/studio/guides/tencent/topic.md,sha256=ZSQ4JhOFLa_MgSoQBT0b0MryFXiJn9YWoeUidluhlYo,3354
278
- py_serverless_kit-2.3.2.dist-info/METADATA,sha256=lG1lrpdLf7nYPjoYVnHUwD8ig9nlMy2l8J3nGrm8peg,21451
279
- py_serverless_kit-2.3.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
280
- py_serverless_kit-2.3.2.dist-info/entry_points.txt,sha256=I-fW8cddXp3EkwMyijn1KuLGZ0MungQBPpjJ5Ey7xuY,110
281
- py_serverless_kit-2.3.2.dist-info/licenses/LICENSE,sha256=GhfSg8Bmq_7wlksflc7XI72zY2Z03FPpPa0GUUHz-8s,1099
282
- py_serverless_kit-2.3.2.dist-info/RECORD,,
278
+ py_serverless_kit-2.3.3.dist-info/METADATA,sha256=bH6eXIdBPEXKNxr5BQmTLouhiWCkPzLYKVhYtJLxkhg,21451
279
+ py_serverless_kit-2.3.3.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
280
+ py_serverless_kit-2.3.3.dist-info/entry_points.txt,sha256=I-fW8cddXp3EkwMyijn1KuLGZ0MungQBPpjJ5Ey7xuY,110
281
+ py_serverless_kit-2.3.3.dist-info/licenses/LICENSE,sha256=GhfSg8Bmq_7wlksflc7XI72zY2Z03FPpPa0GUUHz-8s,1099
282
+ py_serverless_kit-2.3.3.dist-info/RECORD,,