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,730 @@
1
+ Metadata-Version: 2.2
2
+ Name: opengris-scaler
3
+ Version: 1.12.37
4
+ Summary: OpenGRIS Scaler Distribution Framework
5
+ Author-Email: Citi <opensource@citi.com>
6
+ License: Apache 2.0
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: System :: Distributed Computing
12
+ Project-URL: Home, https://github.com/finos/opengris-scaler
13
+ Requires-Python: >=3.8
14
+ Requires-Dist: bidict
15
+ Requires-Dist: configargparse
16
+ Requires-Dist: toml
17
+ Requires-Dist: cloudpickle
18
+ Requires-Dist: psutil==7.1.3
19
+ Requires-Dist: pycapnp==2.1.0
20
+ Requires-Dist: pyzmq
21
+ Requires-Dist: sortedcontainers==2.4.0
22
+ Requires-Dist: tblib
23
+ Requires-Dist: aiohttp
24
+ Requires-Dist: graphlib-backport; python_version < "3.9"
25
+ Requires-Dist: typing-extensions>=4.0; python_version < "3.10"
26
+ Requires-Dist: tomli; python_version < "3.11"
27
+ Provides-Extra: uvloop
28
+ Requires-Dist: uvloop; platform_system != "Windows" and extra == "uvloop"
29
+ Provides-Extra: gui
30
+ Requires-Dist: nicegui[plotly]==2.24.2; python_version == "3.8" and extra == "gui"
31
+ Requires-Dist: nicegui[plotly]==3.3.1; python_version >= "3.9" and extra == "gui"
32
+ Provides-Extra: graphblas
33
+ Requires-Dist: python-graphblas; extra == "graphblas"
34
+ Requires-Dist: numpy==1.24.4; python_version == "3.8" and extra == "graphblas"
35
+ Requires-Dist: numpy==2.0.2; python_version == "3.9" and extra == "graphblas"
36
+ Requires-Dist: numpy==2.2.6; python_version >= "3.10" and extra == "graphblas"
37
+ Provides-Extra: aws
38
+ Requires-Dist: boto3; extra == "aws"
39
+ Provides-Extra: all
40
+ Requires-Dist: nicegui[plotly]==2.24.2; python_version == "3.8" and extra == "all"
41
+ Requires-Dist: nicegui[plotly]==3.3.1; python_version >= "3.9" and extra == "all"
42
+ Requires-Dist: python-graphblas; extra == "all"
43
+ Requires-Dist: numpy==1.24.4; python_version == "3.8" and extra == "all"
44
+ Requires-Dist: numpy==2.0.2; python_version == "3.9" and extra == "all"
45
+ Requires-Dist: numpy==2.2.6; python_version >= "3.10" and extra == "all"
46
+ Requires-Dist: uvloop; platform_system != "Windows" and extra == "all"
47
+ Requires-Dist: boto3; extra == "all"
48
+ Description-Content-Type: text/markdown
49
+
50
+ <div align="center">
51
+ <a href="https://github.com/finos/opengris-scaler">
52
+ <img src="https://github.com/finos/branding/blob/master/project-logos/active-project-logos/OpenGRIS/Scaler/2025_OpenGRIS_Scaler.svg" alt="OpenGRIS Scaler" width="180" height="80">
53
+ </a>
54
+
55
+ <p align="center">
56
+ Efficient, lightweight, and reliable distributed computation engine.
57
+ </p>
58
+
59
+ <p align="center">
60
+ <a href="https://community.finos.org/docs/governance/Software-Projects/stages/incubating">
61
+ <img src="https://cdn.jsdelivr.net/gh/finos/contrib-toolbox@master/images/badge-incubating.svg">
62
+ </a>
63
+ <a href="https://finos.github.io/opengris-scaler/">
64
+ <img src="https://img.shields.io/badge/Documentation-0f1632">
65
+ </a>
66
+ <a href="./LICENSE">
67
+ <img src="https://img.shields.io/github/license/finos/opengris-scaler?label=license&colorA=0f1632&colorB=255be3">
68
+ </a>
69
+ <a href="https://pypi.org/project/opengris-scaler">
70
+ <img alt="PyPI - Version" src="https://img.shields.io/pypi/v/opengris-scaler?colorA=0f1632&colorB=255be3">
71
+ </a>
72
+ <img src="https://api.securityscorecards.dev/projects/github.com/finos/opengris-scaler/badge">
73
+ </p>
74
+ </div>
75
+
76
+ <br />
77
+
78
+ **OpenGRIS Scaler provides a simple, efficient, and reliable way to perform distributed computing** using a centralized
79
+ scheduler,
80
+ with a stable and language-agnostic protocol for client and worker communications.
81
+
82
+ ```python
83
+ import math
84
+ from scaler import Client
85
+
86
+ with Client(address="tcp://127.0.0.1:2345") as client:
87
+ # Compute a single task using `.submit()`
88
+ future = client.submit(math.sqrt, 16)
89
+ print(future.result()) # 4
90
+
91
+ # Submit multiple tasks with `.map()`
92
+ results = client.map(math.sqrt, [(i,) for i in range(100)])
93
+ print(sum(results)) # 661.46
94
+ ```
95
+
96
+ OpenGRIS Scaler is a suitable Dask replacement, offering significantly better scheduling performance for jobs with a
97
+ large number
98
+ of lightweight tasks while improving on load balancing, messaging, and deadlocks.
99
+
100
+ ## Features
101
+
102
+ - Distributed computing across **multiple cores and multiple servers**
103
+ - **Python** reference implementation, with **language-agnostic messaging protocol** built on top of
104
+ [Cap'n Proto](https://capnproto.org/) and [ZeroMQ](https://zeromq.org)
105
+ - **Graph** scheduling, which supports [Dask](https://www.dask.org)-like graph computing, with
106
+ optional [GraphBLAS](https://graphblas.org)
107
+ support for very large graph tasks
108
+ - **Automated load balancing**, which automatically balances load from busy workers to idle workers, ensuring uniform
109
+ utilization across workers
110
+ - **Automated task recovery** from worker-related hardware, OS, or network failures
111
+ - Support for **nested tasks**, allowing tasks to submit new tasks
112
+ - `top`-like **monitoring tools**
113
+ - GUI monitoring tool
114
+
115
+ ## Installation
116
+
117
+ Scaler is available on PyPI and can be installed using any compatible package manager.
118
+
119
+ ```bash
120
+ $ pip install opengris-scaler
121
+
122
+ # or with graphblas and uvloop and webui support
123
+ $ pip install opengris-scaler[graphblas,uvloop,gui]
124
+
125
+ # or simply
126
+ $ pip install opengris-scaler[all]
127
+ ```
128
+
129
+ ## Quick Start
130
+
131
+ The official documentation is available at [finos.github.io/opengris-scaler/](https://finos.github.io/opengris-scaler/).
132
+
133
+ Scaler has 3 main components:
134
+
135
+ - A **scheduler**, responsible for routing tasks to available computing resources.
136
+ - An **object storage server** that stores the task data objects (task arguments and task results).
137
+ - A set of **workers** that form a _cluster_. Workers are independent computing units, each capable of executing a
138
+ single task.
139
+ - **Clients** running inside applications, responsible for submitting tasks to the scheduler.
140
+
141
+ Please be noted that **Clients** are cross platform, supporting Windows and GNU/Linux, while other components can only
142
+ be run on GNU/Linux.
143
+
144
+ ### Start local scheduler and cluster programmatically in code
145
+
146
+ A local scheduler and a local set of workers can be conveniently started using `SchedulerClusterCombo`:
147
+
148
+ ```python
149
+ from scaler import SchedulerClusterCombo
150
+
151
+ cluster = SchedulerClusterCombo(address="tcp://127.0.0.1:2345", n_workers=4)
152
+
153
+ ...
154
+
155
+ cluster.shutdown()
156
+ ```
157
+
158
+ This will start a scheduler with 4 workers on port `2345`.
159
+
160
+ ### Setting up a computing cluster from the CLI
161
+
162
+ The object storage server, scheduler and workers can also be started from the command line with
163
+ `scaler_scheduler` and `scaler_cluster`.
164
+
165
+ First, start the scheduler, and make it connect to the object storage server:
166
+
167
+ ```bash
168
+ $ scaler_scheduler "tcp://127.0.0.1:2345"
169
+ [INFO]2025-06-06 13:13:15+0200: logging to ('/dev/stdout',)
170
+ [INFO]2025-06-06 13:13:15+0200: use event loop: builtin
171
+ [INFO]2025-06-06 13:13:15+0200: Scheduler: listen to scheduler address tcp://127.0.0.1:2345
172
+ [INFO]2025-06-06 13:13:15+0200: Scheduler: connect to object storage server tcp://127.0.0.1:2346
173
+ [INFO]2025-06-06 13:13:15+0200: Scheduler: listen to scheduler monitor address tcp://127.0.0.1:2347
174
+ ...
175
+ ```
176
+
177
+ Finally, start a set of workers (a.k.a. a Scaler *cluster*) that connects to the previously started scheduler:
178
+
179
+ ```bash
180
+ $ scaler_cluster -n 4 tcp://127.0.0.1:2345
181
+ [INFO]2023-03-19 12:19:19-0400: logging to ('/dev/stdout',)
182
+ [INFO]2023-03-19 12:19:19-0400: ClusterProcess: starting 4 workers, heartbeat_interval_seconds=2, object_retention_seconds=3600
183
+ [INFO]2023-03-19 12:19:19-0400: Worker[0] started
184
+ [INFO]2023-03-19 12:19:19-0400: Worker[1] started
185
+ [INFO]2023-03-19 12:19:19-0400: Worker[2] started
186
+ [INFO]2023-03-19 12:19:19-0400: Worker[3] started
187
+ ...
188
+ ```
189
+
190
+ Multiple Scaler clusters can be connected to the same scheduler, providing distributed computation over multiple
191
+ servers.
192
+
193
+ `-h` lists the available options for the object storage server, scheduler and the cluster executables:
194
+
195
+ ```bash
196
+ $ scaler_object_storage_server -h
197
+ $ scaler_scheduler -h
198
+ $ scaler_cluster -h
199
+ ```
200
+
201
+ ### Submitting Python tasks using the Scaler client
202
+
203
+ Knowing the scheduler address, you can connect and submit tasks from a client in your Python code:
204
+
205
+ ```python
206
+ from scaler import Client
207
+
208
+
209
+ def square(value: int):
210
+ return value * value
211
+
212
+
213
+ with Client(address="tcp://127.0.0.1:2345") as client:
214
+ future = client.submit(square, 4) # submits a single task
215
+ print(future.result()) # 16
216
+ ```
217
+
218
+ `Client.submit()` returns a standard Python future.
219
+
220
+ ## Graph computations
221
+
222
+ Scaler also supports graph tasks, for example:
223
+
224
+ ```python
225
+ from scaler import Client
226
+
227
+
228
+ def inc(i):
229
+ return i + 1
230
+
231
+
232
+ def add(a, b):
233
+ return a + b
234
+
235
+
236
+ def minus(a, b):
237
+ return a - b
238
+
239
+
240
+ graph = {
241
+ "a": 2,
242
+ "b": 2,
243
+
244
+ # the input to task c is the output of task a
245
+ "c": (inc, "a"), # c = a + 1 = 2 + 1 = 3
246
+ "d": (add, "a", "b"), # d = a + b = 2 + 2 = 4
247
+ "e": (minus, "d", "c") # e = d - c = 4 - 3 = 1
248
+ }
249
+
250
+ with Client(address="tcp://127.0.0.1:2345") as client:
251
+ result = client.get(graph, keys=["e"])
252
+ print(result) # {"e": 1}
253
+ ```
254
+
255
+ ## Configuring with TOML Files
256
+
257
+ While all Scaler components can be configured using command-line flags, using TOML files is the recommended approach for
258
+ production or shareable setups. Configuration files make your setup explicit, easier to manage, and allow you to check
259
+ your infrastructure's configuration into version control.
260
+
261
+ For convenience, you can define the settings for all components in a single, sectioned TOML file. Each component
262
+ automatically loads its configuration from its corresponding section.
263
+
264
+ ### Core Concepts
265
+
266
+ * **Usage**: To use a configuration file, pass its path via the `--config` or `-c` flag.
267
+
268
+ ```bash
269
+ scaler_scheduler --config /path/to/your/example_config.toml
270
+ ```
271
+
272
+ * **Precedence**: Settings are loaded in a specific order, with later sources overriding earlier ones. The hierarchy is:
273
+
274
+ Command-Line Flags > TOML File Settings > Built-in Default Values
275
+
276
+ * **Naming Convention**: The keys in the TOML file must match the long-form command-line arguments. The rule is to
277
+ replace any hyphens (`-`) with underscores (`_`).
278
+ * For example, the flag `--num-of-workers` becomes the TOML key `num_of_workers`.
279
+ * One can discover all available keys by running any command with the `-h` or `--help` flag.
280
+
281
+ ### Supported Components and Section Names
282
+
283
+ The following table maps each Scaler command to its corresponding section name in the TOML file.
284
+
285
+ | Command | TOML Section Name |
286
+ |----------------------------------|-----------------------------|
287
+ | `scaler_scheduler` | `[scheduler]` |
288
+ | `scaler_cluster` | `[cluster]` |
289
+ | `scaler_object_storage_server` | `[object_storage_server]` |
290
+ | `scaler_ui` | `[webui]` |
291
+ | `scaler_top` | `[top]` |
292
+ | `scaler_worker_adapter_native` | `[native_worker_adapter]` |
293
+ | `scaler_worker_adapter_symphony` | `[symphony_worker_adapter]` |
294
+
295
+ ### Practical Scenarios & Examples
296
+
297
+ #### Scenario 1: Unified Configuration File
298
+
299
+ Here is an example of a single `example_config.toml` file that configures multiple components using sections.
300
+
301
+ **example_config.toml**
302
+
303
+ ```toml
304
+ # This is a unified configuration file for all Scaler components.
305
+
306
+ [scheduler]
307
+ scheduler_address = "tcp://127.0.0.1:6378"
308
+ object_storage_address = "tcp://127.0.0.1:6379"
309
+ monitor_address = "tcp://127.0.0.1:6380"
310
+ allocate_policy = "even"
311
+ logging_level = "INFO"
312
+ logging_paths = ["/dev/stdout", "/var/log/scaler/scheduler.log"]
313
+
314
+ [cluster]
315
+ scheduler_address = "tcp://127.0.0.1:6378"
316
+ num_of_workers = 8
317
+ per_worker_capabilities = "linux,cpu=8"
318
+ task_timeout_seconds = 600
319
+
320
+ [object_storage_server]
321
+ object_storage_address = "tcp://127.0.0.1:6379"
322
+
323
+ [webui]
324
+ monitor_address = "tcp://127.0.0.1:6380"
325
+ web_port = 8081
326
+ ```
327
+
328
+ With this single file, starting your entire stack is simple and consistent:
329
+
330
+ ```bash
331
+ scaler_object_storage_server --config example_config.toml &
332
+ scaler_scheduler --config example_config.toml &
333
+ scaler_cluster --config example_config.toml &
334
+ scaler_ui --config example_config.toml &
335
+ ```
336
+
337
+ #### Scenario 2: Overriding a Section's Setting
338
+
339
+ You can override any value from the TOML file by providing it as a command-line flag. For example, to use the
340
+ example_config.toml file but test the cluster with 12 workers instead of 8:
341
+
342
+ ```bash
343
+ # The --num-of-workers flag will take precedence over the [cluster] section
344
+ scaler_cluster --config example_config.toml --num-of-workers 12
345
+ ```
346
+
347
+ The cluster will start with 12 workers, but all other settings (like `scheduler_address`) will still be loaded from the
348
+ `[cluster]` section of example_config.toml.
349
+
350
+ ## Nested computations
351
+
352
+ Scaler allows tasks to submit new tasks while being executed. Scaler also supports recursive task calls.
353
+
354
+ ```python
355
+ from scaler import Client
356
+
357
+
358
+ def fibonacci(client: Client, n: int):
359
+ if n == 0:
360
+ return 0
361
+ elif n == 1:
362
+ return 1
363
+ else:
364
+ a = client.submit(fibonacci, client, n - 1)
365
+ b = client.submit(fibonacci, client, n - 2)
366
+ return a.result() + b.result()
367
+
368
+
369
+ with Client(address="tcp://127.0.0.1:2345") as client:
370
+ future = client.submit(fibonacci, client, 8)
371
+ print(future.result()) # 21
372
+ ```
373
+
374
+ **Note**: When creating a `Client` inside a task (nested client), the `address` parameter is optional. If omitted, the client automatically uses the scheduler address from the worker context. If provided, the specified address takes precedence.
375
+
376
+ ## Task Routing and Capability Management
377
+
378
+ > **Note**: This feature is experimental and may change in future releases.
379
+
380
+ Scaler provides a task routing mechanism, allowing you to specify capability requirements for tasks and allocate them to
381
+ workers supporting these.
382
+
383
+ ### Starting the Scheduler with the Capability Allocation Policy
384
+
385
+ The scheduler can be started with the experimental capability allocation policy using the `--allocate-policy/-ap`
386
+ argument.
387
+
388
+ ```bash
389
+ $ scaler_scheduler --allocate-policy capability tcp://127.0.0.1:2345
390
+ ```
391
+
392
+ ### Defining Worker Supported Capabilities
393
+
394
+ When starting a cluster of workers, you can define the capabilities available on each worker using the
395
+ `--per-worker-capabilities/-pwc` argument. This allows the scheduler to allocate tasks to workers based on the
396
+ capabilities these provide.
397
+
398
+ ```bash
399
+ $ scaler_cluster -n 4 --per-worker-capabilities "gpu,linux" tcp://127.0.0.1:2345
400
+ ```
401
+
402
+ ### Specifying Capability Requirements for Tasks
403
+
404
+ When submitting tasks using the Scaler client, you can specify the capability requirements for each task using the
405
+ `capabilities` argument in the `submit_verbose()` and `get()` methods. This ensures that tasks are allocated to workers
406
+ supporting these capabilities.
407
+
408
+ ```python
409
+ from scaler import Client
410
+
411
+ with Client(address="tcp://127.0.0.1:2345") as client:
412
+ future = client.submit_verbose(round, args=(3.15,), kwargs={}, capabilities={"gpu": -1})
413
+ print(future.result()) # 3
414
+ ```
415
+
416
+ The scheduler will route a task to a worker if `task.capabilities.is_subset(worker.capabilities)`.
417
+
418
+ Integer values specified for capabilities (e.g., `gpu=10`) are *currently* ignored by the capabilities allocation
419
+ policy.
420
+ This means that the presence of a capabilities is considered, but not its quantity. Support for capabilities tracking
421
+ might be added in the future.
422
+
423
+ ## IBM Spectrum Symphony integration
424
+
425
+ A Scaler scheduler can interface with IBM Spectrum Symphony to provide distributed computing across Symphony clusters.
426
+
427
+ ```bash
428
+ $ scaler_worker_adapter_symphony tcp://127.0.0.1:2345 --service-name ScalerService --base-concurrency 4 --host 127.0.0.1 --port 8080
429
+ ```
430
+
431
+ This will start a Scaler worker that connects to the Scaler scheduler at `tcp://127.0.0.1:2345` and uses the Symphony
432
+ service `ScalerService` to submit tasks.
433
+
434
+ ### Symphony service
435
+
436
+ A service must be deployed in Symphony to handle the task submission.
437
+
438
+ <details>
439
+
440
+ <summary>Here is an example of a service that can be used</summary>
441
+
442
+ ```python
443
+ class Message(soamapi.Message):
444
+ def __init__(self, payload: bytes = b""):
445
+ self.__payload = payload
446
+
447
+ def set_payload(self, payload: bytes):
448
+ self.__payload = payload
449
+
450
+ def get_payload(self) -> bytes:
451
+ return self.__payload
452
+
453
+ def on_serialize(self, stream):
454
+ payload_array = array.array("b", self.get_payload())
455
+ stream.write_byte_array(payload_array, 0, len(payload_array))
456
+
457
+ def on_deserialize(self, stream):
458
+ self.set_payload(stream.read_byte_array("b"))
459
+
460
+
461
+ class ServiceContainer(soamapi.ServiceContainer):
462
+ def on_create_service(self, service_context):
463
+ return
464
+
465
+ def on_session_enter(self, session_context):
466
+ return
467
+
468
+ def on_invoke(self, task_context):
469
+ input_message = Message()
470
+ task_context.populate_task_input(input_message)
471
+
472
+ fn, *args = cloudpickle.loads(input_message.get_payload())
473
+ output_payload = cloudpickle.dumps(fn(*args))
474
+
475
+ output_message = Message(output_payload)
476
+ task_context.set_task_output(output_message)
477
+
478
+ def on_session_leave(self):
479
+ return
480
+
481
+ def on_destroy_service(self):
482
+ return
483
+ ```
484
+
485
+ </details>
486
+
487
+ ### Nested tasks
488
+
489
+ Nested task originating from Symphony workers must be able to reach the Scaler scheduler. This might require
490
+ modifications to the network configuration.
491
+
492
+ Nested tasks can also have unpredictable resource usage and runtimes, which can cause Symphony to prematurely kill
493
+ tasks. It is recommended to be conservative when provisioning resources and limits, and monitor the cluster status
494
+ closely for any abnormalities.
495
+
496
+ ### Base concurrency
497
+
498
+ Base concurrency is the maximum number of unnested tasks that can be executed concurrently. It is possible to surpass
499
+ this limit by submitting nested tasks which carry a higher priority. **Important**: If your workload contains nested
500
+ tasks the base concurrency should be set to a value less to the number of cores available on the Symphony worker or else
501
+ deadlocks may occur.
502
+
503
+ A good heuristic for setting the base concurrency is to use the following formula:
504
+
505
+ ```
506
+ base_concurrency = number_of_cores - deepest_nesting_level
507
+ ```
508
+
509
+ where `deepest_nesting_level` is the deepest nesting level a task has in your workload. For instance, if you have a
510
+ workload that has
511
+ a base task that calls a nested task that calls another nested task, then the deepest nesting level is 2.
512
+
513
+ ## Worker Adapter usage
514
+
515
+ > **Note**: This feature is experimental and may change in future releases.
516
+
517
+ Scaler provides a Worker Adapter webhook interface to integrate with other job schedulers or resource managers. The
518
+ Worker Adapter allows external systems to request the creation and termination of Scaler workers dynamically.
519
+
520
+ Please check the OpenGRIS standard for more details on the Worker Adapter
521
+ specification [here](https://github.com/finos/opengris).
522
+
523
+ ### Starting the Native Worker Adapter
524
+
525
+ Starting a Native Worker Adapter server at `http://127.0.0.1:8080`:
526
+
527
+ ```bash
528
+ $ scaler_worker_adapter_native tcp://127.0.0.1:2345 --host 127.0.0.1 --port 8080
529
+ ```
530
+
531
+ Pass the `--adapter-webhook-url` argument to the Scaler scheduler to connect to the Worker Adapter:
532
+
533
+ ```bash
534
+ $ scaler_scheduler tcp://127.0.0.1:2345 --adapter-webhook-url http://127.0.0.1:8080
535
+ ````
536
+
537
+ To check that the Worker Adapter is working, you can bring up `scaler_top` to see workers spawning and terminating as
538
+ there is task load changes.
539
+
540
+ ## Performance
541
+
542
+ ### uvloop
543
+
544
+ By default, Scaler uses Python's built-in `asyncio` event loop.
545
+ For better async performance, you can install uvloop (`pip install uvloop`) and supply `uvloop` for the CLI argument
546
+ `--event-loop` or as a keyword argument for `event_loop` in Python code when initializing the scheduler.
547
+
548
+ ```bash
549
+ scaler_scheduler --event-loop uvloop tcp://127.0.0.1:2345
550
+ ```
551
+
552
+ ```python
553
+ from scaler import SchedulerClusterCombo
554
+
555
+ scheduler = SchedulerClusterCombo(address="tcp://127.0.0.1:2345", event_loop="uvloop", n_workers=4)
556
+ ```
557
+
558
+ ## Monitoring
559
+
560
+ ### From the CLI
561
+
562
+ Use `scaler_top` to connect to the scheduler's monitor address (printed by the scheduler on startup) to see
563
+ diagnostics/metrics information about the scheduler and its workers.
564
+
565
+ ```bash
566
+ $ scaler_top tcp://127.0.0.1:2347
567
+ ```
568
+
569
+ It will look similar to `top`, but provides information about the current Scaler setup:
570
+
571
+ ```bash
572
+ scheduler | task_manager | scheduler_sent | scheduler_received
573
+ cpu 0.0% | unassigned 0 | ObjectResponse 24 | Heartbeat 183,109
574
+ rss 37.1 MiB | running 0 | TaskEcho 200,000 | ObjectRequest 24
575
+ | success 200,000 | Task 200,000 | Task 200,000
576
+ | failed 0 | TaskResult 200,000 | TaskResult 200,000
577
+ | canceled 0 | BalanceRequest 4 | BalanceResponse 4
578
+ --------------------------------------------------------------------------------------------------
579
+ Shortcuts: worker[n] cpu[c] rss[m] free[f] working[w] queued[q]
580
+
581
+ Total 10 worker(s)
582
+ worker agt_cpu agt_rss [cpu] rss free sent queued | object_id_to_tasks
583
+ W|Linux|15940|3c9409c0+ 0.0% 32.7m 0.0% 28.4m 1000 0 0 |
584
+ W|Linux|15946|d6450641+ 0.0% 30.7m 0.0% 28.2m 1000 0 0 |
585
+ W|Linux|15942|3ed56e89+ 0.0% 34.8m 0.0% 30.4m 1000 0 0 |
586
+ W|Linux|15944|6e7d5b99+ 0.0% 30.8m 0.0% 28.2m 1000 0 0 |
587
+ W|Linux|15945|33106447+ 0.0% 31.1m 0.0% 28.1m 1000 0 0 |
588
+ W|Linux|15937|b031ce9a+ 0.0% 31.0m 0.0% 30.3m 1000 0 0 |
589
+ W|Linux|15941|c4dcc2f3+ 0.0% 30.5m 0.0% 28.2m 1000 0 0 |
590
+ W|Linux|15939|e1ab4340+ 0.0% 31.0m 0.0% 28.1m 1000 0 0 |
591
+ W|Linux|15938|ed582770+ 0.0% 31.1m 0.0% 28.1m 1000 0 0 |
592
+ W|Linux|15943|a7fe8b5e+ 0.0% 30.7m 0.0% 28.3m 1000 0 0 |
593
+ ```
594
+
595
+ - **scheduler** section shows scheduler resource usage
596
+ - **task_manager** section shows count for each task status
597
+ - **scheduler_sent** section shows count for each type of messages scheduler sent
598
+ - **scheduler_received** section shows count for each type of messages scheduler received
599
+ - **function_id_to_tasks** section shows task count for each function used
600
+ - **worker** section shows worker details, , you can use shortcuts to sort by columns, and the * in the column header
601
+ shows
602
+ which column is being used for sorting
603
+ - `agt_cpu/agt_rss` means cpu/memory usage of worker agent
604
+ - `cpu/rss` means cpu/memory usage of worker
605
+ - `free` means number of free task slots for this worker
606
+ - `sent` means how many tasks scheduler sent to the worker
607
+ - `queued` means how many tasks worker received and queued
608
+
609
+ ### From the web UI
610
+
611
+ `scaler_ui` provides a web monitoring interface for Scaler.
612
+
613
+ ```bash
614
+ $ scaler_ui tcp://127.0.0.1:2347 --port 8081
615
+ ```
616
+
617
+ This will open a web server on port `8081`.
618
+
619
+ ## Slides and presentations
620
+
621
+ We showcased Scaler at FOSDEM 2025. Check out the slides
622
+ [here](<slides/Effortless Distributed Computing in Python - FOSDEM 2025.pdf>).
623
+
624
+ ## Building from source
625
+
626
+ ### Using the Dev Container (Recommended)
627
+
628
+ The easiest way to build Scaler is by using the provided dev container.
629
+ See the [Dev Container Setup documentation](https://finos.github.io/opengris-scaler/tutorials/development/devcontainer.html) for more details.
630
+
631
+ ### Building on GNU/Linux
632
+
633
+ To contribute to Scaler, you might need to manually build its C++ components.
634
+
635
+ These C++ components depend on the Boost and Cap'n Proto libraries. If these libraries are not available on your system,
636
+ you can use the `library_tool.sh` script to download, compile, and install them (You might need `sudo`):
637
+
638
+ ```bash
639
+ ./scripts/library_tool.sh boost compile
640
+ ./scripts/library_tool.sh boost install
641
+ ./scripts/library_tool.sh capnp compile
642
+ ./scripts/library_tool.sh capnp install
643
+ ```
644
+
645
+ After installing these dependencies, use the `build.sh` script to configure, build, and install Scaler's C++ components:
646
+
647
+ ```bash
648
+ ./scripts/build.sh
649
+ ```
650
+
651
+ This script will create a build directory based on your operating system and architecture, and install the components
652
+ within the main source tree, as compiled Python modules. You can specify the compiler to use by setting the `CC` and
653
+ `CXX` environment variables.
654
+
655
+ ### Building on Windows
656
+
657
+ *Building on Windows requires _Visual Studio 17 2022_*. Similar to the former section, you can use the
658
+ `library_tool.ps1` script to download, compile, and install them (You might need `Run as administrator`):
659
+
660
+ ```bash
661
+ ./scripts/library_tool.ps1 boost compile
662
+ ./scripts/library_tool.ps1 boost install
663
+ ./scripts/library_tool.ps1 capnp compile
664
+ ./scripts/library_tool.ps1 capnp install
665
+ ```
666
+
667
+ After installing these dependencies, if you are using _Visual Studio_ for developing, you may open the project folder
668
+ with it, select preset `windows-x64`, and build the project. You may also run the following commands to configure,
669
+ build, and install Scaler's C++ components:
670
+
671
+ ```bash
672
+ cmake --preset windows-x64
673
+ cmake --build --preset windows-x64 --config (Debug|Release)
674
+ cmake --install build_windows_x64 --config (Debug|Release)
675
+ ```
676
+
677
+ The output will be similar to what described in the former section. We recommend using _Visual Studio_ for developing on
678
+ Windows.
679
+
680
+ ### Building the Python wheel
681
+
682
+ Build the Python wheel for Scaler using `cibuildwheel`:
683
+
684
+ ```bash
685
+ pip install build cibuildwheel
686
+
687
+ python -m cibuildwheel --output-dir wheelhouse
688
+ python -m build --sdist
689
+ ```
690
+
691
+ ## Contributing
692
+
693
+ Your contributions are at the core of making this a true open source project. Any contributions you make are **greatly
694
+ appreciated**.
695
+
696
+ We welcome you to:
697
+
698
+ - Fix typos or touch up documentation
699
+ - Share your opinions on [existing issues](https://github.com/finos/opengris-scaler/issues)
700
+ - Help expand and improve our library by [opening a new issue](https://github.com/finos/opengris-scaler/issues/new)
701
+
702
+ Please review [functional contribution guidelines](./CONTRIBUTING.md) to get started 👍.
703
+
704
+ _NOTE:_ Commits and pull requests to FINOS repositories will only be accepted from those contributors with an active,
705
+ executed Individual Contributor License Agreement (ICLA) with FINOS OR contributors who are covered under an existing
706
+ and active Corporate Contribution License Agreement (CCLA) executed with FINOS. Commits from individuals not covered
707
+ under an ICLA or CCLA will be flagged and blocked by
708
+ the ([EasyCLA](https://community.finos.org/docs/governance/Software-Projects/easycla)) tool. Please note that some CCLAs
709
+ require individuals/employees to be explicitly named on the CCLA.
710
+
711
+ *Need an ICLA? Unsure if you are covered under an existing CCLA? Email [help@finos.org](mailto:help@finos.org)*
712
+
713
+ ## Code of Conduct
714
+
715
+ Please see the FINOS [Community Code of Conduct](https://www.finos.org/code-of-conduct).
716
+
717
+ ## License
718
+
719
+ Copyright 2023 Citigroup, Inc.
720
+
721
+ This project is distributed under the [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0). See
722
+ [`LICENSE`](./LICENSE) for more information.
723
+
724
+ SPDX-License-Identifier: [Apache-2.0](https://spdx.org/licenses/Apache-2.0)
725
+
726
+ ## Contact
727
+
728
+ If you have a query or require support with this
729
+ project, [raise an issue](https://github.com/finos/opengris-scaler/issues).
730
+ Otherwise, reach out to [opensource@citi.com](mailto:opensource@citi.com).