shareddata 6.101.0__tar.gz → 6.101.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. {shareddata-6.101.0/src/shareddata.egg-info → shareddata-6.101.6}/PKG-INFO +2 -15
  2. {shareddata-6.101.0 → shareddata-6.101.6}/setup.py +1 -1
  3. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/apidocs.yml +10 -1
  4. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/data.py +4 -0
  5. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/utils.py +1 -1
  6. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/ClusterPowerGovernor.py +146 -13
  7. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TimeSeriesDisk.py +0 -2
  8. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/mongo_view.py +65 -2
  9. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/services.py +11 -1
  10. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/standalone.js +10 -3
  11. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/worker_facts.py +140 -20
  12. {shareddata-6.101.0 → shareddata-6.101.6/src/shareddata.egg-info}/PKG-INFO +2 -15
  13. {shareddata-6.101.0 → shareddata-6.101.6}/LICENSE +0 -0
  14. {shareddata-6.101.0 → shareddata-6.101.6}/MANIFEST.in +0 -0
  15. {shareddata-6.101.0 → shareddata-6.101.6}/README.md +0 -0
  16. {shareddata-6.101.0 → shareddata-6.101.6}/pyproject.toml +0 -0
  17. {shareddata-6.101.0 → shareddata-6.101.6}/setup.cfg +0 -0
  18. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/ServerGunicorn.py +0 -0
  19. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/ServerWaitress.py +0 -0
  20. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/__init__.py +0 -0
  21. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/access_log.py +0 -0
  22. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/apidocs-dark.css +0 -0
  23. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/auth.py +0 -0
  24. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/constants.py +0 -0
  25. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/download_paths.py +0 -0
  26. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/download_slots.py +0 -0
  27. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/install/worker.ps1 +0 -0
  28. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/install/worker.sh +0 -0
  29. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/listcache.py +0 -0
  30. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/__init__.py +0 -0
  31. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/cache.py +0 -0
  32. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/collections.py +0 -0
  33. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/downloads.py +0 -0
  34. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/metadata.py +0 -0
  35. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/operations.py +0 -0
  36. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/schedules.py +0 -0
  37. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/sqlite.py +0 -0
  38. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/system.py +0 -0
  39. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/tables.py +0 -0
  40. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/timeseries.py +0 -0
  41. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/web_routes.py +0 -0
  42. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/API/routes/workers.py +0 -0
  43. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Auth/__init__.py +0 -0
  44. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Auth/bootstrap.py +0 -0
  45. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Auth/migrate.py +0 -0
  46. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Auth/store.py +0 -0
  47. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Auth/workers.py +0 -0
  48. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/CacheRedis.py +0 -0
  49. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/Server.py +0 -0
  50. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/__init__.py +0 -0
  51. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/auth.py +0 -0
  52. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/cache.py +0 -0
  53. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/errors.py +0 -0
  54. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/index.py +0 -0
  55. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/lifecycle.py +0 -0
  56. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/memory.py +0 -0
  57. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/periods.py +0 -0
  58. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/schedule.py +0 -0
  59. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/series.py +0 -0
  60. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/service.py +0 -0
  61. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/templates/tradingview.html +0 -0
  62. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Charts/tradingview.py +0 -0
  63. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/CollectionMongoDB.py +0 -0
  64. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/ConsensusGraph.py +0 -0
  65. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/DataAPI/__init__.py +0 -0
  66. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/DataAPI/catalog.py +0 -0
  67. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/DataAPI/config.py +0 -0
  68. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/DataAPI/errors.py +0 -0
  69. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/DataAPI/indexes.py +0 -0
  70. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/DataAPI/readers.py +0 -0
  71. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/DataAPI/resolve.py +0 -0
  72. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/DataAPI/service.py +0 -0
  73. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Database.py +0 -0
  74. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Defaults.py +0 -0
  75. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/AWSEC2.py +0 -0
  76. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/AWSS3.py +0 -0
  77. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/AutoDocstrings.py +0 -0
  78. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/ClientAPI.py +0 -0
  79. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/ClientSocket.py +0 -0
  80. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/ClientWebSocket.py +0 -0
  81. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/LogHandlerAPI.py +0 -0
  82. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/LogReader.py +0 -0
  83. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/MongoDBClient.py +0 -0
  84. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/SaveTables.py +0 -0
  85. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/ServerSocket.py +0 -0
  86. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/ServerWebSocket.py +0 -0
  87. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/StreamsCache.py +0 -0
  88. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/StreamsPersist.py +0 -0
  89. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/SyncTable.py +0 -0
  90. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/TunnelWebSocket.py +0 -0
  91. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/IO/__init__.py +0 -0
  92. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeBase.py +0 -0
  93. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeContract.py +0 -0
  94. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeEvaluation.py +0 -0
  95. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeExperiment.py +0 -0
  96. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeGraph.py +0 -0
  97. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeLookup.py +0 -0
  98. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeMarket.py +0 -0
  99. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeOntology.py +0 -0
  100. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeResearch.py +0 -0
  101. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeScenario.py +0 -0
  102. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/KnowledgeXBRL.py +0 -0
  103. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Listing.py +0 -0
  104. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/LockWaiters.py +0 -0
  105. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Logger.py +0 -0
  106. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/MCP/__init__.py +0 -0
  107. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/MCP/__main__.py +0 -0
  108. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/MCP/client.py +0 -0
  109. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/MCP/server.py +0 -0
  110. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Metadata.py +0 -0
  111. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/MultiProc.py +0 -0
  112. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/OpenFIGI.py +0 -0
  113. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Redaction.py +0 -0
  114. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/ResearchMCP.py +0 -0
  115. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/ArchiveOldCollections.py +0 -0
  116. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/BatchJob.py +0 -0
  117. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/ContainerHealth.py +0 -0
  118. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/HealthProbe.py +0 -0
  119. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/JobStore.py +0 -0
  120. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/PackageRoutine.py +0 -0
  121. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/RoutineCommand.py +0 -0
  122. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/RoutineOrigin.py +0 -0
  123. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/Schedule.py +0 -0
  124. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/ScheduleMirror.py +0 -0
  125. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/ScheduleMonitor.py +0 -0
  126. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/ScheduleStore.py +0 -0
  127. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/Scheduler.py +0 -0
  128. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/UpdateActiveJobs.py +0 -0
  129. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/Worker.py +0 -0
  130. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/WorkerBootstrap.py +0 -0
  131. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/WorkerLib.py +0 -0
  132. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/WorkerPool.py +0 -0
  133. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Routines/__init__.py +0 -0
  134. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/SQLite.py +0 -0
  135. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/SharedData.py +0 -0
  136. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/SharedNumpy.py +0 -0
  137. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/StreamKafka.py +0 -0
  138. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Symbol.py +0 -0
  139. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Table.py +0 -0
  140. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableDisk.py +0 -0
  141. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableDocuments.py +0 -0
  142. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableIndex.py +0 -0
  143. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableIndexJitFunctions.py +0 -0
  144. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableIndexJitFunctionsManual.py +0 -0
  145. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableIndexJitGenerate.py +0 -0
  146. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableIndexJitHash.py +0 -0
  147. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableIndexJitLoc.py +0 -0
  148. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableLayout.py +0 -0
  149. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableProtocol.py +0 -0
  150. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableRead.py +0 -0
  151. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableRewrite.py +0 -0
  152. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TableVector.py +0 -0
  153. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/TimeseriesContainer.py +0 -0
  154. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Users.py +0 -0
  155. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Utils.py +0 -0
  156. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/ADDING_A_PAGE.md +0 -0
  157. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/__init__.py +0 -0
  158. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/activity_logger.py +0 -0
  159. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/app.py +0 -0
  160. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/assets/dashAgGridComponentFunctions.js +0 -0
  161. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/assets/dashAgGridFunctions.js +0 -0
  162. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/assets/google_logo.png +0 -0
  163. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/assets/kafka_keys.js +0 -0
  164. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/assets/logs.css +0 -0
  165. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/assets/sched.css +0 -0
  166. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/assets/styles.css +0 -0
  167. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/auth.py +0 -0
  168. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/backends.py +0 -0
  169. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/config.py +0 -0
  170. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/containers.py +0 -0
  171. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/identity.py +0 -0
  172. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/kafka_view.py +0 -0
  173. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/proc.py +0 -0
  174. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/redis_view.py +0 -0
  175. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/route_health.py +0 -0
  176. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/route_registry.py +0 -0
  177. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/sched.py +0 -0
  178. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/schedule_editor.py +0 -0
  179. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/server.py +0 -0
  180. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/shell.py +0 -0
  181. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/standalone.py +0 -0
  182. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/account.js +0 -0
  183. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/custom.css +0 -0
  184. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/favicon.ico +0 -0
  185. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/favicon.png +0 -0
  186. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/logo.png +0 -0
  187. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/logo_96x96.png +0 -0
  188. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/shareddata-mark.svg +0 -0
  189. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/shell.css +0 -0
  190. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/shell.js +0 -0
  191. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/static/standalone.css +0 -0
  192. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/suggest.py +0 -0
  193. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/account.html +0 -0
  194. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/base.html +0 -0
  195. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/claim.html +0 -0
  196. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/claim_done.html +0 -0
  197. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/dash.html +0 -0
  198. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/index.html +0 -0
  199. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/login.html +0 -0
  200. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/login_2fa.html +0 -0
  201. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/partials/navbar.html +0 -0
  202. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/partials/scripts.html +0 -0
  203. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/recovery_codes.html +0 -0
  204. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/shell.html +0 -0
  205. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/templates/standalone.html +0 -0
  206. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/twofactor.py +0 -0
  207. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/utils.py +0 -0
  208. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/Web/workerpool.py +0 -0
  209. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/__init__.py +0 -0
  210. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/build_info.py +0 -0
  211. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/fleet.py +0 -0
  212. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/fleet_power.py +0 -0
  213. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/power_facts.py +0 -0
  214. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/power_state.py +0 -0
  215. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/preflight.py +0 -0
  216. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/private_files.py +0 -0
  217. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/release_backup.py +0 -0
  218. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/server.py +0 -0
  219. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/services.py +0 -0
  220. {shareddata-6.101.0 → shareddata-6.101.6}/src/SharedData/sharedmutexwin.pyd +0 -0
  221. {shareddata-6.101.0 → shareddata-6.101.6}/src/shareddata.egg-info/SOURCES.txt +0 -0
  222. {shareddata-6.101.0 → shareddata-6.101.6}/src/shareddata.egg-info/dependency_links.txt +0 -0
  223. {shareddata-6.101.0 → shareddata-6.101.6}/src/shareddata.egg-info/entry_points.txt +0 -0
  224. {shareddata-6.101.0 → shareddata-6.101.6}/src/shareddata.egg-info/requires.txt +0 -0
  225. {shareddata-6.101.0 → shareddata-6.101.6}/src/shareddata.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: shareddata
