flashruntime 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. flashruntime-0.3.0/LICENSE +202 -0
  2. flashruntime-0.3.0/PKG-INFO +365 -0
  3. flashruntime-0.3.0/README.md +311 -0
  4. flashruntime-0.3.0/flashml_workloads/__init__.py +7 -0
  5. flashruntime-0.3.0/flashml_workloads/fedavg_driver.py +569 -0
  6. flashruntime-0.3.0/flashml_workloads/fedavg_weights.py +223 -0
  7. flashruntime-0.3.0/flashml_workloads/fedavg_worker.py +166 -0
  8. flashruntime-0.3.0/flashml_workloads/kmeans_driver.py +134 -0
  9. flashruntime-0.3.0/flashml_workloads/kmeans_shard.py +69 -0
  10. flashruntime-0.3.0/flashml_workloads/sgd_trainer.py +127 -0
  11. flashruntime-0.3.0/flashml_workloads/sharded_kmeans.py +323 -0
  12. flashruntime-0.3.0/flashml_workloads/sklearn_trial.py +89 -0
  13. flashruntime-0.3.0/flashruntime/__init__.py +125 -0
  14. flashruntime-0.3.0/flashruntime/artifacts/__init__.py +25 -0
  15. flashruntime-0.3.0/flashruntime/artifacts/store.py +228 -0
  16. flashruntime-0.3.0/flashruntime/backends/__init__.py +26 -0
  17. flashruntime-0.3.0/flashruntime/backends/base.py +63 -0
  18. flashruntime-0.3.0/flashruntime/backends/kuberay.py +465 -0
  19. flashruntime-0.3.0/flashruntime/checkpoint/__init__.py +20 -0
  20. flashruntime-0.3.0/flashruntime/checkpoint/catalog.py +198 -0
  21. flashruntime-0.3.0/flashruntime/checkpoint/local.py +109 -0
  22. flashruntime-0.3.0/flashruntime/checkpoint/store.py +86 -0
  23. flashruntime-0.3.0/flashruntime/integrations/__init__.py +5 -0
  24. flashruntime-0.3.0/flashruntime/integrations/huggingface.py +59 -0
  25. flashruntime-0.3.0/flashruntime/integrations/pytorch.py +52 -0
  26. flashruntime-0.3.0/flashruntime/integrations/sklearn.py +42 -0
  27. flashruntime-0.3.0/flashruntime/launchers/__init__.py +130 -0
  28. flashruntime-0.3.0/flashruntime/launchers/local.py +126 -0
  29. flashruntime-0.3.0/flashruntime/leases/__init__.py +27 -0
  30. flashruntime-0.3.0/flashruntime/leases/manager.py +365 -0
  31. flashruntime-0.3.0/flashruntime/leases/sqlite_store.py +169 -0
  32. flashruntime-0.3.0/flashruntime/leases/store.py +103 -0
  33. flashruntime-0.3.0/flashruntime/monitor/__init__.py +7 -0
  34. flashruntime-0.3.0/flashruntime/monitor/sampler.py +232 -0
  35. flashruntime-0.3.0/flashruntime/planner/__init__.py +56 -0
  36. flashruntime-0.3.0/flashruntime/planner/candidates.py +597 -0
  37. flashruntime-0.3.0/flashruntime/planner/catalog.py +129 -0
  38. flashruntime-0.3.0/flashruntime/planner/comm.py +95 -0
  39. flashruntime-0.3.0/flashruntime/planner/explain.py +109 -0
  40. flashruntime-0.3.0/flashruntime/planner/memory.py +166 -0
  41. flashruntime-0.3.0/flashruntime/planner/resolve.py +120 -0
  42. flashruntime-0.3.0/flashruntime/planner/selector.py +169 -0
  43. flashruntime-0.3.0/flashruntime/planner/timecost.py +81 -0
  44. flashruntime-0.3.0/flashruntime/profiling/__init__.py +113 -0
  45. flashruntime-0.3.0/flashruntime/protocol/__init__.py +18 -0
  46. flashruntime-0.3.0/flashruntime/protocol/plan_v1alpha1.py +320 -0
  47. flashruntime-0.3.0/flashruntime/protocol/v1alpha1.py +465 -0
  48. flashruntime-0.3.0/flashruntime/providers/__init__.py +138 -0
  49. flashruntime-0.3.0/flashruntime/py.typed +0 -0
  50. flashruntime-0.3.0/flashruntime/recipes/__init__.py +135 -0
  51. flashruntime-0.3.0/flashruntime/recipes/command.py +166 -0
  52. flashruntime-0.3.0/flashruntime/recovery/__init__.py +21 -0
  53. flashruntime-0.3.0/flashruntime/recovery/policy.py +170 -0
  54. flashruntime-0.3.0/flashruntime/recovery/signals.py +135 -0
  55. flashruntime-0.3.0/flashruntime/recovery/taxonomy.py +91 -0
  56. flashruntime-0.3.0/flashruntime/scheduler/__init__.py +170 -0
  57. flashruntime-0.3.0/flashruntime/sdk.py +402 -0
  58. flashruntime-0.3.0/flashruntime/service/__init__.py +3 -0
  59. flashruntime-0.3.0/flashruntime/service/app.py +391 -0
  60. flashruntime-0.3.0/flashruntime/service/auth.py +180 -0
  61. flashruntime-0.3.0/flashruntime/service/checkpoints.py +90 -0
  62. flashruntime-0.3.0/flashruntime/service/cli.py +167 -0
  63. flashruntime-0.3.0/flashruntime/service/dashboard.py +193 -0
  64. flashruntime-0.3.0/flashruntime/service/ledger.py +101 -0
  65. flashruntime-0.3.0/flashruntime/service/modea.py +821 -0
  66. flashruntime-0.3.0/flashruntime/strategies/__init__.py +156 -0
  67. flashruntime-0.3.0/flashruntime/strategies/command.py +56 -0
  68. flashruntime-0.3.0/flashruntime/torch/__init__.py +274 -0
  69. flashruntime-0.3.0/flashruntime/viewer/__init__.py +20 -0
  70. flashruntime-0.3.0/flashruntime/viewer/_docs/benchmarks.html +771 -0
  71. flashruntime-0.3.0/flashruntime/viewer/_docs/concepts/architecture.html +302 -0
  72. flashruntime-0.3.0/flashruntime/viewer/_docs/get-started.html +263 -0
  73. flashruntime-0.3.0/flashruntime/viewer/_docs/guides/federated-averaging.html +363 -0
  74. flashruntime-0.3.0/flashruntime/viewer/_docs/guides/huggingface.html +223 -0
  75. flashruntime-0.3.0/flashruntime/viewer/_docs/guides/jobspec-and-isolation.html +271 -0
  76. flashruntime-0.3.0/flashruntime/viewer/_docs/guides/pytorch.html +313 -0
  77. flashruntime-0.3.0/flashruntime/viewer/_docs/guides/sklearn.html +232 -0
  78. flashruntime-0.3.0/flashruntime/viewer/_docs/index.html +251 -0
  79. flashruntime-0.3.0/flashruntime/viewer/_docs/reference/cli.html +254 -0
  80. flashruntime-0.3.0/flashruntime/viewer/_docs/reference/integrations.html +240 -0
  81. flashruntime-0.3.0/flashruntime/viewer/_docs/reference/sdk.html +341 -0
  82. flashruntime-0.3.0/flashruntime/viewer/_docs/reference/torch-helper.html +244 -0
  83. flashruntime-0.3.0/flashruntime/viewer/_docs/search-index.json +1 -0
  84. flashruntime-0.3.0/flashruntime/viewer/_docs/tutorials/convnet.html +571 -0
  85. flashruntime-0.3.0/flashruntime/viewer/_docs/tutorials/fault-tolerance.html +375 -0
  86. flashruntime-0.3.0/flashruntime/viewer/_docs/tutorials/sklearn-sweeps.html +278 -0
  87. flashruntime-0.3.0/flashruntime/viewer/flowmap.py +307 -0
  88. flashruntime-0.3.0/flashruntime/viewer/page.py +594 -0
  89. flashruntime-0.3.0/flashruntime/viewer/server.py +134 -0
  90. flashruntime-0.3.0/flashruntime/viewer/state.py +250 -0
  91. flashruntime-0.3.0/flashruntime/workloads/__init__.py +6 -0
  92. flashruntime-0.3.0/flashruntime/workloads/command.py +127 -0
  93. flashruntime-0.3.0/flashruntime.egg-info/PKG-INFO +365 -0
  94. flashruntime-0.3.0/flashruntime.egg-info/SOURCES.txt +143 -0
  95. flashruntime-0.3.0/flashruntime.egg-info/dependency_links.txt +1 -0
  96. flashruntime-0.3.0/flashruntime.egg-info/entry_points.txt +2 -0
  97. flashruntime-0.3.0/flashruntime.egg-info/requires.txt +32 -0
  98. flashruntime-0.3.0/flashruntime.egg-info/top_level.txt +2 -0
  99. flashruntime-0.3.0/pyproject.toml +110 -0
  100. flashruntime-0.3.0/setup.cfg +4 -0
  101. flashruntime-0.3.0/tests/test_auto_recovery.py +142 -0
  102. flashruntime-0.3.0/tests/test_benchmarks.py +799 -0
  103. flashruntime-0.3.0/tests/test_checkpoint.py +103 -0
  104. flashruntime-0.3.0/tests/test_checkpoint_local.py +70 -0
  105. flashruntime-0.3.0/tests/test_cli_submit.py +177 -0
  106. flashruntime-0.3.0/tests/test_documentation.py +200 -0
  107. flashruntime-0.3.0/tests/test_examples_e2e.py +93 -0
  108. flashruntime-0.3.0/tests/test_fedavg_convergence.py +247 -0
  109. flashruntime-0.3.0/tests/test_fedavg_driver.py +855 -0
  110. flashruntime-0.3.0/tests/test_fedavg_weights.py +227 -0
  111. flashruntime-0.3.0/tests/test_fedavg_worker.py +167 -0
  112. flashruntime-0.3.0/tests/test_gpu_e2e.py +94 -0
  113. flashruntime-0.3.0/tests/test_integrations.py +77 -0
  114. flashruntime-0.3.0/tests/test_interfaces.py +250 -0
  115. flashruntime-0.3.0/tests/test_kmeans_leases.py +140 -0
  116. flashruntime-0.3.0/tests/test_kmeans_workload.py +59 -0
  117. flashruntime-0.3.0/tests/test_kuberay_backend.py +114 -0
  118. flashruntime-0.3.0/tests/test_launcher_local.py +65 -0
  119. flashruntime-0.3.0/tests/test_leases.py +204 -0
  120. flashruntime-0.3.0/tests/test_leases_scope.py +82 -0
  121. flashruntime-0.3.0/tests/test_leases_sqlite.py +174 -0
  122. flashruntime-0.3.0/tests/test_monitor_sampler.py +231 -0
  123. flashruntime-0.3.0/tests/test_planner.py +240 -0
  124. flashruntime-0.3.0/tests/test_protocol_v1alpha1.py +102 -0
  125. flashruntime-0.3.0/tests/test_recipes_command.py +154 -0
  126. flashruntime-0.3.0/tests/test_recovery.py +90 -0
  127. flashruntime-0.3.0/tests/test_run_json.py +52 -0
  128. flashruntime-0.3.0/tests/test_scheduler_isolation.py +266 -0
  129. flashruntime-0.3.0/tests/test_sdk_submit.py +162 -0
  130. flashruntime-0.3.0/tests/test_service_auth.py +170 -0
  131. flashruntime-0.3.0/tests/test_service_auth_startup.py +34 -0
  132. flashruntime-0.3.0/tests/test_service_checkpoints.py +122 -0
  133. flashruntime-0.3.0/tests/test_service_command_recipe.py +281 -0
  134. flashruntime-0.3.0/tests/test_service_delegation.py +736 -0
  135. flashruntime-0.3.0/tests/test_service_fedavg.py +206 -0
  136. flashruntime-0.3.0/tests/test_service_modea.py +289 -0
  137. flashruntime-0.3.0/tests/test_service_write_scope.py +374 -0
  138. flashruntime-0.3.0/tests/test_sgd_trainer.py +91 -0
  139. flashruntime-0.3.0/tests/test_strategy_command.py +77 -0
  140. flashruntime-0.3.0/tests/test_torch_helper.py +190 -0
  141. flashruntime-0.3.0/tests/test_viewer_flowmap.py +40 -0
  142. flashruntime-0.3.0/tests/test_viewer_page.py +222 -0
  143. flashruntime-0.3.0/tests/test_viewer_server.py +314 -0
  144. flashruntime-0.3.0/tests/test_viewer_state.py +96 -0
  145. flashruntime-0.3.0/tests/test_workloads_command.py +65 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,365 @@
