qall-daemon-client 0.1.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.
Files changed (23) hide show
  1. qall_daemon_client-0.1.1/LICENSE +201 -0
  2. qall_daemon_client-0.1.1/PKG-INFO +19 -0
  3. qall_daemon_client-0.1.1/pyproject.toml +30 -0
  4. qall_daemon_client-0.1.1/qall_daemon_client/__init__.py +14 -0
  5. qall_daemon_client-0.1.1/qall_daemon_client/v1/__init__.py +15 -0
  6. qall_daemon_client-0.1.1/qall_daemon_client/v1/client/__init__.py +15 -0
  7. qall_daemon_client-0.1.1/qall_daemon_client/v1/client/base.py +66 -0
  8. qall_daemon_client-0.1.1/qall_daemon_client/v1/client/grpc_client.py +173 -0
  9. qall_daemon_client-0.1.1/qall_daemon_client/v1/client/protobuf/daemon_runtime_api_v1/daemon_runtime_api_v1_pb2.py +99 -0
  10. qall_daemon_client-0.1.1/qall_daemon_client/v1/client/protobuf/daemon_runtime_api_v1/daemon_runtime_api_v1_pb2.pyi +144 -0
  11. qall_daemon_client-0.1.1/qall_daemon_client/v1/client/protobuf/daemon_runtime_api_v1/daemon_runtime_api_v1_pb2_grpc.py +390 -0
  12. qall_daemon_client-0.1.1/qall_daemon_client/v1/objects/__init__.py +18 -0
  13. qall_daemon_client-0.1.1/qall_daemon_client/v1/objects/artifact.py +20 -0
  14. qall_daemon_client-0.1.1/qall_daemon_client/v1/objects/daemon.py +21 -0
  15. qall_daemon_client-0.1.1/qall_daemon_client/v1/objects/task_run.py +30 -0
  16. qall_daemon_client-0.1.1/qall_daemon_client/v1/objects/worker_entry.py +21 -0
  17. qall_daemon_client-0.1.1/qall_daemon_client/versions.py +28 -0
  18. qall_daemon_client-0.1.1/qall_daemon_client.egg-info/PKG-INFO +19 -0
  19. qall_daemon_client-0.1.1/qall_daemon_client.egg-info/SOURCES.txt +21 -0
  20. qall_daemon_client-0.1.1/qall_daemon_client.egg-info/dependency_links.txt +1 -0
  21. qall_daemon_client-0.1.1/qall_daemon_client.egg-info/requires.txt +4 -0
  22. qall_daemon_client-0.1.1/qall_daemon_client.egg-info/top_level.txt +1 -0
  23. qall_daemon_client-0.1.1/setup.cfg +4 -0