3
- Version: 6.101.0
3
+ Version: 6.101.6
4
4
  Summary: Memory-mapped record and time-series store with an HTTP API and a distributed scheduler
5
5
  Home-page: https://shareddata.net
6
6
  Author: shareddata
@@ -59,19 +59,6 @@ Provides-Extra: s3
59
59
  Provides-Extra: kafka
60
60
  Provides-Extra: redis
61
61
  Provides-Extra: all
62
- Dynamic: author
63
- Dynamic: author-email
64
- Dynamic: classifier
65
- Dynamic: description
66
- Dynamic: description-content-type
67
- Dynamic: home-page
68
- Dynamic: license
69
- Dynamic: license-file
70
- Dynamic: project-url
71
- Dynamic: provides-extra
72
- Dynamic: requires-dist
73
- Dynamic: requires-python
74
- Dynamic: summary
75
62
 
76
63
  # SharedData
77
64
 
@@ -66,7 +66,7 @@ test_requires = [
66
66
 
67
67
  setup(
68
68
  name='shareddata',
69
- version='6.101.0',
69
+ version='6.101.6',
70
70
  description='Memory-mapped record and time-series store with an HTTP API and a distributed scheduler',
71
71
  author='shareddata',
72
72
  author_email='admin@shareddata.net',
@@ -2,7 +2,7 @@
2
2
  openapi: 3.0.3
3
3
  info:
4
4
  title: SharedData API
5
- version: 6.101.0
5
+ version: 6.101.6
6
6
  description: |
7
7
  HTTP API of a SharedData server. The same operations are available from Python
8
8
  through `SharedData.IO.ClientAPI` (for example `ClientAPI.get_table(...)`).
@@ -3470,6 +3470,8 @@ paths:
3470
3470
  '400': &data_bad
3471
3471
  description: '`{"error": "bad_request", "message": "..."}`: the message names the parameter.'
3472
3472
  '401': *id001
3473
+ '503': &data_unavailable
3474
+ description: '`{"error": "table_busy", "type": "TableBusy", "message": "..."}` when the waiter cap is reached (`Retry-After: 2`), or `{"error": "auth_store_unavailable"}`.'
3473
3475
  /api/data/symbols:
3474
3476
  get:
3475
3477
  tags:
@@ -3537,6 +3539,7 @@ paths:
3537
3539
  description: The token cannot read the containers this request resolves to.
3538
3540
  '404': &data_missing
3539
3541
  description: No dataset matches the request.
3542
+ '503': *data_unavailable
3540
3543
  /api/data/symbol/{symbol}:
3541
3544
  get:
3542
3545
  tags:
@@ -3558,6 +3561,7 @@ paths:
3558
3561
  '200':
3559
3562
  description: '`{"provenance": {...}, "data": {"query", "canonical", "ticker", "found", "aliases", "forms"}}`'
3560
3563
  '401': *id001
3564
+ '503': *data_unavailable
3561
3565
  /api/data/marketdata/{symbol}:
3562
3566
  get:
3563
3567
  tags:
@@ -3613,6 +3617,7 @@ paths:
3613
3617
  '401': *id001
3614
3618
  '403': *data_denied
3615
3619
  '404': *data_missing
3620
+ '503': *data_unavailable
3616
3621
  /api/data/signals/{symbol}:
3617
3622
  get:
3618
3623
  tags:
@@ -3648,6 +3653,7 @@ paths:
3648
3653
  '400': *data_bad
3649
3654
  '401': *id001
3650
3655
  '404': *data_missing
3656
+ '503': *data_unavailable
3651
3657
  /api/data/portfolios/{portfolio}:
3652
3658
  get:
3653
3659
  tags:
@@ -3701,6 +3707,7 @@ paths:
3701
3707
  '401': *id001
3702
3708
  '403': *data_denied
3703
3709
  '404': *data_missing
3710
+ '503': *data_unavailable
3704
3711
  /api/data/riskfactors/{factor}:
3705
3712
  get:
3706
3713
  tags:
@@ -3745,6 +3752,7 @@ paths:
3745
3752
  '400': *data_bad
3746
3753
  '401': *id001
3747
3754
  '404': *data_missing
3755
+ '503': *data_unavailable
3748
3756
  /api/data/vol/{symbol}:
3749
3757
  get:
3750
3758
  tags:
@@ -3825,3 +3833,4 @@ paths:
3825
3833
  '409':
3826
3834
  description: The collection lacks the key index this read needs; an operator creates it with
3827
3835
  `python -m SharedData.DataAPI.indexes --apply`.
3836
+ '503': *data_unavailable
@@ -10,9 +10,11 @@ import json
10
10
 
11
11
  from flask import Blueprint, Response, current_app, jsonify, request
12
12
 
13
+ from SharedData.API.utils import table_busy_response
13
14
  from SharedData.Auth.store import StoreUnavailable
14
15
  from SharedData.DataAPI import service
15
16
  from SharedData.DataAPI.errors import DataAPIError
17
+ from SharedData.LockWaiters import TableBusy
16
18
 
17
19
  KEYED = ('symbol', 'marketdata', 'signals', 'portfolios', 'riskfactors', 'vol')
18
20
 
@@ -52,6 +54,8 @@ def init_data_routes(shdata, authenticate_fn, permissions_fn=token_permissions,
52
54
  return jsonify(error='auth_store_unavailable'), 503
53
55
  except DataAPIError as exc:
54
56
  return jsonify(error=exc.code, message=str(exc)), exc.status
57
+ except TableBusy as exc:
58
+ return table_busy_response(exc)
55
59
  except Exception as exc:
56
60
  current_app.logger.error('data API failure in %s: %s', operation, type(exc).__name__)
57
61
  return jsonify(error='data_api_failure'), 500
@@ -83,7 +83,7 @@ def table_busy_response(error):
83
83
  except Exception:
84
84
  pass
85
85
  message = str(error)
86
- data = json.dumps({'type': 'TableBusy', 'message': message}).encode('utf-8')
86
+ data = json.dumps({'type': 'TableBusy', 'error': 'table_busy', 'message': message}).encode('utf-8')
87
87
  response = Response(data, status=503, mimetype='application/json')
88
88
  response.headers['Content-Length'] = len(data)
89
89
  response.headers['Retry-After'] = '2'
@@ -56,8 +56,15 @@ DRAIN_SECONDS = 60 # require a fresh heartbeat taken after dispatch was disable
56
56
  MIN_ON_SECONDS = 10 * 60
57
57
  MAX_WORKLOAD_AGE = 60
58
58
  SHUTDOWN_SETTLE_SECONDS = 90 # silence this long after a dispatched poweroff counts as off
59
+ WOL_RETRY_SECONDS = 60
60
+ WOL_SHUTDOWN_RETRY_SECONDS = 180 # observed 152s shutdown tail plus one cycle/clock margin
59
61
  PREFLIGHT_RETRY_SECONDS = 30 * 60 # a failed preflight (desktop in use, NIC not armed) holds the host
60
62
  INFERENCE_WAKE_TIMEOUT_SECONDS = 15 * 60 # boot plus model load, until its worker reports the model healthy
63
+ # A failed wake holds its host on. The first failure is released after this long continuously READY on
64
+ # fresh reports newer than the failure; observations further apart than the gap start the wait again.
65
+ WAKE_HOLD_RELEASE_SECONDS = 15 * 60
66
+ WAKE_HOLD_MAX_GAP_SECONDS = 2 * MAX_WORKLOAD_AGE
67
+ WAKE_HOLD_HISTORY = ('wake_failed', 'wake_failed_at', 'wake_failure_error', 'wake_failures', 'wake_hold_released_at')
61
68
  MANAGED_COMPUTE_SERVERS = [h for h, info in STATIC_HOST_INVENTORY.items() if info.get('managed')]
62
69
  BASELINE_SERVERS = {h for h, info in STATIC_HOST_INVENTORY.items() if info.get('protected')}
63
70
  _inventory_generation = fleet_power._loaded['generation']
@@ -109,6 +116,24 @@ def _worker_fresh(row, now):
109
116
  return row.get('alive') is True and -5 <= now - _stamp(row['at']) <= MAX_WORKLOAD_AGE
110
117
 
111
118
 
119
+ def _epoch(value, now):
120
+ """A recorded time, or None when it is missing, not a number or in the future."""
121
+ if isinstance(value, (int, float)) and not isinstance(value, bool) and 0 < value <= now and math.isfinite(value):
122
+ return value
123
+ return None
124
+
125
+
126
+ def _latch_wake_failure(row, error, now):
127
+ """Hold the host on after a failed wake. `wake_failures` counts failed wakes since the last
128
+ tracked successful one; an unknown count after an earlier hold counts as one failure."""
129
+ count = row.get('wake_failures')
130
+ if type(count) is not int or count < 0:
131
+ count = 1 if row.get('wake_failed') or any(k in row for k in WAKE_HOLD_HISTORY[1:]) else 0
132
+ row.update(wake_failed=True, wake_failed_at=now, wake_failure_error=error, wake_failures=count + 1)
133
+ row.pop('wake_recovered_since', None)
134
+ row.pop('wake_recovered_seen', None)
135
+
136
+
112
137
  def _kind(host):
113
138
  """A discovered model server or the inventory's workload kind; unknown never erases inference."""
114
139
  facts = _FACTS.get(host)
@@ -208,6 +233,7 @@ class ClusterPowerGovernor:
208
233
  self._settings = dict(enabled=True, max_hosts=None, hosts={})
209
234
  self._workers = {}
210
235
  self._last_action_at = 0.0
236
+ self._wake_hold_events = []
211
237
  self.lease_registry = LeaseRegistry(db_folder)
212
238
  self.store = self.lease_registry.store
213
239
  self.state_file = self.store.folder / 'power_state.json'
@@ -384,6 +410,7 @@ class ClusterPowerGovernor:
384
410
  now = now_dt.timestamp()
385
411
  states = deepcopy(self._shadow_states if self.mode == 'observe' and self._shadow_states is not None else self.node_states)
386
412
  errors = []
413
+ self._wake_hold_events = [] # audited by execute_cycle before the state that contains them is saved
387
414
  _reload_inventory()
388
415
  states = {host: row for host, row in states.items()
389
416
  if host in MANAGED_COMPUTE_SERVERS and STATIC_HOST_INVENTORY.get(host, {}).get('managed')}
@@ -459,8 +486,43 @@ class ClusterPowerGovernor:
459
486
  if 'control_until' not in row:
460
487
  # Written by an older release (whose observe mode saved simulated transitions) or
461
488
  # never controlled: no evidence of an action in flight. Reconcile from the probe.
462
- row = states[host] = dict(state='UNKNOWN', last_job_finish=now, since=now)
463
- row.setdefault('since', now)
489
+ # A failed-wake hold and its history are kept: that release did learn them.
490
+ row = states[host] = dict(state='UNKNOWN', last_job_finish=now, since=now,
491
+ **{k: row[k] for k in WAKE_HOLD_HISTORY if k in row})
492
+ # The recovery wait survives only cycles that observe it again below; any other path voids it.
493
+ recovered = (row.pop('wake_recovered_since', None), row.pop('wake_recovered_seen', None), row.get('state'))
494
+ invalid = []
495
+ if (('wake_failures' in row and (type(row['wake_failures']) is not int
496
+ or row['wake_failures'] < (1 if row.get('wake_failed') else 0)))
497
+ or ('wake_failures' not in row and any(k in row for k in
498
+ ('wake_failed_at', 'wake_failure_error', 'wake_hold_released_at')))):
499
+ # An explicitly invalid count or incomplete modern history is not a first failure.
500
+ # In particular, bool/float equality with 1 must not authorize a shutdown.
501
+ row['wake_failures'] = 2
502
+ invalid.append('wake_failures')
503
+ for key in ('wake_failed_at', 'wake_hold_released_at'):
504
+ if (key in row and row[key] is not None and _epoch(row[key], now) is None
505
+ and not (key == 'wake_failed_at' and row.get('wake_failed'))):
506
+ # Unknown history remains unknown, but must be JSON-safe even after tracked success.
507
+ row[key] = None
508
+ invalid.append(key)
509
+ if invalid:
510
+ self._wake_hold_events.append(dict(host=host, action='wake_history_invalid', fields=invalid))
511
+ if row.get('wake_failed') and _epoch(row.get('wake_failed_at'), now) is None:
512
+ # Held by an older release (no failure time) or an unusable time: the failure is dated now, never
513
+ # from `since`, which recoveries rewrite. History unknown counts as one failure only for the
514
+ # signature of a single Wake-on-LAN readiness timeout; anything else stays held.
515
+ single = (row.get('last_action') == 'WAKE' and row.get('bmc_tried') is not True
516
+ and row.get('error') in ('readiness timeout', None))
517
+ if 'wake_failures' not in row:
518
+ row['wake_failures'] = 1 if single else 2
519
+ if not isinstance(row.get('wake_failure_error'), str):
520
+ row['wake_failure_error'] = 'readiness timeout' if single else 'unknown'
521
+ row['wake_failed_at'] = now
522
+ self._wake_hold_events.append(dict(host=host, action='wake_hold_set', adopted=True, wake_failed_at=now,
523
+ wake_failure_error=row['wake_failure_error'],
524
+ wake_failures=row['wake_failures']))
525
+ row.setdefault('since', 0 if row.get('state') == 'WAKING' else now)
464
526
  if (self.mode == 'control' and row['state'] == 'DRAINING'
465
527
  and (row.get('control_until', 0) <= now or row.get('gate_started_at') != row.get('drain_start'))):
466
528
  # Old observe state and expired gates are not evidence that dispatch drained.
@@ -482,9 +544,14 @@ class ClusterPowerGovernor:
482
544
  # The worker must fetch startup/repair commands even while a model is loading.
483
545
  # Model health and load gate shutdown separately; they must not close worker dispatch.
484
546
  ready = physical == 'ONLINE' and bool(beats) and all(_worker_fresh(b, now) for b in beats)
485
- # Never retry failed actuation automatically. New demand may recover an ONLINE host.
547
+ # Reconcile a recovered wake without demand: ERROR also gates normal job dispatch.
548
+ # Keep the failed-wake shutdown hold; a heartbeat cannot prove the hardware fault fixed.
486
549
  if row['state'] == 'ERROR':
487
- if host in active and ready:
550
+ if (row.get('error') == 'readiness timeout' and row.get('last_action') == 'WAKE'
551
+ and ready and power_facts.fresh(_FACTS.get(host)) and data_healthy and not frozen):
552
+ row.update(state='READY', error=None, since=now, last_job_finish=now, drain_start=None)
553
+ elif host in active and ready:
554
+ # Never retry failed actuation automatically. New demand may recover an ONLINE host.
488
555
  row.update(state='READY', since=now, last_job_finish=now)
489
556
  elif (host in active and data_healthy and not frozen and not probe.get('reachable')
490
557
  and row.get('last_action') == 'POWEROFF'):
@@ -500,8 +567,13 @@ class ClusterPowerGovernor:
500
567
  if row['state'] in {'WAKING', 'STOPPING'}:
501
568
  timeout = ((INFERENCE_WAKE_TIMEOUT_SECONDS if _kind(host) == 'inference' else WAKE_TIMEOUT_SECONDS)
502
569
  if row['state'] == 'WAKING' else SHUTDOWN_TIMEOUT_SECONDS)
570
+ started = row.get('wake_episode_started_at', row.get('since'))
571
+ valid_age = (isinstance(started, (int, float)) and not isinstance(started, bool)
572
+ and math.isfinite(started) and 0 < started <= now)
573
+ elapsed = now - started if valid_age else float('inf')
503
574
  if row['state'] == 'WAKING' and ready:
504
- row.update(state='READY', since=now, last_job_finish=now, wake_failed=False,
575
+ # A tracked wake proves the way back: clear the hold and its count, keep its history.
576
+ row.update(state='READY', since=now, last_job_finish=now, wake_failed=False, wake_failures=0,
505
577
  wake_by='bmc' if row.get('bmc_tried') else row.get('wake_by', 'wol'), bmc_tried=False)
506
578
  elif row['state'] == 'STOPPING' and physical == 'OFFLINE':
507
579
  row.update(state='OFF', since=now)
@@ -518,16 +590,35 @@ class ClusterPowerGovernor:
518
590
  holds[host] = 'shutdown preflight failed: ' + row['preflight_error']
519
591
  online.add(host)
520
592
  continue
521
- elif (row['state'] == 'WAKING' and now - row.get('since', now) >= timeout and not row.get('bmc_tried')
593
+ elif (row['state'] == 'WAKING' and valid_age and elapsed >= timeout and not row.get('bmc_tried')
522
594
  and fleet_power.bmc_usable(STATIC_HOST_INVENTORY[host], _FACTS.get(host))):
523
595
  # Wake-on-LAN did not start it: try its BMC once, and remember which worked.
524
- row.update(since=now, bmc_tried=True)
596
+ row.update(since=now, bmc_tried=True, wake_episode_started_at=started)
525
597
  actions.append(dict(action='WAKE', host=host, method='bmc', reason='Wake-on-LAN did not start it'))
526
598
  online.add(host)
527
599
  continue
528
- elif now - row.get('since', now) >= timeout:
600
+ elif (row['state'] == 'WAKING' and valid_age and elapsed < timeout
601
+ and not row.get('bmc_tried') and not fleet_power.bmc_usable(info, _FACTS.get(host))
602
+ and row.get('wake_after_unconfirmed_shutdown') is True and row.get('wake_attempts') == 1
603
+ and isinstance(row.get('shutdown_started_at'), (int, float))
604
+ and not isinstance(row['shutdown_started_at'], bool)
605
+ and math.isfinite(row['shutdown_started_at']) and 0 <= row['shutdown_started_at'] <= now
606
+ and now - row['shutdown_started_at'] >= WOL_SHUTDOWN_RETRY_SECONDS
607
+ and now - row.get('since', now) >= WOL_RETRY_SECONDS):
608
+ actions.append(dict(action='WAKE', host=host, retry=True, method='wol',
609
+ reason='one delayed WOL retry after unconfirmed shutdown'))
610
+ online.add(host)
611
+ continue
612
+ elif ((elapsed >= timeout * (2 if row.get('bmc_tried') else 1)) if row['state'] == 'WAKING'
613
+ else now - row.get('since', now) >= timeout):
529
614
  if row['state'] == 'WAKING':
530
- row['wake_failed'] = True # learned: kept on from now on, shown on the WORKERS page
615
+ # Learned: kept on, shown on the WORKERS page. A BMC that did not start it either is
616
+ # never released automatically.
617
+ _latch_wake_failure(row, 'readiness timeout after BMC' if row.get('bmc_tried')
618
+ else 'readiness timeout', now)
619
+ self._wake_hold_events.append(dict(host=host, action='wake_hold_set', wake_failed_at=now,
620
+ wake_failure_error=row['wake_failure_error'],
621
+ wake_failures=row['wake_failures']))
531
622
  row.update(state='ERROR', error='readiness timeout' if row['state'] == 'WAKING' else 'power-off unconfirmed', since=now)
532
623
  errors.append(host + ': ' + row['error'])
533
624
  online.add(host)
@@ -541,6 +632,27 @@ class ClusterPowerGovernor:
541
632
  row.update(state='OFF')
542
633
  elif physical == 'ONLINE' and row['state'] in {'OFF', 'OFF_UNCONFIRMED', 'UNKNOWN'}:
543
634
  row.update(state='READY', since=now, last_job_finish=now)
635
+ if row.get('wake_failed'):
636
+ # First failed wake only, and only on positive evidence taken after it: READY on entry and
637
+ # now, its worker reporting in, facts received since, controller data healthy and unfrozen.
638
+ # Never touches its idle timers: cool-down, drain and preflight still decide any shutdown.
639
+ failed_at, facts = row['wake_failed_at'], _FACTS.get(host)
640
+ since, seen, entered = recovered
641
+ if (row.get('wake_failure_error') == 'readiness timeout' and row.get('wake_failures') == 1
642
+ and entered == 'READY' and row['state'] == 'READY' and ready and data_healthy and not frozen
643
+ and power_facts.fresh(facts) and facts.get('received_at', 0) > failed_at
644
+ and all(_stamp(b['at']) > failed_at for b in beats)):
645
+ if not (_epoch(seen, now) and now - seen <= WAKE_HOLD_MAX_GAP_SECONDS
646
+ and _epoch(since, now) and since > failed_at):
647
+ since = now
648
+ if now - since >= WAKE_HOLD_RELEASE_SECONDS:
649
+ row.update(wake_failed=False, wake_hold_released_at=now)
650
+ self._wake_hold_events.append(dict(
651
+ host=host, action='wake_hold_released', wake_failed_at=failed_at,
652
+ wake_failure_error=row['wake_failure_error'], wake_failures=row['wake_failures'],
653
+ recovered_since=since, evidence=probe.get('evidence')))
654
+ else:
655
+ row.update(wake_recovered_since=since, wake_recovered_seen=now)
544
656
  if host in active:
545
657
  online.add(host)
546
658
  row['last_job_finish'] = now
@@ -572,7 +684,10 @@ class ClusterPowerGovernor:
572
684
  online.add(host)
573
685
  continue
574
686
  if row.get('wake_failed'):
575
- holds[host] = 'its last wake failed: kept on until it is started by hand'
687
+ holds[host] = ('its last wake failed: kept on until it has run healthy for %d minutes or a tracked '
688
+ 'wake succeeds' % (WAKE_HOLD_RELEASE_SECONDS // 60)
689
+ if row.get('wake_failure_error') == 'readiness timeout' and row.get('wake_failures') == 1
690
+ else 'its last wake failed: kept on until a tracked wake succeeds')
576
691
  row.update(state='READY', drain_start=None)
577
692
  online.add(host)
578
693
  continue
@@ -676,6 +791,8 @@ class ClusterPowerGovernor:
676
791
  previous = deepcopy(self.node_states)
677
792
  decision = self.get_servers_needed_online()
678
793
  self.node_states = self._planned_states
794
+ for event in self._wake_hold_events: # recorded before any save that sets or drops a hold
795
+ self._audit(**event)
679
796
  for action in list(decision['actions_proposed']):
680
797
  row = self.node_states[action['host']]
681
798
  if action['action'] == 'POWEROFF' and row.get('control_until', 0) <= time.time():
@@ -706,12 +823,24 @@ class ClusterPowerGovernor:
706
823
  action_started = time.time()
707
824
  if action['action'] == 'WAKE':
708
825
  # Persist wake intent before network I/O as well, for crash recovery.
709
- self.node_states[host].update(state='WAKING', last_action='WAKE', since=time.time())
826
+ row = self.node_states[host]
827
+ if row['state'] != 'WAKING':
828
+ row.update(wake_episode_started_at=action_started, wake_attempts=0,
829
+ wake_after_unconfirmed_shutdown=row['state'] == 'OFF_UNCONFIRMED')
830
+ row.update(state='WAKING', last_action='WAKE', since=action_started,
831
+ wake_attempts=row.get('wake_attempts', 1) + 1)
710
832
  self._persist()
711
833
  method = action.get('method') or ('bmc' if self.node_states[host].get('wake_by') == 'bmc' else 'auto')
712
- result = wake_host(host, _FACTS.get(host), method=method)
834
+ try:
835
+ result = wake_host(host, _FACTS.get(host), method=method)
836
+ except Exception as exc:
837
+ result = dict(success=False, status='error', error=type(exc).__name__)
713
838
  if not result.get('success'):
714
- self.node_states[host].update(state='ERROR', error='wake dispatch failed', wake_failed=True)
839
+ row = self.node_states[host]
840
+ row.update(state='ERROR', error='wake dispatch failed')
841
+ _latch_wake_failure(row, 'wake dispatch failed', time.time())
842
+ self._audit(host=host, action='wake_hold_set', wake_failed_at=row['wake_failed_at'],
843
+ wake_failure_error=row['wake_failure_error'], wake_failures=row['wake_failures'])
715
844
  elif result.get('method') in ('bmc', 'wol'):
716
845
  self.node_states[host]['wake_by'] = result['method']
717
846
  else:
@@ -797,6 +926,7 @@ class ClusterPowerGovernor:
797
926
  self._keep_online(host)
798
927
  continue
799
928
  self.node_states[host].update(state='STOPPING', last_action='POWEROFF', since=time.time(),
929
+ shutdown_started_at=time.time(),
800
930
  preflight_error=None, preflight_retry_at=0)
801
931
  self._persist()
802
932
  worker = next(b['name'] for b in beats if _worker_fresh(b, now))
@@ -811,6 +941,9 @@ class ClusterPowerGovernor:
811
941
  self._last_action_at = time.time()
812
942
  results.append({**result, 'host': host, 'action': action['action']})
813
943
  self._audit(host=host, action=action['action'], status=result.get('status'),
944
+ wake_attempt=self.node_states[host].get('wake_attempts') if action['action'] == 'WAKE' else None,
945
+ wake_episode_started_at=self.node_states[host].get('wake_episode_started_at') if action['action'] == 'WAKE' else None,
946
+ packets_sent=result.get('packets_sent'),
814
947
  reason=action['reason'], state=self.node_states[host]['state'],
815
948
  evidence=decision['probes'][host].get('evidence'), duration_seconds=time.time() - action_started)
816
949
  self._persist()
@@ -930,8 +930,6 @@ class TimeSeriesDisk:
930
930
  columns=self.columns,
931
931
  copy=False)
932
932
  self.data.index.name = 'date'
933
-
934
- Logger.log.info(f'Zero-copy appended {len(new_columns)} columns to {filepath} (no data copied!)')
935
933
 
936
934
  self._update_file_metadata()
937
935
  collected = getattr(_appended, 'columns', None)
@@ -76,7 +76,7 @@ def _ask_server(address, env):
76
76
  from pymongo import MongoClient
77
77
  started = time.time()
78
78
  out = {'address': address, 'host': '', 'role': '', 'set': None, 'answers': False, 'error': None, 'seconds': None, 'version': None, 'uptime': None,
79
- 'connections': None, 'connections_free': None, 'memory_mb': None, 'operations': {}}
79
+ 'state_str': None, 'connections': None, 'connections_free': None, 'memory_mb': None, 'operations': {}}
80
80
  limit = int(SERVER_SECONDS * 1000)
81
81
  try:
82
82
  client = MongoClient(_server_uri(env, address), serverSelectionTimeoutMS=limit, connectTimeoutMS=limit, socketTimeoutMS=limit)
@@ -93,6 +93,13 @@ def _ask_server(address, env):
93
93
  operations={name: status.get('opcounters', {}).get(name) for name in ('insert', 'query', 'update', 'delete', 'command')})
94
94
  except Exception as exc: # it answers, but this user may not read its numbers
95
95
  out['error'] = 'its numbers cannot be read (%s: %s)' % (type(exc).__name__, str(exc)[:120])
96
+ if out['role'] == 'member': # in a set but neither primary nor secondary: which state is it in
97
+ try:
98
+ out['state_str'] = {0: 'STARTUP', 1: 'PRIMARY', 2: 'SECONDARY', 3: 'RECOVERING', 5: 'STARTUP2',
99
+ 6: 'UNKNOWN', 7: 'ARBITER', 8: 'DOWN', 9: 'ROLLBACK', 10: 'REMOVED'}.get(
100
+ client.admin.command('replSetGetStatus').get('myState'))
101
+ except Exception:
102
+ pass
96
103
  finally:
97
104
  client.close()
98
105
  except Exception as exc:
@@ -221,7 +228,9 @@ def _read_cluster(seconds):
221
228
  for name in list(hello.get('hosts', [])) + list(hello.get('arbiters', []))]
222
229
  out['limited'] = True
223
230
  elif out['kind'] == 'sharded':
224
- out['shards'] = [{'name': shard.get('_id'), 'servers': shard.get('host'), 'ready': shard.get('state', 1) == 1} for shard in client.admin.command('listShards').get('shards', [])]
231
+ out['shards'] = [{'name': shard.get('_id'), 'servers': shard.get('host'), 'ready': shard.get('state', 1) == 1,
232
+ 'member_addresses': [address for address in str(shard.get('host') or '').rpartition('/')[2].split(',') if address]}
233
+ for shard in client.admin.command('listShards').get('shards', [])]
225
234
  try: # every router of the cluster, as the routers report themselves
226
235
  now = time.time() # the driver gives the ping in UTC, without its zone
227
236
  out['routers'] = [{'name': router['_id'], 'heard': max(now - router['ping'].replace(tzinfo=timezone.utc).timestamp(), 0) if router.get('ping') else None,
@@ -310,6 +319,49 @@ def _servers(env, seeds, asked, found, started):
310
319
  return rows, len(left_out), unlocated
311
320
 
312
321
 
322
+ def _redundancy(env):
323
+ """Copies each shard should hold, from MONGODB_SHARD_REDUNDANCY: '3' sets all shards,
324
+ 'rs-shard0:3, rs-shard2:2' names them (a bare number defaults the rest). Unset: every
325
+ member the shard lists is wanted. -> (default_or_None, {shard: copies})"""
326
+ default, named = None, {}
327
+ for part in (env.get('MONGODB_SHARD_REDUNDANCY') or '').split(','):
328
+ part = part.strip()
329
+ name, sep, number = part.rpartition(':')
330
+ if sep and name.strip() and number.isdigit():
331
+ named[name.strip()] = int(number)
332
+ elif part.isdigit():
333
+ default = int(part)
334
+ return default, named
335
+
336
+
337
+ def _shard_members(found, replies, identity, want_default, wants):
338
+ """Every member of every shard, as it answers for itself (through _ask): which members hold
339
+ data (primary/secondary), which do not (down, arbiter, STARTUP2/RECOVERING), how many copies
340
+ the shard has against how many are wanted, and the row's level.
341
+ error: the shard cannot serve as configured (not ready, nothing answers, or it is down to its
342
+ last copy while more are wanted). starting: a member is wrong or copies are below wanted."""
343
+ for shard in found['shards']:
344
+ members, issues, have = [], [], 0
345
+ for address in shard.get('member_addresses') or []:
346
+ reply = replies.get((identity, 'shard|' + address)) or {}
347
+ holding = bool(reply.get('answers')) and reply.get('role') in ('primary', 'secondary')
348
+ members.append({'name': address, 'answers': bool(reply.get('answers')), 'role': reply.get('role') or '',
349
+ 'state_str': reply.get('state_str'), 'holding': holding,
350
+ 'version': reply.get('version'), 'uptime': reply.get('uptime'), 'error': reply.get('error')})
351
+ if holding:
352
+ have += 1
353
+ elif not reply.get('answers'):
354
+ issues.append('%s does not answer' % address)
355
+ elif reply.get('role') == 'arbiter':
356
+ issues.append('%s is an arbiter, not a data copy' % address)
357
+ else:
358
+ issues.append('%s is not yet a data copy (%s)' % (address, reply.get('state_str') or reply.get('role') or 'starting'))
359
+ want = wants.get(shard['name'], want_default if want_default is not None else len(shard.get('member_addresses') or []))
360
+ shard.update(members=members, issues=issues, have=have, want=want,
361
+ state='error' if not shard['ready'] or not have or (want > 1 and have == 1)
362
+ else 'starting' if issues or have < want else 'running')
363
+
364
+
313
365
  def view():
314
366
  """-> {'configured', 'state', 'kind', 'summary', 'members', 'shards', 'servers', 'databases', 'problems', 'seconds'}
315
367
  'servers' is one row per server, as that server answers for itself: {'address' (where it is
@@ -340,6 +392,8 @@ def view():
340
392
  with _pending_lock:
341
393
  if cluster is not None and cluster.done() and _pending.get(cluster_key) is cluster:
342
394
  _pending.pop(cluster_key, None)
395
+ members = _submit({(identity, 'shard|' + address): (_ask, (address, env))
396
+ for shard in (found or {}).get('shards', []) for address in shard.get('member_addresses') or []})
343
397
  servers, left_out, unlocated = _servers(env, seeds, asked, found, started)
344
398
  answering = [row for row in servers if row['answers']]
345
399
  counts = {'addresses': env.get('MONGODB_HOST'), 'servers': len(servers), 'answering': len(answering),
@@ -359,9 +413,18 @@ def view():
359
413
  holding = [member for member in found['members'] if member['state'] in ('PRIMARY', 'SECONDARY')]
360
414
  if len(holding) == 1 and not found.get('limited'):
361
415
  problems.append({'level': 'note', 'text': 'the data is on one member only (%s): the set has no second copy' % holding[0]['name']})
416
+ if found['kind'] == 'sharded':
417
+ want_default, wants = _redundancy(env)
418
+ _shard_members(found, _collect(members, started + WAIT - 0.25) if members else {}, identity, want_default, wants)
362
419
  for shard in found['shards']:
363
420
  if not shard['ready']:
364
421
  problems.append({'level': 'error', 'text': 'shard %s is not ready' % shard['name']})
422
+ elif shard.get('state') == 'error':
423
+ problems.append({'level': 'error', 'text': 'shard %s has no redundancy: %d of %d wanted copies answer' % (shard['name'], shard['have'], shard['want'])})
424
+ elif shard.get('have', shard['want']) < shard.get('want', 0):
425
+ problems.append({'level': 'warning', 'text': 'shard %s has %d of %d wanted copies' % (shard['name'], shard['have'], shard['want'])})
426
+ for issue in shard.get('issues', []):
427
+ problems.append({'level': 'warning', 'text': 'shard %s: %s' % (shard['name'], issue)})
365
428
  for row in servers:
366
429
  name = row['host'] or row['address']
367
430
  at = ' at ' + row['address'] if row['host'] and row['address'] and row['address'] != row['host'] else ''
@@ -39,6 +39,15 @@ def _name(value):
39
39
  return value
40
40
 
41
41
 
42
+ def _redundancy(value):
43
+ for part in value.split(','):
44
+ part = part.strip()
45
+ name, sep, number = part.rpartition(':')
46
+ if not (part.isdigit() or (sep and name.strip() and number.isdigit())):
47
+ raise ValueError('a number of copies for every shard (3), or shard:number pairs (rs-shard0:3, rs-shard2:2)')
48
+ return value
49
+
50
+
42
51
  def _number(value):
43
52
  if not _NUMBER.fullmatch(value) or int(value) < 1:
44
53
  raise ValueError('a whole number, 1 or more')
@@ -67,7 +76,8 @@ SERVICES = {
67
76
  ('MONGODB_USER', 'User', '', _name, False, True, None),
68
77
  ('MONGODB_PWD', 'Password', '', _secret, True, True, None),
69
78
  ('MONGODB_REPLICA_SET', 'Replica set', 'rs0 (empty for a single server)', _name, False, False, None),
70
- ('MONGODB_AUTH_DB', 'Database the user is defined in', 'admin', _name, False, False, None)]},
79
+ ('MONGODB_AUTH_DB', 'Database the user is defined in', 'admin', _name, False, False, None),
80
+ ('MONGODB_SHARD_REDUNDANCY', 'Copies wanted per shard', 'a number for all (3), or rs-shard0:3, rs-shard2:2 (empty: every member listed)', _redundancy, False, False, None)]},
71
81
  }
72
82
  _lock = threading.Lock()
73
83
 
@@ -729,7 +729,7 @@ if (workerConfig) {
729
729
  }
730
730
  function wakeText(name, facts, decision) {
731
731
  const learned = (decision?.wake || {})[name] || {};
732
- if (learned.failed) return 'its last wake failed: kept on until started by hand';
732
+ if (learned.failed) return 'its last wake failed: see why it is on';
733
733
  const armed = (facts?.nics || []).filter(n => n.wol);
734
734
  if (learned.by === 'bmc') return 'BMC (Wake-on-LAN did not start it)';
735
735
  if (armed.length) return 'Wake-on-LAN on ' + armed.map(n => n.name).join(', ');
@@ -2356,6 +2356,11 @@ if (servicePage) {
2356
2356
  data.state === 'down' ? null : el('span', {}, bytesText(s.size)));
2357
2357
  const memberLevel = member => !member.healthy || !['PRIMARY', 'SECONDARY', 'ARBITER'].includes(member.state) ? 'error' : member.lag > 60 ? 'starting' : 'running';
2358
2358
  const worst = ['error', 'starting', 'running'].find(level => data.members.some(member => memberLevel(member) === level));
2359
+ const shardLevel = shard => shard.state || (shard.ready ? 'running' : 'error');
2360
+ const shardWorst = ['error', 'starting', 'running'].find(level => data.shards.some(shard => shardLevel(shard) === level));
2361
+ const shardWord = level => level === 'running' ? 'READY' : level === 'starting' ? 'DEGRADED' : 'NOT READY';
2362
+ const memberWord = member => !member.answers ? 'does not answer' + (member.error ? ` (${member.error})` : '')
2363
+ : member.holding ? (member.state_str || member.role).toUpperCase() : member.role === 'arbiter' ? 'ARBITER · no data copy' : `${(member.state_str || member.role || 'member').toUpperCase()} · not yet a data copy`;
2359
2364
  const servers = data.servers || [], silent = servers.filter(server => !server.answers);
2360
2365
  const serverName = server => server.host || server.address;
2361
2366
  fill(list,
@@ -2363,8 +2368,10 @@ if (servicePage) {
2363
2368
  data.members.map(member => row('member|' + member.name, memberLevel(member), member.state || 'UNKNOWN', member.name,
2364
2369
  [member.state === 'SECONDARY' ? (member.lag == null ? '' : member.lag < 1 ? 'in step' : `${spanText(member.lag)} behind`) : '', member.uptime == null ? '' : 'up ' + spanText(member.uptime)],
2365
2370
  [fact('Copies from', member.copies_from), fact('Says', member.message)]))) : null,
2366
- data.shards.length ? group('shards', 'Shards', data.shards.every(shard => shard.ready) ? 'running' : 'error', data.shards.every(shard => shard.ready) ? 'OK' : 'NOT READY', `${data.shards.length}`,
2367
- data.shards.map(shard => row('shard|' + shard.name, shard.ready ? 'running' : 'error', shard.ready ? 'READY' : 'NOT READY', shard.name, [shard.servers], null))) : null,
2371
+ data.shards.length ? group('shards', 'Shards', shardWorst, shardWorst === 'running' ? 'OK' : shardWord(shardWorst), `${data.shards.length}`,
2372
+ data.shards.map(shard => row('shard|' + shard.name, shardLevel(shard), shardWord(shardLevel(shard)), shard.name,
2373
+ [shard.servers, shard.have == null ? '' : `${shard.have} of ${shard.want == null ? (shard.members || []).length : shard.want} copies`],
2374
+ (shard.members || []).map(member => fact(member.name, memberWord(member)))))) : null,
2368
2375
  servers.length ? group('servers', data.kind === 'sharded' ? 'Routers' : 'Servers', silent.length ? 'error' : 'running', silent.length ? 'NO ANSWER' : 'UP',
2369
2376
  `${servers.length - silent.length} of ${servers.length} answer · ` + servers.map(server => serverName(server).replace(/:27017$/, '')).join(', '),
2370
2377
  servers.map(serverRow)) : null,