opengris-scaler 1.12.28__cp313-cp313-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.

Potentially problematic release.


This version of opengris-scaler might be problematic. Click here for more details.

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