cap-sdk-python 0.1.0__tar.gz → 1.0.6__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.
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/PKG-INFO +59 -59
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/agent/v1/alert_pb2.py +15 -5
- cap_sdk_python-1.0.6/cap/pb/cortex/agent/v1/alert_pb2_grpc.py +24 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/agent/v1/buspacket_pb2.py +15 -5
- cap_sdk_python-1.0.6/cap/pb/cortex/agent/v1/buspacket_pb2_grpc.py +24 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/agent/v1/heartbeat_pb2.py +15 -5
- cap_sdk_python-1.0.6/cap/pb/cortex/agent/v1/heartbeat_pb2_grpc.py +24 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/agent/v1/job_pb2.py +16 -6
- cap_sdk_python-1.0.6/cap/pb/cortex/agent/v1/job_pb2_grpc.py +24 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/agent/v1/safety_pb2.py +15 -5
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/agent/v1/safety_pb2_grpc.py +35 -4
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap_sdk_python.egg-info/PKG-INFO +59 -59
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/pyproject.toml +1 -1
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/setup.cfg +4 -4
- cap_sdk_python-0.1.0/cap/pb/cortex/agent/v1/alert_pb2_grpc.py +0 -4
- cap_sdk_python-0.1.0/cap/pb/cortex/agent/v1/buspacket_pb2_grpc.py +0 -4
- cap_sdk_python-0.1.0/cap/pb/cortex/agent/v1/heartbeat_pb2_grpc.py +0 -4
- cap_sdk_python-0.1.0/cap/pb/cortex/agent/v1/job_pb2_grpc.py +0 -4
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/README.md +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/__init__.py +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/bus.py +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/client.py +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/__init__.py +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/__init__.py +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/agent/__init__.py +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/pb/cortex/agent/v1/__init__.py +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap/worker.py +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap_sdk_python.egg-info/SOURCES.txt +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap_sdk_python.egg-info/dependency_links.txt +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap_sdk_python.egg-info/requires.txt +0 -0
- {cap_sdk_python-0.1.0 → cap_sdk_python-1.0.6}/cap_sdk_python.egg-info/top_level.txt +0 -0
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: cap-sdk-python
|
|
3
|
-
Version:
|
|
4
|
-
Summary: CAP (Cortex Agent Protocol) Python SDK
|
|
5
|
-
Project-URL: Homepage, https://github.com/coretexos/cap
|
|
6
|
-
Requires-Python: >=3.9
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
Requires-Dist: protobuf>=4.25.0
|
|
9
|
-
Requires-Dist: grpcio>=1.59.0
|
|
10
|
-
Requires-Dist: nats-py>=2.6.0
|
|
11
|
-
|
|
12
|
-
# CAP Python SDK
|
|
13
|
-
|
|
14
|
-
Asyncio-first SDK with NATS helpers for CAP workers and clients.
|
|
15
|
-
|
|
16
|
-
## Quick Start
|
|
17
|
-
1. Generate protobuf stubs into this SDK (one-time per proto change):
|
|
18
|
-
```bash
|
|
19
|
-
python -m grpc_tools.protoc \
|
|
20
|
-
-I../../proto \
|
|
21
|
-
--python_out=./cap/pb \
|
|
22
|
-
--grpc_python_out=./cap/pb \
|
|
23
|
-
../../proto/cortex/agent/v1/*.proto
|
|
24
|
-
```
|
|
25
|
-
(Or run `./tools/make_protos.sh` from repo root and copy `generated/python` into `sdk/python/cap/pb`.)
|
|
26
|
-
|
|
27
|
-
2. Install:
|
|
28
|
-
```bash
|
|
29
|
-
pip install -e .
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
3. Run a worker:
|
|
33
|
-
```python
|
|
34
|
-
import asyncio
|
|
35
|
-
from cap import worker
|
|
36
|
-
from cap.pb.cortex.agent.v1 import job_pb2
|
|
37
|
-
|
|
38
|
-
async def handle(req: job_pb2.JobRequest):
|
|
39
|
-
return job_pb2.JobResult(
|
|
40
|
-
job_id=req.job_id,
|
|
41
|
-
status=job_pb2.JOB_STATUS_SUCCEEDED,
|
|
42
|
-
result_ptr=f"redis://res/{req.job_id}",
|
|
43
|
-
worker_id="worker-echo-1",
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
asyncio.run(worker.run_worker("nats://127.0.0.1:4222", "job.echo", handle))
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Files
|
|
50
|
-
- `cap/bus.py` — NATS connector.
|
|
51
|
-
- `cap/worker.py` — worker skeleton with handler hook.
|
|
52
|
-
- `cap/client.py` — publish JobRequest to `sys.job.submit`.
|
|
53
|
-
- `cap/pb/` — protobuf stubs (generated).
|
|
54
|
-
|
|
55
|
-
## Defaults
|
|
56
|
-
- Subjects: `sys.job.submit`, `sys.job.result`, `sys.heartbeat`.
|
|
57
|
-
- Protocol version: `1`.
|
|
58
|
-
|
|
59
|
-
Swap out `cap.bus` if you need a different transport.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cap-sdk-python
|
|
3
|
+
Version: 1.0.6
|
|
4
|
+
Summary: CAP (Cortex Agent Protocol) Python SDK
|
|
5
|
+
Project-URL: Homepage, https://github.com/coretexos/cap
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: protobuf>=4.25.0
|
|
9
|
+
Requires-Dist: grpcio>=1.59.0
|
|
10
|
+
Requires-Dist: nats-py>=2.6.0
|
|
11
|
+
|
|
12
|
+
# CAP Python SDK
|
|
13
|
+
|
|
14
|
+
Asyncio-first SDK with NATS helpers for CAP workers and clients.
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
1. Generate protobuf stubs into this SDK (one-time per proto change):
|
|
18
|
+
```bash
|
|
19
|
+
python -m grpc_tools.protoc \
|
|
20
|
+
-I../../proto \
|
|
21
|
+
--python_out=./cap/pb \
|
|
22
|
+
--grpc_python_out=./cap/pb \
|
|
23
|
+
../../proto/cortex/agent/v1/*.proto
|
|
24
|
+
```
|
|
25
|
+
(Or run `./tools/make_protos.sh` from repo root and copy `generated/python` into `sdk/python/cap/pb`.)
|
|
26
|
+
|
|
27
|
+
2. Install:
|
|
28
|
+
```bash
|
|
29
|
+
pip install -e .
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. Run a worker:
|
|
33
|
+
```python
|
|
34
|
+
import asyncio
|
|
35
|
+
from cap import worker
|
|
36
|
+
from cap.pb.cortex.agent.v1 import job_pb2
|
|
37
|
+
|
|
38
|
+
async def handle(req: job_pb2.JobRequest):
|
|
39
|
+
return job_pb2.JobResult(
|
|
40
|
+
job_id=req.job_id,
|
|
41
|
+
status=job_pb2.JOB_STATUS_SUCCEEDED,
|
|
42
|
+
result_ptr=f"redis://res/{req.job_id}",
|
|
43
|
+
worker_id="worker-echo-1",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
asyncio.run(worker.run_worker("nats://127.0.0.1:4222", "job.echo", handle))
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Files
|
|
50
|
+
- `cap/bus.py` — NATS connector.
|
|
51
|
+
- `cap/worker.py` — worker skeleton with handler hook.
|
|
52
|
+
- `cap/client.py` — publish JobRequest to `sys.job.submit`.
|
|
53
|
+
- `cap/pb/` — protobuf stubs (generated).
|
|
54
|
+
|
|
55
|
+
## Defaults
|
|
56
|
+
- Subjects: `sys.job.submit`, `sys.job.result`, `sys.heartbeat`.
|
|
57
|
+
- Protocol version: `1`.
|
|
58
|
+
|
|
59
|
+
Swap out `cap.bus` if you need a different transport.
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
3
4
|
# source: cortex/agent/v1/alert.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
5
6
|
"""Generated protocol buffer code."""
|
|
6
7
|
from google.protobuf import descriptor as _descriptor
|
|
7
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
8
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'cortex/agent/v1/alert.proto'
|
|
19
|
+
)
|
|
10
20
|
# @@protoc_insertion_point(imports)
|
|
11
21
|
|
|
12
22
|
_sym_db = _symbol_database.Default()
|
|
@@ -14,14 +24,14 @@ _sym_db = _symbol_database.Default()
|
|
|
14
24
|
|
|
15
25
|
|
|
16
26
|
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x63ortex/agent/v1/alert.proto\x12\x0f\x63ortex.agent.v1\"N\n\x0bSystemAlert\x12\r\n\x05level\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x11\n\tcomponent\x18\x03 \x01(\t\x12\x0c\n\x04\x63ode\x18\x04 \x01(\tB
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x63ortex/agent/v1/alert.proto\x12\x0f\x63ortex.agent.v1\"N\n\x0bSystemAlert\x12\r\n\x05level\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x11\n\tcomponent\x18\x03 \x01(\t\x12\x0c\n\x04\x63ode\x18\x04 \x01(\tB\x7f\n\x16\x61i.cortex.cap.agent.v1P\x01Z+github.com/coretexos/cap/go/cortex/agent/v1\xaa\x02\x0f\x43ortex.Agent.V1\xca\x02\x0f\x43ortex\\Agent\\V1\xea\x02\x11\x43ortex::Agent::V1b\x06proto3')
|
|
18
28
|
|
|
19
29
|
_globals = globals()
|
|
20
30
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
31
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cortex.agent.v1.alert_pb2', _globals)
|
|
22
|
-
if _descriptor._USE_C_DESCRIPTORS
|
|
23
|
-
_globals['DESCRIPTOR'].
|
|
24
|
-
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z+github.com/coretexos/cap/go/cortex/agent/v1\252\002\017Cortex.Agent.V1\312\002\017Cortex\\Agent\\V1\352\002\021Cortex::Agent::V1'
|
|
25
35
|
_globals['_SYSTEMALERT']._serialized_start=48
|
|
26
36
|
_globals['_SYSTEMALERT']._serialized_end=126
|
|
27
37
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
GRPC_GENERATED_VERSION = '1.76.0'
|
|
8
|
+
GRPC_VERSION = grpc.__version__
|
|
9
|
+
_version_not_supported = False
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from grpc._utilities import first_version_is_lower
|
|
13
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
14
|
+
except ImportError:
|
|
15
|
+
_version_not_supported = True
|
|
16
|
+
|
|
17
|
+
if _version_not_supported:
|
|
18
|
+
raise RuntimeError(
|
|
19
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
20
|
+
+ ' but the generated code in cortex/agent/v1/alert_pb2_grpc.py depends on'
|
|
21
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
22
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
23
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
24
|
+
)
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
3
4
|
# source: cortex/agent/v1/buspacket.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
5
6
|
"""Generated protocol buffer code."""
|
|
6
7
|
from google.protobuf import descriptor as _descriptor
|
|
7
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
8
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'cortex/agent/v1/buspacket.proto'
|
|
19
|
+
)
|
|
10
20
|
# @@protoc_insertion_point(imports)
|
|
11
21
|
|
|
12
22
|
_sym_db = _symbol_database.Default()
|
|
@@ -18,14 +28,14 @@ from cortex.agent.v1 import heartbeat_pb2 as cortex_dot_agent_dot_v1_dot_heartbe
|
|
|
18
28
|
from cortex.agent.v1 import alert_pb2 as cortex_dot_agent_dot_v1_dot_alert__pb2
|
|
19
29
|
|
|
20
30
|
|
|
21
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x63ortex/agent/v1/buspacket.proto\x12\x0f\x63ortex.agent.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19\x63ortex/agent/v1/job.proto\x1a\x1f\x63ortex/agent/v1/heartbeat.proto\x1a\x1b\x63ortex/agent/v1/alert.proto\"\xcb\x02\n\tBusPacket\x12\x10\n\x08trace_id\x18\x01 \x01(\t\x12\x11\n\tsender_id\x18\x02 \x01(\t\x12.\n\ncreated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x18\n\x10protocol_version\x18\x04 \x01(\x05\x12\x32\n\x0bjob_request\x18\n \x01(\x0b\x32\x1b.cortex.agent.v1.JobRequestH\x00\x12\x30\n\njob_result\x18\x0b \x01(\x0b\x32\x1a.cortex.agent.v1.JobResultH\x00\x12/\n\theartbeat\x18\x0c \x01(\x0b\x32\x1a.cortex.agent.v1.HeartbeatH\x00\x12-\n\x05\x61lert\x18\r \x01(\x0b\x32\x1c.cortex.agent.v1.SystemAlertH\x00\x42\t\n\x07payloadB
|
|
31
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x63ortex/agent/v1/buspacket.proto\x12\x0f\x63ortex.agent.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19\x63ortex/agent/v1/job.proto\x1a\x1f\x63ortex/agent/v1/heartbeat.proto\x1a\x1b\x63ortex/agent/v1/alert.proto\"\xcb\x02\n\tBusPacket\x12\x10\n\x08trace_id\x18\x01 \x01(\t\x12\x11\n\tsender_id\x18\x02 \x01(\t\x12.\n\ncreated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x18\n\x10protocol_version\x18\x04 \x01(\x05\x12\x32\n\x0bjob_request\x18\n \x01(\x0b\x32\x1b.cortex.agent.v1.JobRequestH\x00\x12\x30\n\njob_result\x18\x0b \x01(\x0b\x32\x1a.cortex.agent.v1.JobResultH\x00\x12/\n\theartbeat\x18\x0c \x01(\x0b\x32\x1a.cortex.agent.v1.HeartbeatH\x00\x12-\n\x05\x61lert\x18\r \x01(\x0b\x32\x1c.cortex.agent.v1.SystemAlertH\x00\x42\t\n\x07payloadB\x7f\n\x16\x61i.cortex.cap.agent.v1P\x01Z+github.com/coretexos/cap/go/cortex/agent/v1\xaa\x02\x0f\x43ortex.Agent.V1\xca\x02\x0f\x43ortex\\Agent\\V1\xea\x02\x11\x43ortex::Agent::V1b\x06proto3')
|
|
22
32
|
|
|
23
33
|
_globals = globals()
|
|
24
34
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
25
35
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cortex.agent.v1.buspacket_pb2', _globals)
|
|
26
|
-
if _descriptor._USE_C_DESCRIPTORS
|
|
27
|
-
_globals['DESCRIPTOR'].
|
|
28
|
-
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z
|
|
36
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
37
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
38
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z+github.com/coretexos/cap/go/cortex/agent/v1\252\002\017Cortex.Agent.V1\312\002\017Cortex\\Agent\\V1\352\002\021Cortex::Agent::V1'
|
|
29
39
|
_globals['_BUSPACKET']._serialized_start=175
|
|
30
40
|
_globals['_BUSPACKET']._serialized_end=506
|
|
31
41
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
GRPC_GENERATED_VERSION = '1.76.0'
|
|
8
|
+
GRPC_VERSION = grpc.__version__
|
|
9
|
+
_version_not_supported = False
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from grpc._utilities import first_version_is_lower
|
|
13
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
14
|
+
except ImportError:
|
|
15
|
+
_version_not_supported = True
|
|
16
|
+
|
|
17
|
+
if _version_not_supported:
|
|
18
|
+
raise RuntimeError(
|
|
19
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
20
|
+
+ ' but the generated code in cortex/agent/v1/buspacket_pb2_grpc.py depends on'
|
|
21
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
22
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
23
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
24
|
+
)
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
3
4
|
# source: cortex/agent/v1/heartbeat.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
5
6
|
"""Generated protocol buffer code."""
|
|
6
7
|
from google.protobuf import descriptor as _descriptor
|
|
7
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
8
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'cortex/agent/v1/heartbeat.proto'
|
|
19
|
+
)
|
|
10
20
|
# @@protoc_insertion_point(imports)
|
|
11
21
|
|
|
12
22
|
_sym_db = _symbol_database.Default()
|
|
@@ -14,14 +24,14 @@ _sym_db = _symbol_database.Default()
|
|
|
14
24
|
|
|
15
25
|
|
|
16
26
|
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x63ortex/agent/v1/heartbeat.proto\x12\x0f\x63ortex.agent.v1\"\xbb\x01\n\tHeartbeat\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x0e\n\x06region\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x10\n\x08\x63pu_load\x18\x04 \x01(\x02\x12\x17\n\x0fgpu_utilization\x18\x05 \x01(\x02\x12\x13\n\x0b\x61\x63tive_jobs\x18\x06 \x01(\x05\x12\x14\n\x0c\x63\x61pabilities\x18\x07 \x03(\t\x12\x0c\n\x04pool\x18\x0b \x01(\t\x12\x19\n\x11max_parallel_jobs\x18\x0c \x01(\x05\x42
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x63ortex/agent/v1/heartbeat.proto\x12\x0f\x63ortex.agent.v1\"\xbb\x01\n\tHeartbeat\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x0e\n\x06region\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x10\n\x08\x63pu_load\x18\x04 \x01(\x02\x12\x17\n\x0fgpu_utilization\x18\x05 \x01(\x02\x12\x13\n\x0b\x61\x63tive_jobs\x18\x06 \x01(\x05\x12\x14\n\x0c\x63\x61pabilities\x18\x07 \x03(\t\x12\x0c\n\x04pool\x18\x0b \x01(\t\x12\x19\n\x11max_parallel_jobs\x18\x0c \x01(\x05\x42\x7f\n\x16\x61i.cortex.cap.agent.v1P\x01Z+github.com/coretexos/cap/go/cortex/agent/v1\xaa\x02\x0f\x43ortex.Agent.V1\xca\x02\x0f\x43ortex\\Agent\\V1\xea\x02\x11\x43ortex::Agent::V1b\x06proto3')
|
|
18
28
|
|
|
19
29
|
_globals = globals()
|
|
20
30
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
31
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cortex.agent.v1.heartbeat_pb2', _globals)
|
|
22
|
-
if _descriptor._USE_C_DESCRIPTORS
|
|
23
|
-
_globals['DESCRIPTOR'].
|
|
24
|
-
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z+github.com/coretexos/cap/go/cortex/agent/v1\252\002\017Cortex.Agent.V1\312\002\017Cortex\\Agent\\V1\352\002\021Cortex::Agent::V1'
|
|
25
35
|
_globals['_HEARTBEAT']._serialized_start=53
|
|
26
36
|
_globals['_HEARTBEAT']._serialized_end=240
|
|
27
37
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
GRPC_GENERATED_VERSION = '1.76.0'
|
|
8
|
+
GRPC_VERSION = grpc.__version__
|
|
9
|
+
_version_not_supported = False
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from grpc._utilities import first_version_is_lower
|
|
13
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
14
|
+
except ImportError:
|
|
15
|
+
_version_not_supported = True
|
|
16
|
+
|
|
17
|
+
if _version_not_supported:
|
|
18
|
+
raise RuntimeError(
|
|
19
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
20
|
+
+ ' but the generated code in cortex/agent/v1/heartbeat_pb2_grpc.py depends on'
|
|
21
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
22
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
23
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
24
|
+
)
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
3
4
|
# source: cortex/agent/v1/job.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
5
6
|
"""Generated protocol buffer code."""
|
|
6
7
|
from google.protobuf import descriptor as _descriptor
|
|
7
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
8
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'cortex/agent/v1/job.proto'
|
|
19
|
+
)
|
|
10
20
|
# @@protoc_insertion_point(imports)
|
|
11
21
|
|
|
12
22
|
_sym_db = _symbol_database.Default()
|
|
@@ -14,15 +24,15 @@ _sym_db = _symbol_database.Default()
|
|
|
14
24
|
|
|
15
25
|
|
|
16
26
|
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x63ortex/agent/v1/job.proto\x12\x0f\x63ortex.agent.v1\"\xa3\x02\n\nJobRequest\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12.\n\x08priority\x18\x03 \x01(\x0e\x32\x1c.cortex.agent.v1.JobPriority\x12\x13\n\x0b\x63ontext_ptr\x18\x04 \x01(\t\x12\x12\n\nadapter_id\x18\x05 \x01(\t\x12\x31\n\x03\x65nv\x18\x06 \x03(\x0b\x32$.cortex.agent.v1.JobRequest.EnvEntry\x12\x15\n\rparent_job_id\x18\x07 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x08 \x01(\t\x12\x12\n\nstep_index\x18\t \x01(\x05\x1a*\n\x08\x45nvEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xaf\x01\n\tJobResult\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12*\n\x06status\x18\x02 \x01(\x0e\x32\x1a.cortex.agent.v1.JobStatus\x12\x12\n\nresult_ptr\x18\x03 \x01(\t\x12\x11\n\tworker_id\x18\x04 \x01(\t\x12\x14\n\x0c\x65xecution_ms\x18\x05 \x01(\x03\x12\x12\n\nerror_code\x18\x06 \x01(\t\x12\x15\n\rerror_message\x18\x07 \x01(\t*|\n\x0bJobPriority\x12\x1c\n\x18JOB_PRIORITY_UNSPECIFIED\x10\x00\x12\x1c\n\x18JOB_PRIORITY_INTERACTIVE\x10\x01\x12\x16\n\x12JOB_PRIORITY_BATCH\x10\x02\x12\x19\n\x15JOB_PRIORITY_CRITICAL\x10\x03*\x86\x02\n\tJobStatus\x12\x1a\n\x16JOB_STATUS_UNSPECIFIED\x10\x00\x12\x16\n\x12JOB_STATUS_PENDING\x10\x01\x12\x18\n\x14JOB_STATUS_SCHEDULED\x10\x02\x12\x19\n\x15JOB_STATUS_DISPATCHED\x10\x03\x12\x16\n\x12JOB_STATUS_RUNNING\x10\x04\x12\x18\n\x14JOB_STATUS_SUCCEEDED\x10\x05\x12\x15\n\x11JOB_STATUS_FAILED\x10\x06\x12\x18\n\x14JOB_STATUS_CANCELLED\x10\x07\x12\x15\n\x11JOB_STATUS_DENIED\x10\x08\x12\x16\n\x12JOB_STATUS_TIMEOUT\x10\tB
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x63ortex/agent/v1/job.proto\x12\x0f\x63ortex.agent.v1\"\xa3\x02\n\nJobRequest\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12.\n\x08priority\x18\x03 \x01(\x0e\x32\x1c.cortex.agent.v1.JobPriority\x12\x13\n\x0b\x63ontext_ptr\x18\x04 \x01(\t\x12\x12\n\nadapter_id\x18\x05 \x01(\t\x12\x31\n\x03\x65nv\x18\x06 \x03(\x0b\x32$.cortex.agent.v1.JobRequest.EnvEntry\x12\x15\n\rparent_job_id\x18\x07 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x08 \x01(\t\x12\x12\n\nstep_index\x18\t \x01(\x05\x1a*\n\x08\x45nvEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xaf\x01\n\tJobResult\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12*\n\x06status\x18\x02 \x01(\x0e\x32\x1a.cortex.agent.v1.JobStatus\x12\x12\n\nresult_ptr\x18\x03 \x01(\t\x12\x11\n\tworker_id\x18\x04 \x01(\t\x12\x14\n\x0c\x65xecution_ms\x18\x05 \x01(\x03\x12\x12\n\nerror_code\x18\x06 \x01(\t\x12\x15\n\rerror_message\x18\x07 \x01(\t*|\n\x0bJobPriority\x12\x1c\n\x18JOB_PRIORITY_UNSPECIFIED\x10\x00\x12\x1c\n\x18JOB_PRIORITY_INTERACTIVE\x10\x01\x12\x16\n\x12JOB_PRIORITY_BATCH\x10\x02\x12\x19\n\x15JOB_PRIORITY_CRITICAL\x10\x03*\x86\x02\n\tJobStatus\x12\x1a\n\x16JOB_STATUS_UNSPECIFIED\x10\x00\x12\x16\n\x12JOB_STATUS_PENDING\x10\x01\x12\x18\n\x14JOB_STATUS_SCHEDULED\x10\x02\x12\x19\n\x15JOB_STATUS_DISPATCHED\x10\x03\x12\x16\n\x12JOB_STATUS_RUNNING\x10\x04\x12\x18\n\x14JOB_STATUS_SUCCEEDED\x10\x05\x12\x15\n\x11JOB_STATUS_FAILED\x10\x06\x12\x18\n\x14JOB_STATUS_CANCELLED\x10\x07\x12\x15\n\x11JOB_STATUS_DENIED\x10\x08\x12\x16\n\x12JOB_STATUS_TIMEOUT\x10\tB\x7f\n\x16\x61i.cortex.cap.agent.v1P\x01Z+github.com/coretexos/cap/go/cortex/agent/v1\xaa\x02\x0f\x43ortex.Agent.V1\xca\x02\x0f\x43ortex\\Agent\\V1\xea\x02\x11\x43ortex::Agent::V1b\x06proto3')
|
|
18
28
|
|
|
19
29
|
_globals = globals()
|
|
20
30
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
31
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cortex.agent.v1.job_pb2', _globals)
|
|
22
|
-
if _descriptor._USE_C_DESCRIPTORS
|
|
23
|
-
_globals['DESCRIPTOR'].
|
|
24
|
-
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z
|
|
25
|
-
_globals['_JOBREQUEST_ENVENTRY'].
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z+github.com/coretexos/cap/go/cortex/agent/v1\252\002\017Cortex.Agent.V1\312\002\017Cortex\\Agent\\V1\352\002\021Cortex::Agent::V1'
|
|
35
|
+
_globals['_JOBREQUEST_ENVENTRY']._loaded_options = None
|
|
26
36
|
_globals['_JOBREQUEST_ENVENTRY']._serialized_options = b'8\001'
|
|
27
37
|
_globals['_JOBPRIORITY']._serialized_start=518
|
|
28
38
|
_globals['_JOBPRIORITY']._serialized_end=642
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
GRPC_GENERATED_VERSION = '1.76.0'
|
|
8
|
+
GRPC_VERSION = grpc.__version__
|
|
9
|
+
_version_not_supported = False
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from grpc._utilities import first_version_is_lower
|
|
13
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
14
|
+
except ImportError:
|
|
15
|
+
_version_not_supported = True
|
|
16
|
+
|
|
17
|
+
if _version_not_supported:
|
|
18
|
+
raise RuntimeError(
|
|
19
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
20
|
+
+ ' but the generated code in cortex/agent/v1/job_pb2_grpc.py depends on'
|
|
21
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
22
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
23
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
24
|
+
)
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
3
4
|
# source: cortex/agent/v1/safety.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
5
6
|
"""Generated protocol buffer code."""
|
|
6
7
|
from google.protobuf import descriptor as _descriptor
|
|
7
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
8
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'cortex/agent/v1/safety.proto'
|
|
19
|
+
)
|
|
10
20
|
# @@protoc_insertion_point(imports)
|
|
11
21
|
|
|
12
22
|
_sym_db = _symbol_database.Default()
|
|
@@ -15,14 +25,14 @@ _sym_db = _symbol_database.Default()
|
|
|
15
25
|
from cortex.agent.v1 import job_pb2 as cortex_dot_agent_dot_v1_dot_job__pb2
|
|
16
26
|
|
|
17
27
|
|
|
18
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x63ortex/agent/v1/safety.proto\x12\x0f\x63ortex.agent.v1\x1a\x19\x63ortex/agent/v1/job.proto\"\x8b\x01\n\x12PolicyCheckRequest\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12\x0e\n\x06tenant\x18\x03 \x01(\t\x12.\n\x08priority\x18\x04 \x01(\x0e\x32\x1c.cortex.agent.v1.JobPriority\x12\x16\n\x0e\x65stimated_cost\x18\x05 \x01(\x01\"t\n\x13PolicyCheckResponse\x12/\n\x08\x64\x65\x63ision\x18\x01 \x01(\x0e\x32\x1d.cortex.agent.v1.DecisionType\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x1c\n\x14redacted_context_ptr\x18\x03 \x01(\t*\x9b\x01\n\x0c\x44\x65\x63isionType\x12\x1d\n\x19\x44\x45\x43ISION_TYPE_UNSPECIFIED\x10\x00\x12\x17\n\x13\x44\x45\x43ISION_TYPE_ALLOW\x10\x01\x12\x16\n\x12\x44\x45\x43ISION_TYPE_DENY\x10\x02\x12\x1f\n\x1b\x44\x45\x43ISION_TYPE_REQUIRE_HUMAN\x10\x03\x12\x1a\n\x16\x44\x45\x43ISION_TYPE_THROTTLE\x10\x04\x32\x62\n\x0cSafetyKernel\x12R\n\x05\x43heck\x12#.cortex.agent.v1.PolicyCheckRequest\x1a$.cortex.agent.v1.PolicyCheckResponseB
|
|
28
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x63ortex/agent/v1/safety.proto\x12\x0f\x63ortex.agent.v1\x1a\x19\x63ortex/agent/v1/job.proto\"\x8b\x01\n\x12PolicyCheckRequest\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12\x0e\n\x06tenant\x18\x03 \x01(\t\x12.\n\x08priority\x18\x04 \x01(\x0e\x32\x1c.cortex.agent.v1.JobPriority\x12\x16\n\x0e\x65stimated_cost\x18\x05 \x01(\x01\"t\n\x13PolicyCheckResponse\x12/\n\x08\x64\x65\x63ision\x18\x01 \x01(\x0e\x32\x1d.cortex.agent.v1.DecisionType\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x1c\n\x14redacted_context_ptr\x18\x03 \x01(\t*\x9b\x01\n\x0c\x44\x65\x63isionType\x12\x1d\n\x19\x44\x45\x43ISION_TYPE_UNSPECIFIED\x10\x00\x12\x17\n\x13\x44\x45\x43ISION_TYPE_ALLOW\x10\x01\x12\x16\n\x12\x44\x45\x43ISION_TYPE_DENY\x10\x02\x12\x1f\n\x1b\x44\x45\x43ISION_TYPE_REQUIRE_HUMAN\x10\x03\x12\x1a\n\x16\x44\x45\x43ISION_TYPE_THROTTLE\x10\x04\x32\x62\n\x0cSafetyKernel\x12R\n\x05\x43heck\x12#.cortex.agent.v1.PolicyCheckRequest\x1a$.cortex.agent.v1.PolicyCheckResponseB\x7f\n\x16\x61i.cortex.cap.agent.v1P\x01Z+github.com/coretexos/cap/go/cortex/agent/v1\xaa\x02\x0f\x43ortex.Agent.V1\xca\x02\x0f\x43ortex\\Agent\\V1\xea\x02\x11\x43ortex::Agent::V1b\x06proto3')
|
|
19
29
|
|
|
20
30
|
_globals = globals()
|
|
21
31
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
22
32
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cortex.agent.v1.safety_pb2', _globals)
|
|
23
|
-
if _descriptor._USE_C_DESCRIPTORS
|
|
24
|
-
_globals['DESCRIPTOR'].
|
|
25
|
-
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z
|
|
33
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
34
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
35
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\026ai.cortex.cap.agent.v1P\001Z+github.com/coretexos/cap/go/cortex/agent/v1\252\002\017Cortex.Agent.V1\312\002\017Cortex\\Agent\\V1\352\002\021Cortex::Agent::V1'
|
|
26
36
|
_globals['_DECISIONTYPE']._serialized_start=337
|
|
27
37
|
_globals['_DECISIONTYPE']._serialized_end=492
|
|
28
38
|
_globals['_POLICYCHECKREQUEST']._serialized_start=77
|
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
2
|
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
3
|
import grpc
|
|
4
|
+
import warnings
|
|
4
5
|
|
|
5
6
|
from cortex.agent.v1 import safety_pb2 as cortex_dot_agent_dot_v1_dot_safety__pb2
|
|
6
7
|
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.76.0'
|
|
9
|
+
GRPC_VERSION = grpc.__version__
|
|
10
|
+
_version_not_supported = False
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
from grpc._utilities import first_version_is_lower
|
|
14
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
15
|
+
except ImportError:
|
|
16
|
+
_version_not_supported = True
|
|
17
|
+
|
|
18
|
+
if _version_not_supported:
|
|
19
|
+
raise RuntimeError(
|
|
20
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
21
|
+
+ ' but the generated code in cortex/agent/v1/safety_pb2_grpc.py depends on'
|
|
22
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
23
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
24
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
25
|
+
)
|
|
26
|
+
|
|
7
27
|
|
|
8
28
|
class SafetyKernelStub(object):
|
|
9
29
|
"""SafetyKernel defines the policy decision service.
|
|
@@ -19,7 +39,7 @@ class SafetyKernelStub(object):
|
|
|
19
39
|
'/cortex.agent.v1.SafetyKernel/Check',
|
|
20
40
|
request_serializer=cortex_dot_agent_dot_v1_dot_safety__pb2.PolicyCheckRequest.SerializeToString,
|
|
21
41
|
response_deserializer=cortex_dot_agent_dot_v1_dot_safety__pb2.PolicyCheckResponse.FromString,
|
|
22
|
-
)
|
|
42
|
+
_registered_method=True)
|
|
23
43
|
|
|
24
44
|
|
|
25
45
|
class SafetyKernelServicer(object):
|
|
@@ -44,6 +64,7 @@ def add_SafetyKernelServicer_to_server(servicer, server):
|
|
|
44
64
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
45
65
|
'cortex.agent.v1.SafetyKernel', rpc_method_handlers)
|
|
46
66
|
server.add_generic_rpc_handlers((generic_handler,))
|
|
67
|
+
server.add_registered_method_handlers('cortex.agent.v1.SafetyKernel', rpc_method_handlers)
|
|
47
68
|
|
|
48
69
|
|
|
49
70
|
# This class is part of an EXPERIMENTAL API.
|
|
@@ -62,8 +83,18 @@ class SafetyKernel(object):
|
|
|
62
83
|
wait_for_ready=None,
|
|
63
84
|
timeout=None,
|
|
64
85
|
metadata=None):
|
|
65
|
-
return grpc.experimental.unary_unary(
|
|
86
|
+
return grpc.experimental.unary_unary(
|
|
87
|
+
request,
|
|
88
|
+
target,
|
|
89
|
+
'/cortex.agent.v1.SafetyKernel/Check',
|
|
66
90
|
cortex_dot_agent_dot_v1_dot_safety__pb2.PolicyCheckRequest.SerializeToString,
|
|
67
91
|
cortex_dot_agent_dot_v1_dot_safety__pb2.PolicyCheckResponse.FromString,
|
|
68
|
-
options,
|
|
69
|
-
|
|
92
|
+
options,
|
|
93
|
+
channel_credentials,
|
|
94
|
+
insecure,
|
|
95
|
+
call_credentials,
|
|
96
|
+
compression,
|
|
97
|
+
wait_for_ready,
|
|
98
|
+
timeout,
|
|
99
|
+
metadata,
|
|
100
|
+
_registered_method=True)
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: cap-sdk-python
|
|
3
|
-
Version:
|
|
4
|
-
Summary: CAP (Cortex Agent Protocol) Python SDK
|
|
5
|
-
Project-URL: Homepage, https://github.com/coretexos/cap
|
|
6
|
-
Requires-Python: >=3.9
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
Requires-Dist: protobuf>=4.25.0
|
|
9
|
-
Requires-Dist: grpcio>=1.59.0
|
|
10
|
-
Requires-Dist: nats-py>=2.6.0
|
|
11
|
-
|
|
12
|
-
# CAP Python SDK
|
|
13
|
-
|
|
14
|
-
Asyncio-first SDK with NATS helpers for CAP workers and clients.
|
|
15
|
-
|
|
16
|
-
## Quick Start
|
|
17
|
-
1. Generate protobuf stubs into this SDK (one-time per proto change):
|
|
18
|
-
```bash
|
|
19
|
-
python -m grpc_tools.protoc \
|
|
20
|
-
-I../../proto \
|
|
21
|
-
--python_out=./cap/pb \
|
|
22
|
-
--grpc_python_out=./cap/pb \
|
|
23
|
-
../../proto/cortex/agent/v1/*.proto
|
|
24
|
-
```
|
|
25
|
-
(Or run `./tools/make_protos.sh` from repo root and copy `generated/python` into `sdk/python/cap/pb`.)
|
|
26
|
-
|
|
27
|
-
2. Install:
|
|
28
|
-
```bash
|
|
29
|
-
pip install -e .
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
3. Run a worker:
|
|
33
|
-
```python
|
|
34
|
-
import asyncio
|
|
35
|
-
from cap import worker
|
|
36
|
-
from cap.pb.cortex.agent.v1 import job_pb2
|
|
37
|
-
|
|
38
|
-
async def handle(req: job_pb2.JobRequest):
|
|
39
|
-
return job_pb2.JobResult(
|
|
40
|
-
job_id=req.job_id,
|
|
41
|
-
status=job_pb2.JOB_STATUS_SUCCEEDED,
|
|
42
|
-
result_ptr=f"redis://res/{req.job_id}",
|
|
43
|
-
worker_id="worker-echo-1",
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
asyncio.run(worker.run_worker("nats://127.0.0.1:4222", "job.echo", handle))
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Files
|
|
50
|
-
- `cap/bus.py` — NATS connector.
|
|
51
|
-
- `cap/worker.py` — worker skeleton with handler hook.
|
|
52
|
-
- `cap/client.py` — publish JobRequest to `sys.job.submit`.
|
|
53
|
-
- `cap/pb/` — protobuf stubs (generated).
|
|
54
|
-
|
|
55
|
-
## Defaults
|
|
56
|
-
- Subjects: `sys.job.submit`, `sys.job.result`, `sys.heartbeat`.
|
|
57
|
-
- Protocol version: `1`.
|
|
58
|
-
|
|
59
|
-
Swap out `cap.bus` if you need a different transport.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cap-sdk-python
|
|
3
|
+
Version: 1.0.6
|
|
4
|
+
Summary: CAP (Cortex Agent Protocol) Python SDK
|
|
5
|
+
Project-URL: Homepage, https://github.com/coretexos/cap
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: protobuf>=4.25.0
|
|
9
|
+
Requires-Dist: grpcio>=1.59.0
|
|
10
|
+
Requires-Dist: nats-py>=2.6.0
|
|
11
|
+
|
|
12
|
+
# CAP Python SDK
|
|
13
|
+
|
|
14
|
+
Asyncio-first SDK with NATS helpers for CAP workers and clients.
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
1. Generate protobuf stubs into this SDK (one-time per proto change):
|
|
18
|
+
```bash
|
|
19
|
+
python -m grpc_tools.protoc \
|
|
20
|
+
-I../../proto \
|
|
21
|
+
--python_out=./cap/pb \
|
|
22
|
+
--grpc_python_out=./cap/pb \
|
|
23
|
+
../../proto/cortex/agent/v1/*.proto
|
|
24
|
+
```
|
|
25
|
+
(Or run `./tools/make_protos.sh` from repo root and copy `generated/python` into `sdk/python/cap/pb`.)
|
|
26
|
+
|
|
27
|
+
2. Install:
|
|
28
|
+
```bash
|
|
29
|
+
pip install -e .
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. Run a worker:
|
|
33
|
+
```python
|
|
34
|
+
import asyncio
|
|
35
|
+
from cap import worker
|
|
36
|
+
from cap.pb.cortex.agent.v1 import job_pb2
|
|
37
|
+
|
|
38
|
+
async def handle(req: job_pb2.JobRequest):
|
|
39
|
+
return job_pb2.JobResult(
|
|
40
|
+
job_id=req.job_id,
|
|
41
|
+
status=job_pb2.JOB_STATUS_SUCCEEDED,
|
|
42
|
+
result_ptr=f"redis://res/{req.job_id}",
|
|
43
|
+
worker_id="worker-echo-1",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
asyncio.run(worker.run_worker("nats://127.0.0.1:4222", "job.echo", handle))
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Files
|
|
50
|
+
- `cap/bus.py` — NATS connector.
|
|
51
|
+
- `cap/worker.py` — worker skeleton with handler hook.
|
|
52
|
+
- `cap/client.py` — publish JobRequest to `sys.job.submit`.
|
|
53
|
+
- `cap/pb/` — protobuf stubs (generated).
|
|
54
|
+
|
|
55
|
+
## Defaults
|
|
56
|
+
- Subjects: `sys.job.submit`, `sys.job.result`, `sys.heartbeat`.
|
|
57
|
+
- Protocol version: `1`.
|
|
58
|
+
|
|
59
|
+
Swap out `cap.bus` if you need a different transport.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|