opengris-scaler 1.12.37__cp38-cp38-musllinux_1_2_x86_64.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.
Files changed (196) hide show
  1. opengris_scaler-1.12.37.dist-info/METADATA +730 -0
  2. opengris_scaler-1.12.37.dist-info/RECORD +196 -0
  3. opengris_scaler-1.12.37.dist-info/WHEEL +5 -0
  4. opengris_scaler-1.12.37.dist-info/entry_points.txt +10 -0
  5. opengris_scaler-1.12.37.dist-info/licenses/LICENSE +201 -0
  6. opengris_scaler-1.12.37.dist-info/licenses/LICENSE.spdx +7 -0
  7. opengris_scaler-1.12.37.dist-info/licenses/NOTICE +8 -0
  8. opengris_scaler.libs/libcapnp-1-e88d5415.0.1.so +0 -0
  9. opengris_scaler.libs/libgcc_s-2298274a.so.1 +0 -0
  10. opengris_scaler.libs/libkj-1-9bebd8ac.0.1.so +0 -0
  11. opengris_scaler.libs/libstdc++-08d5c7eb.so.6.0.33 +0 -0
  12. scaler/__init__.py +14 -0
  13. scaler/about.py +5 -0
  14. scaler/client/__init__.py +0 -0
  15. scaler/client/agent/__init__.py +0 -0
  16. scaler/client/agent/client_agent.py +218 -0
  17. scaler/client/agent/disconnect_manager.py +27 -0
  18. scaler/client/agent/future_manager.py +112 -0
  19. scaler/client/agent/heartbeat_manager.py +74 -0
  20. scaler/client/agent/mixins.py +89 -0
  21. scaler/client/agent/object_manager.py +98 -0
  22. scaler/client/agent/task_manager.py +64 -0
  23. scaler/client/client.py +672 -0
  24. scaler/client/future.py +252 -0
  25. scaler/client/object_buffer.py +129 -0
  26. scaler/client/object_reference.py +25 -0
  27. scaler/client/serializer/__init__.py +0 -0
  28. scaler/client/serializer/default.py +16 -0
  29. scaler/client/serializer/mixins.py +38 -0
  30. scaler/cluster/__init__.py +0 -0
  31. scaler/cluster/cluster.py +95 -0
  32. scaler/cluster/combo.py +157 -0
  33. scaler/cluster/object_storage_server.py +45 -0
  34. scaler/cluster/scheduler.py +86 -0
  35. scaler/config/__init__.py +0 -0
  36. scaler/config/common/__init__.py +0 -0
  37. scaler/config/common/logging.py +41 -0
  38. scaler/config/common/web.py +18 -0
  39. scaler/config/common/worker.py +65 -0
  40. scaler/config/common/worker_adapter.py +28 -0
  41. scaler/config/config_class.py +317 -0
  42. scaler/config/defaults.py +94 -0
  43. scaler/config/mixins.py +20 -0
  44. scaler/config/section/__init__.py +0 -0
  45. scaler/config/section/cluster.py +66 -0
  46. scaler/config/section/ecs_worker_adapter.py +78 -0
  47. scaler/config/section/native_worker_adapter.py +30 -0
  48. scaler/config/section/object_storage_server.py +13 -0
  49. scaler/config/section/scheduler.py +126 -0
  50. scaler/config/section/symphony_worker_adapter.py +35 -0
  51. scaler/config/section/top.py +16 -0
  52. scaler/config/section/webui.py +16 -0
  53. scaler/config/types/__init__.py +0 -0
  54. scaler/config/types/network_backend.py +12 -0
  55. scaler/config/types/object_storage_server.py +45 -0
  56. scaler/config/types/worker.py +67 -0
  57. scaler/config/types/zmq.py +83 -0
  58. scaler/entry_points/__init__.py +0 -0
  59. scaler/entry_points/cluster.py +10 -0
  60. scaler/entry_points/object_storage_server.py +26 -0
  61. scaler/entry_points/scheduler.py +51 -0
  62. scaler/entry_points/top.py +272 -0
  63. scaler/entry_points/webui.py +6 -0
  64. scaler/entry_points/worker_adapter_ecs.py +22 -0
  65. scaler/entry_points/worker_adapter_native.py +31 -0
  66. scaler/entry_points/worker_adapter_symphony.py +26 -0
  67. scaler/io/__init__.py +0 -0
  68. scaler/io/async_binder.py +89 -0
  69. scaler/io/async_connector.py +95 -0
  70. scaler/io/async_object_storage_connector.py +225 -0
  71. scaler/io/mixins.py +154 -0
  72. scaler/io/sync_connector.py +68 -0
  73. scaler/io/sync_object_storage_connector.py +249 -0
  74. scaler/io/sync_subscriber.py +83 -0
  75. scaler/io/utility.py +80 -0
  76. scaler/io/ymq/__init__.py +0 -0
  77. scaler/io/ymq/_ymq.pyi +95 -0
  78. scaler/io/ymq/_ymq.so +0 -0
  79. scaler/io/ymq/ymq.py +138 -0
  80. scaler/io/ymq_async_object_storage_connector.py +184 -0
  81. scaler/io/ymq_sync_object_storage_connector.py +184 -0
  82. scaler/object_storage/__init__.py +0 -0
  83. scaler/object_storage/object_storage_server.so +0 -0
  84. scaler/protocol/__init__.py +0 -0
  85. scaler/protocol/capnp/__init__.py +0 -0
  86. scaler/protocol/capnp/_python.py +6 -0
  87. scaler/protocol/capnp/common.capnp +68 -0
  88. scaler/protocol/capnp/message.capnp +218 -0
  89. scaler/protocol/capnp/object_storage.capnp +57 -0
  90. scaler/protocol/capnp/status.capnp +73 -0
  91. scaler/protocol/introduction.md +105 -0
  92. scaler/protocol/python/__init__.py +0 -0
  93. scaler/protocol/python/common.py +140 -0
  94. scaler/protocol/python/message.py +751 -0
  95. scaler/protocol/python/mixins.py +13 -0
  96. scaler/protocol/python/object_storage.py +118 -0
  97. scaler/protocol/python/status.py +279 -0
  98. scaler/protocol/worker.md +228 -0
  99. scaler/scheduler/__init__.py +0 -0
  100. scaler/scheduler/allocate_policy/__init__.py +0 -0
  101. scaler/scheduler/allocate_policy/allocate_policy.py +9 -0
  102. scaler/scheduler/allocate_policy/capability_allocate_policy.py +280 -0
  103. scaler/scheduler/allocate_policy/even_load_allocate_policy.py +159 -0
  104. scaler/scheduler/allocate_policy/mixins.py +55 -0
  105. scaler/scheduler/controllers/__init__.py +0 -0
  106. scaler/scheduler/controllers/balance_controller.py +65 -0
  107. scaler/scheduler/controllers/client_controller.py +131 -0
  108. scaler/scheduler/controllers/config_controller.py +31 -0
  109. scaler/scheduler/controllers/graph_controller.py +424 -0
  110. scaler/scheduler/controllers/information_controller.py +81 -0
  111. scaler/scheduler/controllers/mixins.py +194 -0
  112. scaler/scheduler/controllers/object_controller.py +147 -0
  113. scaler/scheduler/controllers/scaling_policies/__init__.py +0 -0
  114. scaler/scheduler/controllers/scaling_policies/fixed_elastic.py +145 -0
  115. scaler/scheduler/controllers/scaling_policies/mixins.py +10 -0
  116. scaler/scheduler/controllers/scaling_policies/null.py +14 -0
  117. scaler/scheduler/controllers/scaling_policies/types.py +9 -0
  118. scaler/scheduler/controllers/scaling_policies/utility.py +20 -0
  119. scaler/scheduler/controllers/scaling_policies/vanilla.py +95 -0
  120. scaler/scheduler/controllers/task_controller.py +376 -0
  121. scaler/scheduler/controllers/worker_controller.py +169 -0
  122. scaler/scheduler/object_usage/__init__.py +0 -0
  123. scaler/scheduler/object_usage/object_tracker.py +131 -0
  124. scaler/scheduler/scheduler.py +251 -0
  125. scaler/scheduler/task/__init__.py +0 -0
  126. scaler/scheduler/task/task_state_machine.py +92 -0
  127. scaler/scheduler/task/task_state_manager.py +61 -0
  128. scaler/ui/__init__.py +0 -0
  129. scaler/ui/common/__init__.py +0 -0
  130. scaler/ui/common/constants.py +9 -0
  131. scaler/ui/common/live_display.py +147 -0
  132. scaler/ui/common/memory_window.py +146 -0
  133. scaler/ui/common/setting_page.py +40 -0
  134. scaler/ui/common/task_graph.py +840 -0
  135. scaler/ui/common/task_log.py +111 -0
  136. scaler/ui/common/utility.py +66 -0
  137. scaler/ui/common/webui.py +80 -0
  138. scaler/ui/common/worker_processors.py +104 -0
  139. scaler/ui/v1.py +76 -0
  140. scaler/ui/v2.py +102 -0
  141. scaler/ui/webui.py +21 -0
  142. scaler/utility/__init__.py +0 -0
  143. scaler/utility/debug.py +19 -0
  144. scaler/utility/event_list.py +63 -0
  145. scaler/utility/event_loop.py +58 -0
  146. scaler/utility/exceptions.py +42 -0
  147. scaler/utility/formatter.py +44 -0
  148. scaler/utility/graph/__init__.py +0 -0
  149. scaler/utility/graph/optimization.py +27 -0
  150. scaler/utility/graph/topological_sorter.py +11 -0
  151. scaler/utility/graph/topological_sorter_graphblas.py +174 -0
  152. scaler/utility/identifiers.py +107 -0
  153. scaler/utility/logging/__init__.py +0 -0
  154. scaler/utility/logging/decorators.py +25 -0
  155. scaler/utility/logging/scoped_logger.py +33 -0
  156. scaler/utility/logging/utility.py +183 -0
  157. scaler/utility/many_to_many_dict.py +123 -0
  158. scaler/utility/metadata/__init__.py +0 -0
  159. scaler/utility/metadata/profile_result.py +31 -0
  160. scaler/utility/metadata/task_flags.py +30 -0
  161. scaler/utility/mixins.py +13 -0
  162. scaler/utility/network_util.py +7 -0
  163. scaler/utility/one_to_many_dict.py +72 -0
  164. scaler/utility/queues/__init__.py +0 -0
  165. scaler/utility/queues/async_indexed_queue.py +37 -0
  166. scaler/utility/queues/async_priority_queue.py +70 -0
  167. scaler/utility/queues/async_sorted_priority_queue.py +45 -0
  168. scaler/utility/queues/indexed_queue.py +114 -0
  169. scaler/utility/serialization.py +9 -0
  170. scaler/version.txt +1 -0
  171. scaler/worker/__init__.py +0 -0
  172. scaler/worker/agent/__init__.py +0 -0
  173. scaler/worker/agent/heartbeat_manager.py +110 -0
  174. scaler/worker/agent/mixins.py +137 -0
  175. scaler/worker/agent/processor/__init__.py +0 -0
  176. scaler/worker/agent/processor/object_cache.py +107 -0
  177. scaler/worker/agent/processor/processor.py +285 -0
  178. scaler/worker/agent/processor/streaming_buffer.py +28 -0
  179. scaler/worker/agent/processor_holder.py +147 -0
  180. scaler/worker/agent/processor_manager.py +369 -0
  181. scaler/worker/agent/profiling_manager.py +109 -0
  182. scaler/worker/agent/task_manager.py +150 -0
  183. scaler/worker/agent/timeout_manager.py +19 -0
  184. scaler/worker/preload.py +84 -0
  185. scaler/worker/worker.py +265 -0
  186. scaler/worker_adapter/__init__.py +0 -0
  187. scaler/worker_adapter/common.py +26 -0
  188. scaler/worker_adapter/ecs.py +241 -0
  189. scaler/worker_adapter/native.py +138 -0
  190. scaler/worker_adapter/symphony/__init__.py +0 -0
  191. scaler/worker_adapter/symphony/callback.py +45 -0
  192. scaler/worker_adapter/symphony/heartbeat_manager.py +82 -0
  193. scaler/worker_adapter/symphony/message.py +24 -0
  194. scaler/worker_adapter/symphony/task_manager.py +289 -0
  195. scaler/worker_adapter/symphony/worker.py +204 -0
  196. scaler/worker_adapter/symphony/worker_adapter.py +123 -0