1
+ Metadata-Version: 2.4
2
+ Name: flashruntime
3
+ Version: 0.3.0
4
+ Summary: Open fault-tolerant distributed ML runtime: strategy planning, job protocol, leases, checkpointing, and recovery across heterogeneous compute.
5
+ Author: Zolli Labs
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Zolli-Labs/flashruntime
8
+ Project-URL: Documentation, https://zolli-labs.github.io/flashruntime/
9
+ Project-URL: Repository, https://github.com/Zolli-Labs/flashruntime
10
+ Project-URL: Issues, https://github.com/Zolli-Labs/flashruntime/issues
11
+ Project-URL: Changelog, https://github.com/Zolli-Labs/flashruntime/blob/main/CHANGELOG.md
12
+ Keywords: machine-learning,distributed-training,fault-tolerance,checkpointing,pytorch,ray,mlops,reliability,hyperparameter-search
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: System :: Distributed Computing
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: pydantic>=2.7
29
+ Provides-Extra: sklearn
30
+ Requires-Dist: numpy>=1.26; extra == "sklearn"
31
+ Requires-Dist: scikit-learn>=1.3; extra == "sklearn"
32
+ Provides-Extra: k8s
33
+ Requires-Dist: kubernetes>=29; extra == "k8s"
34
+ Provides-Extra: artifacts
35
+ Requires-Dist: minio>=7.2; extra == "artifacts"
36
+ Provides-Extra: oss
37
+ Requires-Dist: oss2>=2.18; extra == "oss"
38
+ Provides-Extra: monitor
39
+ Requires-Dist: psutil>=5.9; extra == "monitor"
40
+ Provides-Extra: service
41
+ Requires-Dist: fastapi>=0.111; extra == "service"
42
+ Requires-Dist: uvicorn>=0.30; extra == "service"
43
+ Requires-Dist: httpx>=0.27; extra == "service"
44
+ Requires-Dist: kubernetes>=29; extra == "service"
45
+ Requires-Dist: minio>=7.2; extra == "service"
46
+ Requires-Dist: pyyaml>=6; extra == "service"
47
+ Provides-Extra: dev
48
+ Requires-Dist: pytest; extra == "dev"
49
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
50
+ Requires-Dist: numpy>=1.26; extra == "dev"
51
+ Requires-Dist: pyyaml>=6; extra == "dev"
52
+ Requires-Dist: markdown>=3.6; extra == "dev"
53
+ Dynamic: license-file
54
+
55
+ # FlashRuntime
56
+
57
+ > **The open fault-tolerant distributed ML runtime.** FlashRuntime *operates*
58
+ > your training job — it never rewrites it. You keep the model, the training
59
+ > loop, the loss, the data, and the framework you already have. FlashRuntime
60
+ > wraps the reliability layer around them: it launches your command, injects
61
+ > the environment it promised, tracks your metrics, validates your checkpoints,
62
+ > **recovers from crashes in one call**, and collects your artifacts. The
63
+ > distributed computation itself is always done by established libraries
64
+ > (PyTorch DDP/FSDP2/torchrun, Ray, Hugging Face, scikit-learn).
65
+
66
+ FlashRuntime is one of three components in the FlashML system by
67
+ [Zolli Labs](https://github.com/Zolli-Labs):
68
+
69
+ - **[flashnode](https://github.com/Zolli-Labs/flashnode)** — open host agent
70
+ installed by resource contributors.
71
+ - **flashruntime** (this repo) — the open workload protocol and execution
72
+ layer. Self-hostable: useful without the cloud.
73
+ - **flashml-cloud** (private) — the managed control plane, marketplace, and
74
+ dashboard.
75
+
76
+ Read [`docs/SYSTEM_OVERVIEW.md`](docs/SYSTEM_OVERVIEW.md) for the full product
77
+ architecture, and [`AGENTS.md`](AGENTS.md) if you are an AI coding agent working
78
+ in this repo.
79
+
80
+ ## Install
81
+
82
+ The core is deliberately tiny — `pip install flashruntime` brings **only
83
+ pydantic**. Every core module (the `flash.submit()` SDK, planner, leases,
84
+ checkpoints, recovery) works with zero infrastructure:
85
+
86
+ ```bash
87
+ pip install flashruntime
88
+ ```
89
+
90
+ Torch is **not** a dependency. FlashRuntime *launches* PyTorch; it never imports
91
+ it. Install it yourself to run the DDP example — a CPU-only build is enough,
92
+ since DDP works over the `gloo` backend with no GPU:
93
+
94
+ ```bash
95
+ pip install torch # CPU build is fine
96
+ ```
97
+
98
+ ## 60-second run
99
+
100
+ `flash.submit()` operates any command. The one convention your script owes
101
+ FlashRuntime is to write a `metrics.json` (a flat JSON object) into its working
102
+ directory; FlashRuntime collects it and records it as a trial:
103
+
104
+ ```python
105
+ import flashruntime as flash
106
+
107
+ run = flash.submit(
108
+ flash.CommandWorkload(
109
+ command="python train.py --epochs 5",
110
+ source=flash.Source(path="~/my-project"),
111
+ outputs=flash.OutputSpec(collect=["metrics.json"]),
112
+ ),
113
+ max_restarts=2, # a crashed attempt relaunches from the last VALID
114
+ # checkpoint — up to twice (see below)
115
+ watch=True, # opens the live run page and prints its URL
116
+ )
117
+
118
+ print(run.state.value) # "SUCCEEDED" (or "FAILED")
119
+ print(run.trials) # [{'accuracy': 0.91, ...}] — parsed from metrics.json
120
+ print(run.artifacts) # [PosixPath('.../metrics.json'), ...]
121
+ print(run.viewer_url) # http://127.0.0.1:<port> — the live page
122
+ ```
123
+
124
+ `command` is `shlex`-split (there is no shell — for a pipe, pass
125
+ `command="bash -c '...'"`), and `source` is a `flash.Source`, so `~` is expanded
126
+ for you. The same thing from the shell:
127
+
128
+ ```bash
129
+ flashruntime submit "python train.py --epochs 5" \
130
+ --source ~/my-project --max-restarts 2 --watch
131
+ ```
132
+
133
+ A script that already reads its hyperparameters from `argparse` and writes a
134
+ small JSON of results needs **zero FlashRuntime imports** to be operated. The
135
+ contract at the boundary is thin on purpose: arguments in, `metrics.json` out.
136
+
137
+ ## One import, fault tolerant
138
+
139
+ `max_restarts=N` is the automatic recovery budget. On a **FAILED** attempt
140
+ FlashRuntime turns the exit into failure signals, classifies them
141
+ (`recovery.classify`), and consults a *versioned, deterministic* policy
142
+ (`recovery.decide`): a deterministic application bug fails fast — a retry would
143
+ only re-hit it — while a transient failure relaunches the same spec from the
144
+ job-scoped checkpoint. Same failure + same policy version ⇒ same action, every
145
+ time. **No LLM in the loop.** Every decision is recorded on the run as
146
+ `FAILURE_CLASSIFIED` / `RECOVERY_ACTION_SELECTED` events.
147
+
148
+ Kill-and-resume is proven end to end. `tests/test_examples_e2e.py` kills a
149
+ 2-process DDP run mid-training and asserts the resumed run's final loss
150
+ matches a never-crashed baseline to 1e-6 — recovery restores only a verified,
151
+ topology-compatible checkpoint (parts-first / manifest-last: a half-written
152
+ checkpoint can never look valid).
153
+
154
+ For a script you *are* willing to touch, `import flashruntime.torch as ft` adds
155
+ `ft.prepare` / `ft.checkpoint` / `ft.log_metrics`: torch's own DDP wrapped under
156
+ the same checkpoint contract, with correct per-rank device placement, so a
157
+ killed run resumes with a loss curve indistinguishable from the uninterrupted
158
+ one (1e-6 in the e2e). It is optional sugar on the launch-only
159
+ contract, never required.
160
+
161
+ **GPU-validated (2026-07-23).** The CUDA paths — `nccl` DDP, per-rank device
162
+ placement, and a GPU kill-and-resume — are validated end to end on real
163
+ hardware: **2×NVIDIA GeForce RTX 4090** (RunPod community cloud), torch
164
+ 2.7.1+cu128, CUDA 12.8. Two runs, **$0.0725 total**. See `tests/test_gpu_e2e.py`
165
+ and the harness `scripts/runpod_gpu_e2e.py`.
166
+
167
+ ## Watch it run
168
+
169
+ Pass `watch=True` (the default at an interactive terminal, off in pipes/CI) and
170
+ `flash.submit()` opens a live run page in your browser and prints its URL. It
171
+ draws the run's topology, its loss curve, its verified checkpoints, and every
172
+ recovery decision, refreshing every couple of seconds — served entirely from a
173
+ loopback server with **no external assets**, so it renders with the network cut.
174
+ These docs are served from that same viewer at `/docs`.
175
+
176
+ > _screenshot: run any `flashruntime submit … --watch` to see the live page._
177
+
178
+ ## Documentation
179
+
180
+ A PyTorch-style docs site is built from [`docs/site/`](docs/site/) by
181
+ `scripts/build_docs.py` (every byte inline — no CDN, web font, or remote image).
182
+ It is served offline by the viewer at `/docs`, and deploys to GitHub Pages on
183
+ release:
184
+
185
+ - **<https://zolli-labs.github.io/flashruntime/>** — _live after the first
186
+ Pages deploy._
187
+
188
+ Start with [Get started](docs/site/get-started.md) (install → first job → first
189
+ DDP run on CPU). The strategy planner's code walkthrough lives in
190
+ [`docs/planner/README.md`](docs/planner/README.md).
191
+
192
+ ## Benchmarks
193
+
194
+ An honest benchmark suite (`python -m benchmarks run`) records every result with
195
+ the host that produced it and reports missing comparators as skipped rows, never
196
+ faked. A measured baseline is committed under
197
+ [`benchmarks/results/`](benchmarks/results/). On **Apple M4 (CPU)**:
198
+
199
+ | Scenario | Measured | Read it honestly |
200
+ |---|---|---|
201
+ | Launch overhead | **+0.04 s** | `flash.submit` vs bare `torchrun`, paired. A one-time fixed cost, not per-step. |
202
+ | Checkpoint cost | **−1.2 ms / checkpoint** (p90 6.2 ms) | A few-KB state dict; the median delta is *below* the run-to-run noise floor at this size (it goes slightly negative), so checkpoints are effectively free here — the p90 bounds it. A larger model surfaces a real positive cost. |
203
+ | Auto-resume | **40 steps not recomputed** | The size-*independent* guarantee: resume never re-does work past the last valid checkpoint. |
204
+ | Adoption | **7 lines** | To make a vanilla script framework-ready (difflib vs each project's own docs). |
205
+ | Resilience | **5/5 faults handled · 20/20 integrity under `kill -9`** | Every fault type routed to the right typed recovery; a checkpoint survives a mid-write `SIGKILL` on 20/20 kills (naive `torch.save`: 20/20 corrupted). 16-trial storm, half crash-armed: 16/16 completed, all 8 crashed trials auto-resumed, 0 manual. Dead-worker MTTD **3.05 s**, MTTR **~3.5 ms**. |
206
+
207
+ The *timing* rows are smoke-scale on one host: the models are tiny, so the
208
+ *wall-clock* saved by recovery is at the noise floor here. The figure that
209
+ scales is `steps_not_recomputed`, not seconds — the seconds-saved grows with the
210
+ compute between the last checkpoint and the crash (negligible at smoke size,
211
+ hours on a real job). The resilience counts are exact, not smoke-diluted: they
212
+ are *counted* from real fault injection (`kill -9` in the checkpoint-write
213
+ window, a storm of crash-armed trials, a killed lease worker), and the full
214
+ Resilience table with per-scenario method lives in
215
+ [the benchmarks page](docs/site/benchmarks.md). Full provenance and caveats live
216
+ in the result file.
217
+
218
+ ---
219
+
220
+ ## Also: plan a job (no cluster required)
221
+
222
+ Before you launch, `flash.plan()` turns model + hardware + budget + deadline
223
+ into a ranked, explained execution plan — deterministic, framework-import-free:
224
+
225
+ ```python
226
+ import flashruntime as flash
227
+
228
+ report = flash.plan(flash.PlanRequest(
229
+ workload=flash.TransformerFineTune(model="Qwen/Qwen2.5-7B", method="lora",
230
+ train_tokens_m=25),
231
+ resources=flash.Resources(gpus=4, gpu_type="RTX4090",
232
+ hourly_cost_usd_per_gpu=0.44),
233
+ objective=flash.Objective(mode="balanced", max_cost_usd=20,
234
+ deadline_minutes=240),
235
+ ))
236
+ print(flash.render(report))
237
+ # → SELECTED: ddp + lora(r=16), 4 workers, torchrun, 21.6 GB/GPU, ~96 min,
238
+ # $2.82 — plus every rejected candidate with its arithmetic
239
+ ```
240
+
241
+ The report names the distributed method, the libraries it is built from
242
+ (torchrun, DDP/FSDP2, transformers+peft, bitsandbytes, PyTorch DCP) and their
243
+ roles, the knobs, and *why* — including why the alternatives lost. Details:
244
+ [`docs/planner/README.md`](docs/planner/README.md).
245
+
246
+ ## Also: leases, checkpoints, recovery
247
+
248
+ The reliability core is an embeddable library, not a service you must run:
249
+
250
+ ```python
251
+ from flashruntime.leases import LeaseManager
252
+ from flashruntime.recovery import FailureSignals, classify, decide
253
+ from flashruntime.protocol.v1alpha1 import TaskSpec
254
+
255
+ mgr = LeaseManager()
256
+ mgr.add_task(TaskSpec(task_id="trial-01", job_id="sweep", commit_key="sweep/trial-01"))
257
+ lease = mgr.claim(node_id="laptop-1") # pull, never push
258
+ mgr.heartbeat(lease.lease_id) # prove liveness
259
+ mgr.complete(lease.lease_id, output_sha256="…") # first valid commit wins
260
+
261
+ decision = decide(classify(FailureSignals(heartbeat_lost=True)),
262
+ mode="independent_tasks") # → RETRY_TASK, cordon node
263
+ ```
264
+
265
+ The FlashRuntime service exposes these same objects over HTTP; FlashNode's
266
+ device executor is their remote client. The lease coordinator's durable
267
+ `SqliteLeaseStore` means in-flight leases survive a coordinator restart.
268
+
269
+ ## Testing
270
+
271
+ ```bash
272
+ pytest # unit tests — pure Python, no infrastructure
273
+ pytest -m integration # opt-in: Docker / Kubernetes / MinIO environments
274
+ ```
275
+
276
+ Integration tests live in [`tests/integration/`](tests/integration/README.md)
277
+ and skip themselves (with instructions) when their environment is absent. The
278
+ one GPU test (`tests/test_gpu_e2e.py`) is CUDA-gated and skips without a GPU. The
279
+ local kind + KubeRay + MinIO stack is owned by the workspace Makefile, not this
280
+ repo — the library stays `pip install`-clean.
281
+
282
+ ## Package layout
283
+
284
+ **Pure-Python core** — `pip install flashruntime` brings pydantic and nothing
285
+ else; every module below works with zero infrastructure:
286
+
287
+ ```
288
+ flashruntime/
289
+ ├── protocol/ # versioned public schemas (v1alpha1: JobSpec, Event, Lease,
290
+ │ # TaskAttempt, CheckpointManifest, RecoveryDecision, plans)
291
+ ├── sdk.py # flash.submit(CommandWorkload) → Run: compile→launch→wait→
292
+ │ # collect, with the automatic max_restarts recovery loop
293
+ ├── workloads/ # CommandWorkload: framework-neutral "run this command"
294
+ ├── integrations/# one-file adapters (sklearn / pytorch DDP / HF) — no framework
295
+ │ # imports at module level; convention is CLI-flags-in/JSON-out
296
+ ├── torch/ # optional in-script helper: ft.prepare / checkpoint / log_metrics
297
+ ├── planner/ # strategy planner: estimators, curated menus, explained selector
298
+ ├── leases/ # Mode A core: claim / heartbeat / expiry sweep / idempotent
299
+ │ # commit; InMemory + SQLite stores (restart-durable)
300
+ ├── checkpoint/ # manifest catalog: parts-first/manifest-last, validation ladder
301
+ ├── recovery/ # failure-signal classifier + versioned deterministic policy
302
+ └── viewer/ # stdlib live run page + the built docs site (zero external assets)
303
+ ```
304
+
305
+ **Infrastructure integrations** (opt-in extras, never core imports):
306
+
307
+ ```
308
+ ├── service/ # [service] the coordinator: job submission + task expansion,
309
+ │ # lease/node/checkpoint HTTP endpoints, local artifact hosting,
310
+ │ # join codes, SQLite ledger, dashboard at GET /, the CLI
311
+ ├── launchers/ # LocalProcessLauncher (the concrete local launcher today)
312
+ ├── strategies/ # CommandWorkload → LaunchSpec compilation
313
+ ├── recipes/ # coordinator-side WorkloadRecipe registry (command jobs)
314
+ ├── backends/ # [k8s] ExecutionBackend contract + KubeRay backend (Mode B)
315
+ └── artifacts/ # [artifacts]/[oss] MinIO/S3-compatible + Alibaba OSS stores
316
+
317
+ flashml_workloads/ # runnable task modules (pure stdlib/sklearn):
318
+ │ # sklearn_trial, kmeans_shard + kmeans_driver,
319
+ │ # sgd_trainer (checkpointable, bit-identical resume)
320
+ ```
321
+
322
+ Still to come (each lands with its vertical slice, no empty scaffolds):
323
+ multi-node DDP rendezvous (`nnodes > 1` raises `NotImplementedError` today);
324
+ FlashNode's argv runner so service-side command jobs execute remotely;
325
+ checkpoint-manifest persistence (catalog is in-memory; checkpoint *files* are
326
+ durable); Stage-8 ledger metrics (MTTD/MTTR/goodput); `flash.run(plan)` wiring;
327
+ the cloud stage (Postgres, SSE, HF Trainer + PEFT LoRA recipes).
328
+
329
+ Four orthogonal axes keep the architecture honest: **providers** get machines,
330
+ **launchers** start processes, **strategies** configure execution, **recipes**
331
+ integrate user code. Hugging Face lives in recipes — it is the workload layer,
332
+ not an execution backend. The planner never imports framework code; it emits a
333
+ backend-neutral `StrategyPlan` that strategy compilers translate.
334
+
335
+ ## What FlashRuntime builds on (and what it owns)
336
+
337
+ | Layer | Libraries reused | What FlashRuntime adds |
338
+ |---|---|---|
339
+ | ML math & models | PyTorch, HF Transformers + PEFT, bitsandbytes, scikit-learn | Nothing — untouched, operated by recipes |
340
+ | Distribution strategies | DDP, FSDP2 (`fully_shard`); DeepSpeed ZeRO later | The *choice* and its explanation, compiled from a StrategyPlan |
341
+ | Launching | torchrun / Torch Elastic; Ray Core on clusters | Checkpoint-aware restart around torchrun; the **lease/heartbeat protocol** for machines outside any cluster — the layer with no existing library |
342
+ | Checkpointing | PyTorch Distributed Checkpoint (parallel save/load, resharding) | The manifest **catalog**: written-last commit, validation status, compatibility, recovery-time selection |
343
+ | Infrastructure | Kubernetes + KubeRay today; SkyPilot / Slurm / provider APIs later | Provider adapters + one cross-environment job model |
344
+
345
+ Deliberately not built on: HF Accelerate (overlaps torchrun and strategy
346
+ config — user scripts that use it still work via the launch-only contract) and
347
+ Ray Train (mid V1→V2 migration).
348
+
349
+ ## The dependency rule
350
+
351
+ `flashruntime` owns the public protocol and imports **neither** application
352
+ repo. `flashnode` and `flashml-cloud` both depend on `flashruntime`; they never
353
+ import each other.
354
+
355
+ ## Contributing, security, changelog
356
+
357
+ - [`CONTRIBUTING.md`](CONTRIBUTING.md) — dev setup, the test/doc/audit gates, and
358
+ the Developer Certificate of Origin (`git commit -s`).
359
+ - [`SECURITY.md`](SECURITY.md) — how to report a vulnerability.
360
+ - [`CHANGELOG.md`](CHANGELOG.md) — release notes ([Keep a Changelog](https://keepachangelog.com/)).
361
+
362
+ ## License
363
+
364
+ [Apache-2.0](LICENSE). Contributions via Developer Certificate of Origin
365
+ (`git commit -s`).