aixand-suite-runner-client 0.1.0a1__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.
@@ -0,0 +1,171 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with that
17
+ entity. For the purposes of this definition, "control" means (i) the power,
18
+ direct or indirect, to cause the direction or management of such entity,
19
+ whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or
20
+ more of the outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications,
26
+ including but not limited to software source code, documentation source, and
27
+ configuration files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object
31
+ code, generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original
45
+ version of the Work and any modifications or additions to that Work or
46
+ Derivative Works thereof, that is intentionally submitted to Licensor for
47
+ inclusion in the Work by the copyright owner or by an individual or Legal
48
+ Entity authorized to submit on behalf of the copyright owner. For the purposes
49
+ of this definition, "submitted" means any form of electronic, verbal, or written
50
+ communication sent to the Licensor or its representatives, including but not
51
+ limited to communication on electronic mailing lists, source code control
52
+ systems, and issue tracking systems that are managed by, or on behalf of, the
53
+ Licensor for the purpose of discussing and improving the Work, but excluding
54
+ communication that is conspicuously marked or otherwise designated in writing by
55
+ the copyright owner as "Not a Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License.
62
+
63
+ Subject to the terms and conditions of this License, each Contributor hereby
64
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
65
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
66
+ publicly display, publicly perform, sublicense, and distribute the Work and such
67
+ Derivative Works in Source or Object form.
68
+
69
+ 3. Grant of Patent License.
70
+
71
+ Subject to the terms and conditions of this License, each Contributor hereby
72
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
73
+ irrevocable patent license to make, have made, use, offer to sell, sell, import,
74
+ and otherwise transfer the Work, where such license applies only to those patent
75
+ claims licensable by such Contributor that are necessarily infringed by their
76
+ Contribution(s) alone or by combination of their Contribution(s) with the Work
77
+ to which such Contribution(s) was submitted. If You institute patent litigation
78
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
79
+ alleging that the Work or a Contribution incorporated within the Work
80
+ constitutes direct or contributory patent infringement, then any patent licenses
81
+ granted to You under this License for that Work shall terminate as of the date
82
+ such litigation is filed.
83
+
84
+ 4. Redistribution.
85
+
86
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
87
+ in any medium, with or without modifications, and in Source or Object form,
88
+ provided that You meet the following conditions:
89
+
90
+ (a) You must give any other recipients of the Work or Derivative Works a copy
91
+ of this License; and
92
+
93
+ (b) You must cause any modified files to carry prominent notices stating that
94
+ You changed the files; and
95
+
96
+ (c) You must retain, in the Source form of any Derivative Works that You
97
+ distribute, all copyright, patent, trademark, and attribution notices from the
98
+ Source form of the Work, excluding those notices that do not pertain to any part
99
+ of the Derivative Works; and
100
+
101
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
102
+ any Derivative Works that You distribute must include a readable copy of the
103
+ attribution notices contained within such NOTICE file, excluding those notices
104
+ that do not pertain to any part of the Derivative Works, in at least one of the
105
+ following places: within a NOTICE text file distributed as part of the
106
+ Derivative Works; within the Source form or documentation, if provided along
107
+ with the Derivative Works; or within a display generated by the Derivative
108
+ Works, if and wherever such third-party notices normally appear. The contents of
109
+ the NOTICE file are for informational purposes only and do not modify the
110
+ License. You may add Your own attribution notices within Derivative Works that
111
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
112
+ provided that such additional attribution notices cannot be construed as
113
+ modifying the License.
114
+
115
+ You may add Your own copyright statement to Your modifications and may provide
116
+ additional or different license terms and conditions for use, reproduction, or
117
+ distribution of Your modifications, or for any such Derivative Works as a whole,
118
+ provided Your use, reproduction, and distribution of the Work otherwise complies
119
+ with the conditions stated in this License.
120
+
121
+ 5. Submission of Contributions.
122
+
123
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
124
+ for inclusion in the Work by You to the Licensor shall be under the terms and
125
+ conditions of this License, without any additional terms or conditions.
126
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
127
+ any separate license agreement you may have executed with Licensor regarding
128
+ such Contributions.
129
+
130
+ 6. Trademarks.
131
+
132
+ This License does not grant permission to use the trade names, trademarks,
133
+ service marks, or product names of the Licensor, except as required for
134
+ reasonable and customary use in describing the origin of the Work and
135
+ reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty.
138
+
139
+ Unless required by applicable law or agreed to in writing, Licensor provides the
140
+ Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
141
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
142
+ including, without limitation, any warranties or conditions of TITLE,
143
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
144
+ solely responsible for determining the appropriateness of using or
145
+ redistributing the Work and assume any risks associated with Your exercise of
146
+ permissions under this License.
147
+
148
+ 8. Limitation of Liability.
149
+
150
+ In no event and under no legal theory, whether in tort (including negligence),
151
+ contract, or otherwise, unless required by applicable law (such as deliberate
152
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
153
+ liable to You for damages, including any direct, indirect, special, incidental,
154
+ or consequential damages of any character arising as a result of this License or
155
+ out of the use or inability to use the Work (including but not limited to
156
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
157
+ any and all other commercial damages or losses), even if such Contributor has
158
+ been advised of the possibility of such damages.
159
+
160
+ 9. Accepting Warranty or Additional Liability.
161
+
162
+ While redistributing the Work or Derivative Works thereof, You may choose to
163
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
164
+ other liability obligations and/or rights consistent with this License. However,
165
+ in accepting such obligations, You may act only on Your own behalf and on Your
166
+ sole responsibility, not on behalf of any other Contributor, and only if You
167
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
168
+ incurred by, or claims asserted against, such Contributor by reason of your
169
+ accepting any such warranty or additional liability.
170
+
171
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: aixand-suite-runner-client
3
+ Version: 0.1.0a1
4
+ Summary: Standard-library Python client for the local Aixand job runner
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: aixand-lib-local-runtime<0.2,>=0.1.0b0
10
+ Dynamic: license-file
11
+
12
+ # Aixand Runner Client
13
+
14
+ Python client for the local Aixand job runner. Install the `aixand-suite-runner-client`
15
+ package in a Python 3.11 or newer application environment and import `runner_client`.
16
+ The Runner service is installed separately; this library does not install or
17
+ start a service. See the [Runner documentation](https://github.com/Aixand/aixand-suite/tree/main/workflow/runner)
18
+ for its protocol, installation and lifecycle.
@@ -0,0 +1,7 @@
1
+ # Aixand Runner Client
2
+
3
+ Python client for the local Aixand job runner. Install the `aixand-suite-runner-client`
4
+ package in a Python 3.11 or newer application environment and import `runner_client`.
5
+ The Runner service is installed separately; this library does not install or
6
+ start a service. See the [Runner documentation](https://github.com/Aixand/aixand-suite/tree/main/workflow/runner)
7
+ for its protocol, installation and lifecycle.
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: aixand-suite-runner-client
3
+ Version: 0.1.0a1
4
+ Summary: Standard-library Python client for the local Aixand job runner
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: aixand-lib-local-runtime<0.2,>=0.1.0b0
10
+ Dynamic: license-file
11
+
12
+ # Aixand Runner Client
13
+
14
+ Python client for the local Aixand job runner. Install the `aixand-suite-runner-client`
15
+ package in a Python 3.11 or newer application environment and import `runner_client`.
16
+ The Runner service is installed separately; this library does not install or
17
+ start a service. See the [Runner documentation](https://github.com/Aixand/aixand-suite/tree/main/workflow/runner)
18
+ for its protocol, installation and lifecycle.
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ runner_client.py
5
+ aixand_suite_runner_client.egg-info/PKG-INFO
6
+ aixand_suite_runner_client.egg-info/SOURCES.txt
7
+ aixand_suite_runner_client.egg-info/dependency_links.txt
8
+ aixand_suite_runner_client.egg-info/requires.txt
9
+ aixand_suite_runner_client.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ aixand-lib-local-runtime<0.2,>=0.1.0b0
@@ -0,0 +1,16 @@
1
+ [build-system]
2
+ requires = ["setuptools==80.9.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "aixand-suite-runner-client"
7
+ version = "0.1.0a1"
8
+ description = "Standard-library Python client for the local Aixand job runner"
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.11"
13
+ dependencies = ["aixand-lib-local-runtime>=0.1.0b0,<0.2"]
14
+
15
+ [tool.setuptools]
16
+ py-modules = ["runner_client"]
@@ -0,0 +1,117 @@
1
+ """Local Runner protocol client. No agent, IR, or HTTP dependencies."""
2
+ import json
3
+ import os
4
+ from pathlib import Path
5
+ from aixand_local_runtime import connect_local
6
+ import time
7
+
8
+
9
+ class RunnerError(RuntimeError):
10
+ def __init__(self, error):
11
+ self.code = error["code"]
12
+ self.details = error.get("details")
13
+ super().__init__(f"{self.code}: {error['message']}")
14
+
15
+
16
+ class Client:
17
+ def __init__(self, home=None, *, timeout=30):
18
+ if home is None:
19
+ home = os.environ.get("RUNNER_HOME")
20
+ if home is None:
21
+ if os.name == "nt" and "XDG_STATE_HOME" not in os.environ:
22
+ home = Path(os.environ.get("LOCALAPPDATA", Path.home() / "AppData/Local")) / "Aixand/Runner"
23
+ else:
24
+ home = Path(os.environ.get("XDG_STATE_HOME", Path.home() / ".local/state")) / "runner"
25
+ self.socket_path = str(Path(home) / "runner.sock")
26
+ self.timeout = timeout
27
+
28
+ def request(self, op, **fields):
29
+ payload = json.dumps(dict(op=op, **fields), allow_nan=False).encode() + b"\n"
30
+ if len(payload) > 4 * 1024 * 1024:
31
+ raise ValueError("Request exceeds 4 MiB")
32
+ with connect_local(self.socket_path, timeout=self.timeout) as connection:
33
+ connection.sendall(payload)
34
+ with connection.makefile("rb") as reader:
35
+ raw = reader.readline(16 * 1024 * 1024 + 1)
36
+ if len(raw) > 16 * 1024 * 1024 or not raw.endswith(b"\n"):
37
+ raise ValueError("Invalid or oversized Runner response")
38
+ response = json.loads(raw)
39
+ if not response["ok"]:
40
+ raise RunnerError(response["error"])
41
+ return response["data"]
42
+
43
+ def health(self):
44
+ return self.request("health")
45
+
46
+ def submit(self, workflow, inputs=None, *, key, metadata=None):
47
+ """Reuse key after a timeout: the original submission may have committed."""
48
+ return self.request("submit", submission=dict(
49
+ key=key, workflow=workflow,
50
+ inputs={} if inputs is None else inputs,
51
+ metadata={} if metadata is None else metadata,
52
+ ))
53
+
54
+ def list(self, *, after=0, limit=100):
55
+ return self.request("list", after=after, limit=limit)["jobs"]
56
+
57
+ def inspect(self, job_id):
58
+ return self.request("inspect", id=job_id)
59
+
60
+ def lookup(self, key):
61
+ return self.request("lookup", key=key)
62
+
63
+ def result(self, job_id):
64
+ return self.request("result", id=job_id)
65
+
66
+ def cancel(self, job_id):
67
+ return self.request("cancel", id=job_id)
68
+
69
+ def cancel_key(self, key):
70
+ """Cancel accepted work or prevent a pending submission from being accepted."""
71
+ return self.request("cancel_key", key=key)
72
+
73
+ def resume(self, job_id):
74
+ """Reconcile an uncertain native workflow using its existing effect identities."""
75
+ return self.request("resume", id=job_id)
76
+
77
+ def events(self, job_id, *, after=0, limit=100):
78
+ return self.request("events", id=job_id, after=after, limit=limit)
79
+
80
+ def plan(self, job_id):
81
+ return self.request("plan", id=job_id)
82
+
83
+ def amend(self, job_id, workflow, *, key, expected_revision, authoring=None):
84
+ return self.request("amend", id=job_id, key=key, expected_revision=expected_revision,
85
+ workflow=workflow, authoring=authoring)
86
+
87
+ def hold(self, job_id):
88
+ return self.request("hold", id=job_id)
89
+
90
+ def enable_edits(self, job_id, *, key, authoring=None, groups=None, identities=None):
91
+ return self.request("enable_edits", id=job_id, key=key, authoring=authoring,
92
+ groups={} if groups is None else groups, identities={} if identities is None else identities)
93
+
94
+ def release(self, job_id):
95
+ return self.request("release", id=job_id)
96
+
97
+ def continue_with(self, job_id, target, *, key, input_map=None):
98
+ return self.request("continue", id=job_id, key=key, target=target,
99
+ input_map={} if input_map is None else input_map)
100
+
101
+ def continuations(self, job_id):
102
+ return self.request("continuations", id=job_id)["continuations"]
103
+
104
+ def cancel_continuation(self, continuation_id):
105
+ return self.request("cancel_continuation", id=continuation_id)
106
+
107
+ def follow(self, job_id, *, after=0, poll_interval=0.25):
108
+ """Yield retained events until the job settles, including uncertainty."""
109
+ while True:
110
+ page = self.events(job_id, after=after)
111
+ yield from page["events"]
112
+ after = page["next_after"]
113
+ if page["has_more"]:
114
+ continue
115
+ if page["state"] not in {"queued", "running"}:
116
+ return
117
+ time.sleep(poll_interval)
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+