@@ -0,0 +1,201 @@
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,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: qall-daemon-client
3
+ Version: 0.1.1
4
+ Summary: Qall daemon client package
5
+ License: Apache-2.0
6
+ Project-URL: Repository, https://github.com/qall-project/qall-daemon
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: dataclasses
16
+ Requires-Dist: googleapis-common-protos>=1.75.0
17
+ Requires-Dist: grpcio>=1.81.1
18
+ Requires-Dist: protobuf>=7.35.1
19
+ Dynamic: license-file
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "qall-daemon-client"
7
+ version = "0.1.1"
8
+ description = "Qall daemon client package"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+ classifiers = [
13
+ "Programming Language :: Python :: 3",
14
+ "Operating System :: OS Independent",
15
+ "Intended Audience :: Developers",
16
+ "Intended Audience :: Science/Research",
17
+ "Topic :: Scientific/Engineering",
18
+ ]
19
+
20
+ dependencies = [
21
+ "dataclasses",
22
+ "googleapis-common-protos>=1.75.0",
23
+ "grpcio>=1.81.1",
24
+ "protobuf>=7.35.1",
25
+ ]
26
+
27
+ [tool.setuptools_scm]
28
+
29
+ [project.urls]
30
+ Repository = "https://github.com/qall-project/qall-daemon"
@@ -0,0 +1,14 @@
1
+ # Copyright 2026 Scaleway
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from qall_daemon_client.v1 import *
@@ -0,0 +1,15 @@
1
+ # Copyright 2026 Scaleway
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from .client import *
15
+ from .objects import *
@@ -0,0 +1,15 @@
1
+ # Copyright 2026 Scaleway
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from .base import DaemonClient
15
+ from .grpc_client import GrpcDaemonClient
@@ -0,0 +1,66 @@
1
+ # Copyright 2026 Scaleway
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from __future__ import annotations
15
+
16
+ from abc import ABC
17
+ from typing import Optional
18
+
19
+ from qall_daemon_client.v1.objects import DaemonInfo, TaskRun, Artifact, WorkerEntry
20
+
21
+
22
+ class DaemonClient(ABC):
23
+
24
+ def __enter__(self):
25
+ raise NotImplementedError
26
+
27
+ def __exit__(self, exc_type, exc_val, exc_tb):
28
+ raise NotImplementedError
29
+
30
+ def get_service_info(self) -> DaemonInfo:
31
+ raise NotImplementedError
32
+
33
+ def create_task_run(
34
+ self,
35
+ task_hash: str,
36
+ artifact_hash: Optional[str] = None,
37
+ parent_task_run_id: Optional[str] = None,
38
+ ) -> TaskRun:
39
+ raise NotImplementedError
40
+
41
+ def get_task_run(self, task_run_id: str) -> TaskRun:
42
+ raise NotImplementedError
43
+
44
+ def create_worker_entry(
45
+ self, worker_hash: str, worker_provider: str, input_format: str
46
+ ) -> WorkerEntry:
47
+ raise NotImplementedError
48
+
49
+ def create_artifact(
50
+ self,
51
+ task_run_id: str,
52
+ payload: bytes,
53
+ ) -> Artifact:
54
+ raise NotImplementedError
55
+
56
+ def download_artifact(self, artifact_hash: str) -> bytes:
57
+ raise NotImplementedError
58
+
59
+ def list_artifacts(self, task_run_id: str) -> list[Artifact]:
60
+ raise NotImplementedError
61
+
62
+ def is_up(self) -> bool:
63
+ try:
64
+ return self.get_service_info() is not None
65
+ except:
66
+ return False
@@ -0,0 +1,173 @@
1
+ # Copyright 2026 Scaleway
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from __future__ import annotations
15
+ from pathlib import Path
16
+
17
+ import grpc
18
+ import time
19
+
20
+ from typing import Optional
21
+
22
+ from google.protobuf import empty_pb2
23
+
24
+ from qall_daemon_client.v1.client.protobuf.daemon_runtime_api_v1 import (
25
+ daemon_runtime_api_v1_pb2 as pb2,
26
+ )
27
+ from qall_daemon_client.v1.client.protobuf.daemon_runtime_api_v1 import (
28
+ daemon_runtime_api_v1_pb2_grpc as pb2_grpc,
29
+ )
30
+ from qall_daemon_client.v1.objects import (
31
+ Artifact,
32
+ DaemonInfo,
33
+ TaskRun,
34
+ TaskRunStatus,
35
+ WorkerEntry,
36
+ )
37
+
38
+ from .base import DaemonClient
39
+
40
+
41
+ class GrpcDaemonClient(DaemonClient):
42
+ """
43
+ gRPC client for Daemon requests.
44
+ """
45
+
46
+ def __init__(
47
+ self,
48
+ url: str = "localhost:50053",
49
+ token: Optional[str] = None,
50
+ local_unified_fs: str = "/tmp/qall_unifs",
51
+ ):
52
+ self.__url = url
53
+ self.__channel: Optional[grpc.Channel] = None
54
+ self.__stub: Optional[pb2_grpc.ApiStub] = None
55
+ self.__token = token
56
+ self.__unifs = Path(local_unified_fs)
57
+
58
+ if not self.__unifs.exists():
59
+ self.__unifs.mkdir(mode=0o774, parents=True)
60
+ self.__unifs.chmod(0o774)
61
+
62
+ def __enter__(self):
63
+ self.connect()
64
+ return self
65
+
66
+ def __exit__(self, exc_type, exc_val, exc_tb):
67
+ self.close()
68
+
69
+ def connect(self):
70
+ self.__channel = grpc.insecure_channel(self.__url)
71
+ self.__stub = pb2_grpc.ApiStub(self.__channel)
72
+
73
+ def close(self):
74
+ if self.__channel:
75
+ self.__channel.close()
76
+ self.__channel = None
77
+ self.__stub = None
78
+
79
+ def get_service_info(self) -> DaemonInfo:
80
+ request = empty_pb2.Empty()
81
+ response = self.__stub.GetServiceInfo(request)
82
+
83
+ return DaemonInfo(name=response.name, version=response.version)
84
+
85
+ def create_worker_entry(
86
+ self, worker_hash: str, worker_provider: str, input_format: str
87
+ ) -> WorkerEntry:
88
+ request = pb2.CreateWorkerEntryRequest(
89
+ worker_hash=worker_hash,
90
+ provider=worker_provider,
91
+ input_format=input_format,
92
+ )
93
+
94
+ response = self.__stub.CreateWorkerEntry(request)
95
+
96
+ return WorkerEntry(
97
+ hash=response.hash,
98
+ provider=response.provider,
99
+ input_format=response.input_format,
100
+ )
101
+
102
+ def create_task_run(
103
+ self,
104
+ task_hash: str,
105
+ artifact_hash: Optional[str] = None,
106
+ parent_task_run_id: Optional[str] = None,
107
+ ) -> TaskRun:
108
+ request = pb2.CreateTaskRunRequest(
109
+ task_hash=task_hash,
110
+ artifact_hash=artifact_hash or "",
111
+ )
112
+ response = self.__stub.CreateTaskRun(request)
113
+
114
+ return TaskRun(id=response.id, status=TaskRunStatus(response.status))
115
+
116
+ def get_task_run(self, task_run_id: str) -> TaskRun:
117
+ request = pb2.GetTaskRunRequest(task_run_id=task_run_id)
118
+ response = self.__stub.GetTaskRun(request)
119
+
120
+ return TaskRun(id=response.id, status=TaskRunStatus(response.status))
121
+
122
+ def wait_for_task_run(
123
+ self,
124
+ task_run_id: str,
125
+ timeout: float = 300.0,
126
+ poll_interval: float = 1.0,
127
+ ) -> TaskRun:
128
+ """
129
+ Blocking call to wait for a task run to end, meaning its status becomes either DONE or ERROR.
130
+ """
131
+
132
+ start_time = time.time()
133
+ while time.time() - start_time < timeout:
134
+ task_run = self.get_task_run(task_run_id)
135
+
136
+ if task_run.status in (TaskRunStatus.DONE, TaskRunStatus.ERROR):
137
+ return task_run
138
+
139
+ time.sleep(poll_interval)
140
+ raise TimeoutError(
141
+ f"Task run {task_run_id} did not complete within {timeout} seconds"
142
+ )
143
+
144
+ def create_artifact(
145
+ self,
146
+ task_run_id: str,
147
+ payload: bytes,
148
+ ) -> Artifact:
149
+ request = pb2.CreateArtifactRequest(
150
+ task_run_id=task_run_id,
151
+ payload=payload,
152
+ )
153
+
154
+ grpc_metadata = (("x-qall-token", self.__token),)
155
+
156
+ response = self.__stub.CreateArtifact(
157
+ request,
158
+ metadata=grpc_metadata,
159
+ )
160
+
161
+ return Artifact(hash=response.hash)
162
+
163
+ def download_artifact(self, artifact_hash: str) -> bytes:
164
+ request = pb2.DownloadArtifactRequest(artifact_hash=artifact_hash)
165
+ response = self.__stub.DownloadArtifact(request)
166
+
167
+ return response.payload
168
+
169
+ def list_artifacts(self, task_run_id: str) -> list[Artifact]:
170
+ request = pb2.ListArtifactsRequest(task_run_id=task_run_id)
171
+ response = self.__stub.ListArtifacts(request)
172
+
173
+ return [Artifact(hash=a.hash) for a in response.artifacts]
@@ -0,0 +1,99 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: daemon-runtime-api-v1.proto
5
+ # Protobuf Python Version: 5.29.0
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+
13
+ _runtime_version.ValidateProtobufRuntimeVersion(
14
+ _runtime_version.Domain.PUBLIC, 5, 29, 0, "", "daemon-runtime-api-v1.proto"
15
+ )
16
+ # @@protoc_insertion_point(imports)
17
+
18
+ _sym_db = _symbol_database.Default()
19
+
20
+
21
+ from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
22
+ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
23
+
24
+
25
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
26
+ b'\n\x1b\x64\x61\x65mon-runtime-api-v1.proto\x12\x15\x64\x61\x65mon_runtime_api_v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/api/annotations.proto"=\n\nDaemonInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x10\n\x08provider\x18\x03 \x01(\t"W\n\x18\x43reateWorkerEntryRequest\x12\x13\n\x0bworker_hash\x18\x01 \x01(\t\x12\x10\n\x08provider\x18\x02 \x01(\t\x12\x14\n\x0cinput_format\x18\x03 \x01(\t"@\n\x14\x43reateTaskRunRequest\x12\x11\n\ttask_hash\x18\x01 \x01(\t\x12\x15\n\rartifact_hash\x18\x02 \x01(\t"\x92\x01\n\x07TaskRun\x12\n\n\x02id\x18\x01 \x01(\t\x12\x35\n\x06status\x18\x02 \x01(\x0e\x32%.daemon_runtime_api_v1.TaskRun.Status"D\n\x06Status\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0b\n\x07PENDING\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\x08\n\x04\x44ONE\x10\x03\x12\t\n\x05\x45RROR\x10\x04"(\n\x11GetTaskRunRequest\x12\x13\n\x0btask_run_id\x18\x01 \x01(\t"=\n\x15\x43reateArtifactRequest\x12\x13\n\x0btask_run_id\x18\x01 \x01(\t\x12\x0f\n\x07payload\x18\x02 \x01(\x0c"+\n\x14ListArtifactsRequest\x12\x13\n\x0btask_run_id\x18\x01 \x01(\t"0\n\x17\x44ownloadArtifactRequest\x12\x15\n\rartifact_hash\x18\x01 \x01(\t"\x18\n\x08\x41rtifact\x12\x0c\n\x04hash\x18\x01 \x01(\t""\n\x0f\x41rtifactPayload\x12\x0f\n\x07payload\x18\x01 \x01(\x0c"K\n\x15ListArtifactsResponse\x12\x32\n\tartifacts\x18\x01 \x03(\x0b\x32\x1f.daemon_runtime_api_v1.Artifact"C\n\x0bWorkerEntry\x12\x0c\n\x04hash\x18\x01 \x01(\t\x12\x10\n\x08provider\x18\x02 \x01(\t\x12\x14\n\x0cinput_format\x18\x03 \x01(\t2\xeb\x06\n\x03\x41pi\x12X\n\x0eGetServiceInfo\x12\x16.google.protobuf.Empty\x1a!.daemon_runtime_api_v1.DaemonInfo"\x0b\x82\xd3\xe4\x93\x02\x05\x12\x03/v1\x12\x80\x01\n\x11\x43reateWorkerEntry\x12/.daemon_runtime_api_v1.CreateWorkerEntryRequest\x1a".daemon_runtime_api_v1.WorkerEntry"\x16\x82\xd3\xe4\x93\x02\x10"\x0b/v1/workers:\x01*\x12v\n\rCreateTaskRun\x12+.daemon_runtime_api_v1.CreateTaskRunRequest\x1a\x1e.daemon_runtime_api_v1.TaskRun"\x18\x82\xd3\xe4\x93\x02\x12"\r/v1/task_runs:\x01*\x12|\n\nGetTaskRun\x12(.daemon_runtime_api_v1.GetTaskRunRequest\x1a\x1e.daemon_runtime_api_v1.TaskRun"$\x82\xd3\xe4\x93\x02\x1e\x12\x1c/v1/tasks_runs/{task_run_id}\x12y\n\x0e\x43reateArtifact\x12,.daemon_runtime_api_v1.CreateArtifactRequest\x1a\x1f.daemon_runtime_api_v1.Artifact"\x18\x82\xd3\xe4\x93\x02\x12"\r/v1/artifacts:\x01*\x12\x91\x01\n\x10\x44ownloadArtifact\x12..daemon_runtime_api_v1.DownloadArtifactRequest\x1a&.daemon_runtime_api_v1.ArtifactPayload"%\x82\xd3\xe4\x93\x02\x1f\x12\x1d/v1/artifacts/{artifact_hash}\x12\x81\x01\n\rListArtifacts\x12+.daemon_runtime_api_v1.ListArtifactsRequest\x1a,.daemon_runtime_api_v1.ListArtifactsResponse"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/v1/artifactsB0Z.internal/server/protobuf/daemon_runtime_api_v1b\x06proto3'
27
+ )
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(
32
+ DESCRIPTOR, "daemon_runtime_api_v1_pb2", _globals
33
+ )
34
+ if not _descriptor._USE_C_DESCRIPTORS:
35
+ _globals["DESCRIPTOR"]._loaded_options = None
36
+ _globals["DESCRIPTOR"]._serialized_options = (
37
+ b"Z.internal/server/protobuf/daemon_runtime_api_v1"
38
+ )
39
+ _globals["_API"].methods_by_name["GetServiceInfo"]._loaded_options = None
40
+ _globals["_API"].methods_by_name[
41
+ "GetServiceInfo"
42
+ ]._serialized_options = b"\202\323\344\223\002\005\022\003/v1"
43
+ _globals["_API"].methods_by_name["CreateWorkerEntry"]._loaded_options = None
44
+ _globals["_API"].methods_by_name[
45
+ "CreateWorkerEntry"
46
+ ]._serialized_options = b'\202\323\344\223\002\020"\013/v1/workers:\001*'
47
+ _globals["_API"].methods_by_name["CreateTaskRun"]._loaded_options = None
48
+ _globals["_API"].methods_by_name[
49
+ "CreateTaskRun"
50
+ ]._serialized_options = b'\202\323\344\223\002\022"\r/v1/task_runs:\001*'
51
+ _globals["_API"].methods_by_name["GetTaskRun"]._loaded_options = None
52
+ _globals["_API"].methods_by_name[
53
+ "GetTaskRun"
54
+ ]._serialized_options = (
55
+ b"\202\323\344\223\002\036\022\034/v1/tasks_runs/{task_run_id}"
56
+ )
57
+ _globals["_API"].methods_by_name["CreateArtifact"]._loaded_options = None
58
+ _globals["_API"].methods_by_name[
59
+ "CreateArtifact"
60
+ ]._serialized_options = b'\202\323\344\223\002\022"\r/v1/artifacts:\001*'
61
+ _globals["_API"].methods_by_name["DownloadArtifact"]._loaded_options = None
62
+ _globals["_API"].methods_by_name[
63
+ "DownloadArtifact"
64
+ ]._serialized_options = (
65
+ b"\202\323\344\223\002\037\022\035/v1/artifacts/{artifact_hash}"
66
+ )
67
+ _globals["_API"].methods_by_name["ListArtifacts"]._loaded_options = None
68
+ _globals["_API"].methods_by_name[
69
+ "ListArtifacts"
70
+ ]._serialized_options = b"\202\323\344\223\002\017\022\r/v1/artifacts"
71
+ _globals["_DAEMONINFO"]._serialized_start = 113
72
+ _globals["_DAEMONINFO"]._serialized_end = 174
73
+ _globals["_CREATEWORKERENTRYREQUEST"]._serialized_start = 176
74
+ _globals["_CREATEWORKERENTRYREQUEST"]._serialized_end = 263
75
+ _globals["_CREATETASKRUNREQUEST"]._serialized_start = 265
76
+ _globals["_CREATETASKRUNREQUEST"]._serialized_end = 329
77
+ _globals["_TASKRUN"]._serialized_start = 332
78
+ _globals["_TASKRUN"]._serialized_end = 478
79
+ _globals["_TASKRUN_STATUS"]._serialized_start = 410
80
+ _globals["_TASKRUN_STATUS"]._serialized_end = 478
81
+ _globals["_GETTASKRUNREQUEST"]._serialized_start = 480
82
+ _globals["_GETTASKRUNREQUEST"]._serialized_end = 520
83
+ _globals["_CREATEARTIFACTREQUEST"]._serialized_start = 522
84
+ _globals["_CREATEARTIFACTREQUEST"]._serialized_end = 583
85
+ _globals["_LISTARTIFACTSREQUEST"]._serialized_start = 585
86
+ _globals["_LISTARTIFACTSREQUEST"]._serialized_end = 628
87
+ _globals["_DOWNLOADARTIFACTREQUEST"]._serialized_start = 630
88
+ _globals["_DOWNLOADARTIFACTREQUEST"]._serialized_end = 678
89
+ _globals["_ARTIFACT"]._serialized_start = 680
90
+ _globals["_ARTIFACT"]._serialized_end = 704
91
+ _globals["_ARTIFACTPAYLOAD"]._serialized_start = 706
92
+ _globals["_ARTIFACTPAYLOAD"]._serialized_end = 740
93
+ _globals["_LISTARTIFACTSRESPONSE"]._serialized_start = 742
94
+ _globals["_LISTARTIFACTSRESPONSE"]._serialized_end = 817
95
+ _globals["_WORKERENTRY"]._serialized_start = 819
96
+ _globals["_WORKERENTRY"]._serialized_end = 886
97
+ _globals["_API"]._serialized_start = 889
98
+ _globals["_API"]._serialized_end = 1764
99
+ # @@protoc_insertion_point(module_scope)