@@ -0,0 +1,105 @@
1
+ # Roles
2
+
3
+ The communication protocol include 3 roles: client, scheduler and worker:
4
+
5
+ - client is upstream of scheduler, scheduler is upstream of worker
6
+ - worker is downstream of scheduler, scheduler is downstream of client
7
+
8
+ ```plaintext
9
+ +--------------+
10
+ +-----------------+ TCP | |
11
+ | +------------+ worker |
12
+ +-----------+ | | | |
13
+ | | TCP | | +--------------+
14
+ | client +---------+ |
15
+ | | | | +--------------+
16
+ +-----------+ | | TCP | |
17
+ | scheduler +------------+ worker |
18
+ +-----------+ | (object store) | | |
19
+ | | TCP | | +--------------+
20
+ | client +---------+ |
21
+ | | | | +--------------+
22
+ +-----------+ | | TCP | |
23
+ | +------------+ worker |
24
+ +-----------------+ | |
25
+ +--------------+
26
+
27
+ ```
28
+
29
+ each client to scheduler and each worker to scheduler only maintains 1 TCP connection
30
+
31
+ # Message format
32
+
33
+ Scaler is using capnp library to serialize/deserialize and use zmq to communicate between client and scheduler and
34
+ worker
35
+
36
+ # Message Type Category
37
+
38
+ In general, there are 2 categories of the message types: object and task
39
+
40
+ object normally has an object id associated with actual object data, object data is immutable bytes, serialized by
41
+ client/worker, and deserialized by client/worker. protocol didn't define the way to serialize it, it's up to the
42
+ client/worker to decide
43
+
44
+ task is a function call, it has a task id associate with the actual function call, and the function call contains
45
+ function and series of arguments, but task message doesn't contain the actual function and arguments, instead it
46
+ contains object ids, workers are responsible to fetch the function/argument data from scheduler and deserialize and
47
+ execute the function call.
48
+
49
+ ## Object Channel
50
+
51
+ Scheduler is the center of the object storage, client and worker are identical and can push
52
+
53
+ ```plaintext
54
+ ObjectInstruction
55
+ ObjectResponse +--------------+
56
+ +------------------>| |
57
+ | | Worker |
58
+ +---------+ +-----------+ | +----------------+ |
59
+ | | ObjectRequest | +----+ | ObjectRequest +--------------+
60
+ | | ObjectInstruction | | |
61
+ | +----------------------->| |<------+
62
+ | Client | | Scheduler |
63
+ | |<-----------------------+ +-------+
64
+ | | ObjectResponse | | | ObjectInstruction
65
+ | | | +<---+ | ObjectResponse +--------------+
66
+ +---------+ +-----------+ | +--------------->| |
67
+ | | Worker |
68
+ +-------------------+ |
69
+ ObjectRequest +--------------+
70
+
71
+ ```
72
+
73
+ ObjectInstruction = b"OI"
74
+ client can send object instruction to scheduler, scheduler can send object instruction to worker
75
+ it has 2 subtypes: create b"C", delete b"D"
76
+ when subtype is create, it has to include:
77
+
78
+ - list of object id (type bytes)
79
+ - list of object names (type bytes)
80
+ - list of object bytes (type bytes)
81
+ All above 3 lists, the number of items need match
82
+
83
+ ObjectRequest = b"OR"
84
+ ObjectResponse = b"OA"
85
+
86
+ ## Task Channel
87
+
88
+ ```plaintext
89
+ Task
90
+ TaskCancel +--------------+
91
+ +-------------------+ |
92
+ | | Worker |
93
+ +---------+ Task +-----------+ | +----------------+ |
94
+ | | TaskCancel | +----+ | TaskResult +--------------+
95
+ | | GraphTask | | |
96
+ | +------------------------+ |<------+
97
+ | Client | | Scheduler |
98
+ | |<-----------------------+ +-------+
99
+ | | TaskEcho | | | Task
100
+ | | TaskResult | +----+ | TaskCancel +--------------+
101
+ +---------+ +-----------+ | +--------------->| |
102
+ | | Worker |
103
+ +-------------------+ |
104
+ TaskResult +--------------+
105
+ ```
File without changes
@@ -0,0 +1,140 @@
1
+ import dataclasses
2
+ import enum
3
+ from typing import Tuple
4
+
5
+ from scaler.protocol.capnp._python import _common # noqa
6
+ from scaler.protocol.python.mixins import Message
7
+ from scaler.utility.identifiers import ObjectID
8
+
9
+
10
+ class TaskResultType(enum.Enum):
11
+ Success = _common.TaskResultType.success # if submit and task is done and get result
12
+ Failed = _common.TaskResultType.failed # if submit and task is failed on worker
13
+ FailedWorkerDied = _common.TaskResultType.failedWorkerDied # if submit and worker died
14
+
15
+
16
+ class TaskCancelConfirmType(enum.Enum):
17
+ Canceled = _common.TaskCancelConfirmType.canceled # if cancel success
18
+ CancelFailed = _common.TaskCancelConfirmType.cancelFailed # if failed to cancel if task is running
19
+ CancelNotFound = _common.TaskCancelConfirmType.cancelNotFound # if try to cancel, and task is not found
20
+
21
+
22
+ class TaskTransition(enum.Enum):
23
+ HasCapacity = _common.TaskTransition.hasCapacity
24
+ TaskResultSuccess = _common.TaskTransition.taskResultSuccess
25
+ TaskResultFailed = _common.TaskTransition.taskResultFailed
26
+ TaskResultWorkerDied = _common.TaskTransition.taskResultWorkerDied
27
+ TaskCancel = _common.TaskTransition.taskCancel
28
+ TaskCancelConfirmCanceled = _common.TaskTransition.taskCancelConfirmCanceled
29
+ TaskCancelConfirmFailed = _common.TaskTransition.taskCancelConfirmFailed
30
+ TaskCancelConfirmNotFound = _common.TaskTransition.taskCancelConfirmNotFound
31
+ BalanceTaskCancel = _common.TaskTransition.balanceTaskCancel
32
+ WorkerDisconnect = _common.TaskTransition.workerDisconnect
33
+ SchedulerHasTask = _common.TaskTransition.schedulerHasTask
34
+ SchedulerHasNoTask = _common.TaskTransition.schedulerHasNoTask
35
+
36
+
37
+ class TaskState(enum.Enum):
38
+ Inactive = _common.TaskState.inactive # task is scheduled but not allocate to worker
39
+ Running = _common.TaskState.running # task is running in worker
40
+ Canceling = _common.TaskState.canceling # task is canceling state
41
+ BalanceCanceling = _common.TaskState.balanceCanceling # task is in balance canceling state
42
+ Success = _common.TaskState.success # task is finished properly
43
+ Failed = _common.TaskState.failed # task is finished but exception happened
44
+ FailedWorkerDied = _common.TaskState.failedWorkerDied # task is failed due to worker died
45
+ Canceled = _common.TaskState.canceled # task is canceled (received task cancel confirm)
46
+ CanceledNotFound = _common.TaskState.canceledNotFound # task is not found when trying to cancel
47
+ WorkerDisconnecting = _common.TaskState.workerDisconnecting # task is lost due to worker disconnecting
48
+
49
+
50
+ class WorkerState(enum.Enum):
51
+ Connected = _common.WorkerState.connected
52
+ Disconnected = _common.WorkerState.disconnected
53
+
54
+
55
+ @dataclasses.dataclass
56
+ class TaskCapability(Message):
57
+ def __init__(self, msg):
58
+ super().__init__(msg)
59
+
60
+ @property
61
+ def name(self) -> str:
62
+ return self._msg.name
63
+
64
+ @property
65
+ def value(self) -> int:
66
+ return self._msg.value
67
+
68
+ @staticmethod
69
+ def new_msg(name: str, value: int) -> "TaskCapability":
70
+ return TaskCapability(_common.TaskCapability(name=name, value=value))
71
+
72
+ def get_message(self):
73
+ return self._msg
74
+
75
+
76
+ @dataclasses.dataclass
77
+ class ObjectMetadata(Message):
78
+ class ObjectContentType(enum.Enum):
79
+ # FIXME: Pycapnp does not support assignment of raw enum values when the enum is itself declared within a list.
80
+ # However, assigning the enum's string value works.
81
+ # See https://github.com/capnproto/pycapnp/issues/374
82
+
83
+ Serializer = "serializer"
84
+ Object = "object"
85
+
86
+ def __init__(self, msg):
87
+ super().__init__(msg)
88
+
89
+ @property
90
+ def object_ids(self) -> Tuple[ObjectID, ...]:
91
+ return tuple(ObjectID(object_id_bytes) for object_id_bytes in self._msg.objectIds)
92
+
93
+ @property
94
+ def object_types(self) -> Tuple[ObjectContentType, ...]:
95
+ return tuple(ObjectMetadata.ObjectContentType(object_type._as_str()) for object_type in self._msg.objectTypes)
96
+
97
+ @property
98
+ def object_names(self) -> Tuple[bytes, ...]:
99
+ return tuple(self._msg.objectNames)
100
+
101
+ @staticmethod
102
+ def new_msg(
103
+ object_ids: Tuple[ObjectID, ...],
104
+ object_types: Tuple[ObjectContentType, ...] = tuple(),
105
+ object_names: Tuple[bytes, ...] = tuple(),
106
+ ) -> "ObjectMetadata":
107
+ return ObjectMetadata(
108
+ _common.ObjectMetadata(
109
+ objectIds=[bytes(object_id) for object_id in object_ids],
110
+ objectTypes=[object_type.value for object_type in object_types],
111
+ objectNames=list(object_names),
112
+ )
113
+ )
114
+
115
+ def get_message(self):
116
+ return self._msg
117
+
118
+
119
+ @dataclasses.dataclass
120
+ class ObjectStorageAddress(Message):
121
+ def __init__(self, msg):
122
+ super().__init__(msg)
123
+
124
+ @property
125
+ def host(self) -> str:
126
+ return self._msg.host
127
+
128
+ @property
129
+ def port(self) -> int:
130
+ return self._msg.port
131
+
132
+ @staticmethod
133
+ def new_msg(host: str, port: int) -> "ObjectStorageAddress":
134
+ return ObjectStorageAddress(_common.ObjectStorageAddress(host=host, port=port))
135
+
136
+ def get_message(self):
137
+ return self._msg
138
+
139
+ def __repr__(self) -> str:
140
+ return f"tcp://{self.host}:{self.port}"