@nosana/node 1.1.73-rc → 1.1.74-rc
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.
- package/dist/.env +1 -1
- package/dist/package.json +11 -10
- package/dist/packages/common/src/OperationError.d.ts +14 -0
- package/dist/packages/common/src/OperationError.js +18 -0
- package/dist/packages/common/src/expose-id.d.ts +12 -0
- package/dist/packages/common/src/expose-id.js +23 -0
- package/dist/{src/NodeManager/node/utils → packages/common/src}/extractResultsFromLogs.d.ts +1 -1
- package/dist/packages/common/src/index.d.ts +11 -0
- package/dist/packages/common/src/index.js +11 -0
- package/dist/packages/common/src/jobPhaseLog.d.ts +42 -0
- package/dist/packages/common/src/jobPhaseLog.js +207 -0
- package/dist/{src/NodeManager/monitoring/proxy → packages/common/src}/loggingProxy.d.ts +0 -1
- package/dist/{src/NodeManager/monitoring/proxy → packages/common/src}/loggingProxy.js +0 -1
- package/dist/packages/container-orchestrator/src/docker/createDockerRunOptions.d.ts +1 -1
- package/dist/packages/container-orchestrator/src/docker/dockerExtended/index.d.ts +1 -1
- package/dist/packages/container-orchestrator/src/docker/index.d.ts +3 -1
- package/dist/packages/container-orchestrator/src/docker/index.js +60 -29
- package/dist/packages/container-orchestrator/src/hooks.d.ts +9 -2
- package/dist/packages/container-orchestrator/src/hooks.js +5 -0
- package/dist/packages/container-orchestrator/src/index.d.ts +1 -0
- package/dist/packages/container-orchestrator/src/index.js +1 -0
- package/dist/packages/container-orchestrator/src/interface.d.ts +4 -1
- package/dist/packages/container-orchestrator/src/labels.d.ts +2 -0
- package/dist/packages/container-orchestrator/src/labels.js +2 -0
- package/dist/packages/container-orchestrator/src/podman/index.js +4 -9
- package/dist/packages/container-orchestrator/src/podman/utils/createPodmanRunOptions.d.ts +1 -1
- package/dist/packages/container-orchestrator/src/types.d.ts +0 -5
- package/dist/{src/NodeManager/provider → packages/container-orchestrator/src}/utils/parseBuffer.d.ts +1 -3
- package/dist/packages/job-runtime/src/api/eventsource.d.ts +6 -0
- package/dist/{src/NodeManager/node/api/utils → packages/job-runtime/src/api}/interval.d.ts +2 -5
- package/dist/{src/NodeManager/node/api/utils → packages/job-runtime/src/api}/interval.js +1 -1
- package/dist/packages/job-runtime/src/api/middlewares/verifyJobOwnerSignature.d.ts +13 -0
- package/dist/packages/job-runtime/src/api/middlewares/verifyJobOwnerSignature.js +39 -0
- package/dist/packages/job-runtime/src/api/middlewares/verifyWSSignatures.d.ts +10 -0
- package/dist/packages/job-runtime/src/api/middlewares/verifyWSSignatures.js +34 -0
- package/dist/packages/job-runtime/src/api/paths.d.ts +52 -0
- package/dist/packages/job-runtime/src/api/paths.js +52 -0
- package/dist/packages/job-runtime/src/api/router.d.ts +10 -0
- package/dist/packages/job-runtime/src/api/router.js +64 -0
- package/dist/packages/job-runtime/src/api/routes/definitionAndResults.d.ts +8 -0
- package/dist/packages/job-runtime/src/api/routes/definitionAndResults.js +69 -0
- package/dist/packages/job-runtime/src/api/routes/info.d.ts +23 -0
- package/dist/packages/job-runtime/src/api/routes/info.js +69 -0
- package/dist/packages/job-runtime/src/api/routes/operations.d.ts +36 -0
- package/dist/packages/job-runtime/src/api/routes/operations.js +120 -0
- package/dist/packages/job-runtime/src/api/routes/ssh.d.ts +11 -0
- package/dist/packages/job-runtime/src/api/routes/ssh.js +83 -0
- package/dist/packages/job-runtime/src/api/routes/stats.d.ts +4 -0
- package/dist/{src/NodeManager/node/api/routes/get/job-stats-stream.js → packages/job-runtime/src/api/routes/stats.js} +25 -5
- package/dist/packages/job-runtime/src/api/runtime/terminal.d.ts +15 -0
- package/dist/{src/NodeManager/provider/webTerminal.js → packages/job-runtime/src/api/runtime/terminal.js} +13 -9
- package/dist/{src/NodeManager/node/api/routes/wss → packages/job-runtime/src/api}/terminal/terminalAuthorization.d.ts +0 -1
- package/dist/{src/NodeManager/node/api/routes/wss → packages/job-runtime/src/api}/terminal/terminalAuthorization.js +3 -3
- package/dist/{src/NodeManager/node/api/routes/wss/terminal/terminal.d.ts → packages/job-runtime/src/api/terminal/terminalBridge.d.ts} +6 -7
- package/dist/{src/NodeManager/node/api/routes/wss/terminal/terminal.js → packages/job-runtime/src/api/terminal/terminalBridge.js} +15 -23
- package/dist/packages/job-runtime/src/api/types.d.ts +170 -0
- package/dist/packages/job-runtime/src/api/wsClose.d.ts +6 -0
- package/dist/packages/job-runtime/src/api/wsClose.js +10 -0
- package/dist/packages/job-runtime/src/api/wsHandler.d.ts +10 -0
- package/dist/packages/job-runtime/src/api/wsHandler.js +145 -0
- package/dist/packages/job-runtime/src/chain.d.ts +28 -0
- package/dist/packages/job-runtime/src/chain.js +72 -0
- package/dist/packages/job-runtime/src/config.d.ts +39 -0
- package/dist/packages/job-runtime/src/config.js +57 -0
- package/dist/packages/job-runtime/src/host/HostClient.d.ts +29 -0
- package/dist/packages/job-runtime/src/host/HostClient.js +91 -0
- package/dist/packages/job-runtime/src/host/contract.d.ts +171 -0
- package/dist/packages/job-runtime/src/host/contract.js +163 -0
- package/dist/packages/job-runtime/src/host/hostPorts.d.ts +7 -0
- package/dist/packages/job-runtime/src/host/hostPorts.js +13 -0
- package/dist/packages/job-runtime/src/host/index.d.ts +10 -0
- package/dist/packages/job-runtime/src/host/index.js +10 -0
- package/dist/packages/job-runtime/src/logistics/JobDefinitionStrategy.d.ts +21 -0
- package/dist/packages/job-runtime/src/logistics/JobDefinitionStrategy.js +27 -0
- package/dist/packages/job-runtime/src/logistics/ResultReturnStrategy.d.ts +21 -0
- package/dist/packages/job-runtime/src/logistics/ResultReturnStrategy.js +27 -0
- package/dist/packages/job-runtime/src/logistics/definition/ApiJobDefinitionStrategy.d.ts +11 -0
- package/dist/{src/NodeManager/node/job/defination/strategy → packages/job-runtime/src/logistics/definition}/ApiJobDefinitionStrategy.js +5 -5
- package/dist/{src/NodeManager/node/job/defination/strategy → packages/job-runtime/src/logistics/definition}/ApiListenJobDefinitionStrategy.d.ts +2 -3
- package/dist/packages/job-runtime/src/logistics/ports.d.ts +10 -0
- package/dist/packages/job-runtime/src/logistics/ports.js +1 -0
- package/dist/{src/NodeManager/node/job/result/startegy → packages/job-runtime/src/logistics/result}/ApiListenResultReturnStrategy.d.ts +1 -2
- package/dist/packages/job-runtime/src/logistics/result/ApiResultReturnStrategy.d.ts +11 -0
- package/dist/{src/NodeManager/node/job/result/startegy → packages/job-runtime/src/logistics/result}/ApiResultReturnStrategy.js +5 -5
- package/dist/packages/job-runtime/src/main.d.ts +1 -0
- package/dist/packages/job-runtime/src/main.js +83 -0
- package/dist/packages/job-runtime/src/provider/ContainerProvider.d.ts +90 -0
- package/dist/packages/job-runtime/src/provider/ContainerProvider.js +503 -0
- package/dist/{src/NodeManager → packages/job-runtime/src}/provider/ContainerStateManager.d.ts +17 -3
- package/dist/{src/NodeManager → packages/job-runtime/src}/provider/ContainerStateManager.js +37 -5
- package/dist/{src/NodeManager → packages/job-runtime/src}/provider/ExposedPortHealthCheck.d.ts +4 -5
- package/dist/{src/NodeManager → packages/job-runtime/src}/provider/SshAccessManager.d.ts +4 -4
- package/dist/packages/job-runtime/src/provider/expose.d.ts +12 -0
- package/dist/{src/NodeManager/utils/expose-util.js → packages/job-runtime/src/provider/expose.js} +8 -39
- package/dist/packages/job-runtime/src/provider/gpu/gpuSampler.d.ts +24 -0
- package/dist/packages/job-runtime/src/provider/gpu/gpuSampler.js +97 -0
- package/dist/packages/job-runtime/src/provider/gpu/gpuStats.d.ts +63 -0
- package/dist/packages/job-runtime/src/provider/gpu/gpuStats.js +144 -0
- package/dist/{src/NodeManager/provider/utils → packages/job-runtime/src/provider}/parseDockerStat.d.ts +1 -1
- package/dist/packages/job-runtime/src/provider/ports.d.ts +61 -0
- package/dist/packages/job-runtime/src/provider/ports.js +1 -0
- package/dist/{src/NodeManager → packages/job-runtime/src}/provider/sshSidecar.d.ts +7 -7
- package/dist/{src/NodeManager → packages/job-runtime/src}/provider/sshSidecar.js +2 -4
- package/dist/packages/job-runtime/src/resources/FileResourceRecords.d.ts +21 -0
- package/dist/packages/job-runtime/src/resources/FileResourceRecords.js +53 -0
- package/dist/packages/job-runtime/src/resources/ImageCache.d.ts +35 -0
- package/dist/packages/job-runtime/src/resources/ImageCache.js +55 -0
- package/dist/packages/job-runtime/src/resources/VolumeCache.d.ts +110 -0
- package/dist/packages/job-runtime/src/resources/VolumeCache.js +359 -0
- package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/createResourceName.d.ts +1 -1
- package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/createResourceName.js +1 -1
- package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/createS3Args.d.ts +1 -1
- package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/createS3Args.js +1 -1
- package/dist/{src/NodeManager/node/utils → packages/job-runtime/src/resources/helpers}/extractLogsAndResultsFromLogBuffer.d.ts +1 -3
- package/dist/{src/NodeManager/node/utils → packages/job-runtime/src/resources/helpers}/extractLogsAndResultsFromLogBuffer.js +2 -2
- package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/isAuthGatedResource.d.ts +1 -1
- package/dist/packages/job-runtime/src/resources/index.d.ts +13 -0
- package/dist/packages/job-runtime/src/resources/index.js +13 -0
- package/dist/packages/job-runtime/src/resources/jobResources.d.ts +12 -0
- package/dist/packages/job-runtime/src/resources/jobResources.js +88 -0
- package/dist/{src/NodeManager/node/utils → packages/job-runtime/src/resources}/multiProgressBarReporter.d.ts +4 -2
- package/dist/packages/job-runtime/src/resources/multiProgressBarReporter.js +12 -0
- package/dist/{src/NodeManager/node/utils → packages/job-runtime/src/resources}/progressBarReporter.d.ts +4 -2
- package/dist/packages/job-runtime/src/resources/progressBarReporter.js +12 -0
- package/dist/packages/job-runtime/src/resources/records.d.ts +67 -0
- package/dist/packages/job-runtime/src/resources/records.js +6 -0
- package/dist/packages/job-runtime/src/runtime/RuntimeLog.d.ts +26 -0
- package/dist/packages/job-runtime/src/runtime/RuntimeLog.js +79 -0
- package/dist/packages/job-runtime/src/runtime/retrieveJobDefinition.d.ts +6 -0
- package/dist/packages/job-runtime/src/runtime/retrieveJobDefinition.js +19 -0
- package/dist/packages/job-runtime/src/runtime/runJob.d.ts +31 -0
- package/dist/packages/job-runtime/src/runtime/runJob.js +534 -0
- package/dist/packages/job-runtime/src/runtime/streams.d.ts +32 -0
- package/dist/packages/job-runtime/src/runtime/streams.js +81 -0
- package/dist/packages/job-runtime/src/server.d.ts +23 -0
- package/dist/packages/job-runtime/src/server.js +66 -0
- package/dist/packages/job-runtime/src/store/FlowStore.d.ts +62 -0
- package/dist/packages/job-runtime/src/store/FlowStore.js +170 -0
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/TaskManager.d.ts +25 -47
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/TaskManager.js +47 -59
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/executions/createExecutionPlan.js +0 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/executions/createOperationMap.d.ts +1 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/finalizeEnv.d.ts +1 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/interpolateOperation.d.ts +1 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setDefaults.d.ts +1 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setDefaults.js +10 -13
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/stanatizeArrays.d.ts +1 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/transformCollections.d.ts +1 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/helpers/createDefaultOpState.d.ts +1 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/helpers/createInitialFlow.d.ts +2 -2
- package/dist/packages/job-runtime/src/taskManager/index.d.ts +11 -0
- package/dist/packages/job-runtime/src/taskManager/index.js +8 -0
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/loggers/StatsBuffer.d.ts +1 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/enforceOperationTimeout.d.ts +4 -1
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/enforceOperationTimeout.js +9 -2
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/runTaskManagerOperation.d.ts +2 -2
- package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/runTaskManagerOperation.js +11 -6
- package/dist/packages/job-runtime/src/taskManager/ports/FlowRepository.d.ts +22 -0
- package/dist/packages/job-runtime/src/taskManager/ports/FlowRepository.js +1 -0
- package/dist/packages/job-runtime/src/taskManager/ports/OrchestrationProvider.d.ts +24 -0
- package/dist/packages/job-runtime/src/taskManager/ports/OrchestrationProvider.js +1 -0
- package/dist/packages/job-runtime/src/taskManager/ports/TaskContext.d.ts +9 -0
- package/dist/packages/job-runtime/src/taskManager/ports/TaskContext.js +1 -0
- package/dist/packages/job-runtime/src/taskManager/ports/index.d.ts +3 -0
- package/dist/packages/job-runtime/src/taskManager/ports/index.js +1 -0
- package/dist/packages/job-runtime/src/taskManager/runtimeConfig.d.ts +23 -0
- package/dist/packages/job-runtime/src/taskManager/runtimeConfig.js +14 -0
- package/dist/packages/job-runtime/src/taskManager/stopReasons.d.ts +10 -0
- package/dist/packages/job-runtime/src/taskManager/stopReasons.js +9 -0
- package/dist/packages/job-runtime/src/taskManager/types.d.ts +53 -0
- package/dist/packages/job-runtime/src/taskManager/types.js +3 -0
- package/dist/packages/job-runtime/src/utils/abort.d.ts +17 -0
- package/dist/packages/job-runtime/src/utils/abort.js +55 -0
- package/dist/packages/job-runtime/src/utils/files.d.ts +7 -0
- package/dist/packages/job-runtime/src/utils/files.js +19 -0
- package/dist/src/NodeManager/clients/hostManager/index.js +3 -3
- package/dist/src/NodeManager/clients/types.utils.d.ts +0 -1
- package/dist/src/NodeManager/configs/configs.d.ts +1 -2
- package/dist/src/NodeManager/configs/configs.js +0 -1
- package/dist/src/NodeManager/db/index.d.ts +11 -44
- package/dist/src/NodeManager/db/index.js +5 -3
- package/dist/src/NodeManager/errors/NodeNotQualifiedError.js +2 -2
- package/dist/src/NodeManager/index.js +31 -14
- package/dist/src/NodeManager/input/OperatorInput.d.ts +0 -2
- package/dist/src/NodeManager/jobs/index.d.ts +1 -6
- package/dist/src/NodeManager/jobs/index.js +2 -45
- package/dist/src/NodeManager/monitoring/log/NodeLog.d.ts +6 -8
- package/dist/src/NodeManager/monitoring/log/NodeLog.js +38 -461
- package/dist/src/NodeManager/monitoring/log/console/ConsoleLogger.d.ts +0 -1
- package/dist/src/NodeManager/monitoring/log/console/ConsoleLogger.js +5 -5
- package/dist/src/NodeManager/monitoring/reportError.js +2 -3
- package/dist/src/NodeManager/monitoring/state/NodeState.d.ts +1 -1
- package/dist/src/NodeManager/monitoring/state/NodeState.js +1 -29
- package/dist/src/NodeManager/node/Node.d.ts +28 -8
- package/dist/src/NodeManager/node/Node.js +90 -47
- package/dist/src/NodeManager/node/api/ApiEventEmitter.d.ts +0 -1
- package/dist/src/NodeManager/node/api/ApiHandler.d.ts +21 -7
- package/dist/src/NodeManager/node/api/ApiHandler.js +67 -46
- package/dist/src/NodeManager/node/api/jobRuntimeProxy.d.ts +29 -0
- package/dist/src/NodeManager/node/api/jobRuntimeProxy.js +105 -0
- package/dist/src/NodeManager/node/api/middlewares/index.d.ts +0 -1
- package/dist/src/NodeManager/node/api/middlewares/index.js +0 -2
- package/dist/src/NodeManager/node/api/middlewares/ws/verifyWSJobOwnerSignatureMiddleware.js +6 -8
- package/dist/src/NodeManager/node/api/routes/get/index.d.ts +0 -7
- package/dist/src/NodeManager/node/api/routes/get/index.js +0 -7
- package/dist/src/NodeManager/node/api/routes/index.d.ts +0 -1
- package/dist/src/NodeManager/node/api/routes/index.js +0 -1
- package/dist/src/NodeManager/node/api/routes/wss/index.d.ts +0 -2
- package/dist/src/NodeManager/node/api/routes/wss/index.js +0 -2
- package/dist/src/NodeManager/node/api/routes/wss/log.d.ts +0 -9
- package/dist/src/NodeManager/node/api/routes/wss/log.js +2 -55
- package/dist/src/NodeManager/node/api/routes/wss/status.js +2 -4
- package/dist/src/NodeManager/node/api/types/index.d.ts +2 -2
- package/dist/src/NodeManager/node/balance/balanceHandler.d.ts +4 -5
- package/dist/src/NodeManager/node/balance/balanceHandler.js +6 -5
- package/dist/src/NodeManager/node/expiry/expiryHandler.d.ts +2 -10
- package/dist/src/NodeManager/node/expiry/expiryHandler.js +8 -36
- package/dist/src/NodeManager/node/health/healthHandler.d.ts +3 -4
- package/dist/src/NodeManager/node/health/healthHandler.js +5 -8
- package/dist/src/NodeManager/node/job/JobRegistry.d.ts +16 -6
- package/dist/src/NodeManager/node/job/JobRegistry.js +68 -22
- package/dist/src/NodeManager/node/job/JobRuntimeHost.d.ts +26 -0
- package/dist/src/NodeManager/node/job/JobRuntimeHost.js +87 -0
- package/dist/src/NodeManager/node/job/JobRuntimeSession.d.ts +114 -0
- package/dist/src/NodeManager/node/job/JobRuntimeSession.js +259 -0
- package/dist/src/NodeManager/node/job/jobHandler.d.ts +80 -14
- package/dist/src/NodeManager/node/job/jobHandler.js +226 -129
- package/dist/src/NodeManager/node/key/keyHandler.d.ts +15 -9
- package/dist/src/NodeManager/node/key/keyHandler.js +18 -9
- package/dist/src/NodeManager/node/market/benchmark.d.ts +11 -4
- package/dist/src/NodeManager/node/market/benchmark.js +55 -40
- package/dist/src/NodeManager/node/market/hostManager.d.ts +14 -16
- package/dist/src/NodeManager/node/market/hostManager.js +0 -12
- package/dist/src/NodeManager/node/market/marketAccess.d.ts +9 -3
- package/dist/src/NodeManager/node/market/marketAccess.js +27 -9
- package/dist/src/NodeManager/node/market/marketHandler.d.ts +11 -7
- package/dist/src/NodeManager/node/market/marketHandler.js +33 -18
- package/dist/src/NodeManager/node/register/index.js +1 -1
- package/dist/src/NodeManager/node/resource/image/imageManager.d.ts +12 -16
- package/dist/src/NodeManager/node/resource/image/imageManager.js +21 -35
- package/dist/src/NodeManager/node/resource/resourceManager.d.ts +26 -10
- package/dist/src/NodeManager/node/resource/resourceManager.js +48 -40
- package/dist/src/NodeManager/node/resource/volume/volumeManager.d.ts +11 -75
- package/dist/src/NodeManager/node/resource/volume/volumeManager.js +25 -347
- package/dist/src/NodeManager/node/run/runHandler.d.ts +17 -4
- package/dist/src/NodeManager/node/run/runHandler.js +69 -46
- package/dist/src/NodeManager/node/stake/StakeHandler.d.ts +18 -5
- package/dist/src/NodeManager/node/stake/StakeHandler.js +56 -24
- package/dist/src/NodeManager/node/utils/poll.d.ts +1 -1
- package/dist/src/NodeManager/node/utils/subscription.d.ts +8 -0
- package/dist/src/NodeManager/node/utils/subscription.js +37 -0
- package/dist/src/NodeManager/provider/Provider.d.ts +78 -92
- package/dist/src/NodeManager/provider/Provider.js +229 -532
- package/dist/src/NodeManager/provider/orchestrationHooks.js +2 -2
- package/dist/src/NodeManager/repository/NodeRepository.d.ts +5 -41
- package/dist/src/NodeManager/repository/NodeRepository.js +8 -155
- package/dist/src/NodeManager/sdk/index.d.ts +6 -9
- package/dist/src/NodeManager/sdk/index.js +78 -94
- package/dist/src/NodeManager/types/index.d.ts +0 -9
- package/dist/src/NodeManager/utils/jobDefinitionParser.d.ts +0 -4
- package/dist/src/NodeManager/utils/jobDefinitionParser.js +1 -7
- package/dist/src/NodeManager/utils/tolerateBrokenStdio.d.ts +0 -1
- package/dist/src/NodeManager/utils/utils.d.ts +1 -2
- package/dist/src/NodeManager/utils/utils.js +1 -4
- package/dist/src/cli/commands/address/action.js +3 -2
- package/dist/src/cli/commands/run/action.d.ts +5 -0
- package/dist/src/cli/commands/run/action.js +65 -18
- package/dist/src/cli/commands/run/generateDeploymentEndpointsTable.d.ts +2 -2
- package/dist/src/cli/commands/run/generateDeploymentEndpointsTable.js +6 -5
- package/dist/src/cli/commands/run/jobRuntimeConsole.d.ts +10 -0
- package/dist/src/cli/commands/run/jobRuntimeConsole.js +26 -0
- package/dist/src/cli/commands/sharedOptions/--tee-runtime.js +1 -1
- package/dist/src/cli/commands/start/action.d.ts +0 -1
- package/dist/src/cli/commands/start/action.js +0 -1
- package/dist/src/cli/createNosanaCli.js +2 -4
- package/dist/src/exitCodes.d.ts +35 -2
- package/dist/src/exitCodes.js +52 -2
- package/dist/src/index.d.ts +0 -1
- package/dist/src/ipfs/IpfsClient.d.ts +3 -1
- package/dist/src/ipfs/IpfsClient.js +1 -1
- package/dist/src/output-formatter/outputEvents.d.ts +1 -1
- package/dist/src/static/index.d.ts +1 -1
- package/dist/src/version/index.d.ts +16 -0
- package/dist/src/version/index.js +56 -45
- package/dist/src/version/updateWatcher.d.ts +35 -0
- package/dist/src/version/updateWatcher.js +81 -0
- package/npm-shrinkwrap.json +3182 -1375
- package/package.json +11 -10
- package/dist/src/NodeManager/node/api/eventsource/index.d.ts +0 -6
- package/dist/src/NodeManager/node/api/middlewares/rest/verifyJobOwnerSignatureMiddleware.d.ts +0 -5
- package/dist/src/NodeManager/node/api/middlewares/rest/verifyJobOwnerSignatureMiddleware.js +0 -29
- package/dist/src/NodeManager/node/api/routes/get/job-definition.d.ts +0 -5
- package/dist/src/NodeManager/node/api/routes/get/job-definition.js +0 -16
- package/dist/src/NodeManager/node/api/routes/get/job-info/buildInfoObject.d.ts +0 -17
- package/dist/src/NodeManager/node/api/routes/get/job-info/buildInfoObject.js +0 -15
- package/dist/src/NodeManager/node/api/routes/get/job-info/job-info.d.ts +0 -5
- package/dist/src/NodeManager/node/api/routes/get/job-info/job-info.js +0 -18
- package/dist/src/NodeManager/node/api/routes/get/job-info/pollActiveJob.d.ts +0 -6
- package/dist/src/NodeManager/node/api/routes/get/job-info/pollActiveJob.js +0 -42
- package/dist/src/NodeManager/node/api/routes/get/job-operation-info.d.ts +0 -28
- package/dist/src/NodeManager/node/api/routes/get/job-operation-info.js +0 -53
- package/dist/src/NodeManager/node/api/routes/get/job-results.d.ts +0 -5
- package/dist/src/NodeManager/node/api/routes/get/job-results.js +0 -15
- package/dist/src/NodeManager/node/api/routes/get/job-stats-stream.d.ts +0 -5
- package/dist/src/NodeManager/node/api/routes/get/job-stats.d.ts +0 -5
- package/dist/src/NodeManager/node/api/routes/get/job-stats.js +0 -22
- package/dist/src/NodeManager/node/api/routes/get/service-url.d.ts +0 -5
- package/dist/src/NodeManager/node/api/routes/get/service-url.js +0 -27
- package/dist/src/NodeManager/node/api/routes/post/index.d.ts +0 -4
- package/dist/src/NodeManager/node/api/routes/post/index.js +0 -4
- package/dist/src/NodeManager/node/api/routes/post/job-definition.d.ts +0 -6
- package/dist/src/NodeManager/node/api/routes/post/job-definition.js +0 -15
- package/dist/src/NodeManager/node/api/routes/post/job-operation-actions.d.ts +0 -20
- package/dist/src/NodeManager/node/api/routes/post/job-operation-actions.js +0 -63
- package/dist/src/NodeManager/node/api/routes/post/service-stop.d.ts +0 -5
- package/dist/src/NodeManager/node/api/routes/post/service-stop.js +0 -13
- package/dist/src/NodeManager/node/api/routes/post/ssh-authorize.d.ts +0 -17
- package/dist/src/NodeManager/node/api/routes/post/ssh-authorize.js +0 -53
- package/dist/src/NodeManager/node/grid/gridHandler.d.ts +0 -13
- package/dist/src/NodeManager/node/grid/gridHandler.js +0 -35
- package/dist/src/NodeManager/node/job/defination/JobDefinitionStrategy.d.ts +0 -13
- package/dist/src/NodeManager/node/job/defination/JobDefinitionStrategy.js +0 -21
- package/dist/src/NodeManager/node/job/defination/strategy/ApiJobDefinitionStrategy.d.ts +0 -8
- package/dist/src/NodeManager/node/job/defination/strategy/IpfsJobDefinitionStrategy.d.ts +0 -5
- package/dist/src/NodeManager/node/job/defination/strategy/IpfsJobDefinitionStrategy.js +0 -11
- package/dist/src/NodeManager/node/job/jobExternalUtil.d.ts +0 -10
- package/dist/src/NodeManager/node/job/jobExternalUtil.js +0 -96
- package/dist/src/NodeManager/node/job/result/ResultReturnStrategy.d.ts +0 -13
- package/dist/src/NodeManager/node/job/result/ResultReturnStrategy.js +0 -21
- package/dist/src/NodeManager/node/job/result/startegy/ApiResultReturnStrategy.d.ts +0 -8
- package/dist/src/NodeManager/node/utils/multiProgressBarReporter.js +0 -22
- package/dist/src/NodeManager/node/utils/progressBarReporter.js +0 -28
- package/dist/src/NodeManager/provider/types.d.ts +0 -9
- package/dist/src/NodeManager/provider/webTerminal.d.ts +0 -24
- package/dist/src/NodeManager/utils/expose-util.d.ts +0 -14
- package/dist/src/NodeManager/utils/ops-util.d.ts +0 -3
- package/dist/src/NodeManager/utils/ops-util.js +0 -19
- package/dist/src/cli/commands/sharedOptions/--api.d.ts +0 -2
- package/dist/src/cli/commands/sharedOptions/--api.js +0 -2
- package/dist/src/cli/commands/sharedOptions/--timeout.d.ts +0 -2
- package/dist/src/cli/commands/sharedOptions/--timeout.js +0 -12
- /package/dist/{src/NodeManager/node/utils → packages/common/src}/extractResultsFromLogs.js +0 -0
- /package/dist/{src/NodeManager/utils → packages/common/src}/formatTime.d.ts +0 -0
- /package/dist/{src/NodeManager/utils → packages/common/src}/formatTime.js +0 -0
- /package/dist/{src/NodeManager/provider → packages/container-orchestrator/src}/utils/parseBuffer.js +0 -0
- /package/dist/{src/NodeManager/node/api/eventsource/index.js → packages/job-runtime/src/api/eventsource.js} +0 -0
- /package/dist/{src/NodeManager/provider → packages/job-runtime/src/api}/types.js +0 -0
- /package/dist/{src/NodeManager/node/job/defination/strategy → packages/job-runtime/src/logistics/definition}/ApiListenJobDefinitionStrategy.js +0 -0
- /package/dist/{src/NodeManager/node/job/result/startegy → packages/job-runtime/src/logistics/result}/ApiListenResultReturnStrategy.js +0 -0
- /package/dist/{src/NodeManager → packages/job-runtime/src}/provider/ExposedPortHealthCheck.js +0 -0
- /package/dist/{src/NodeManager → packages/job-runtime/src}/provider/SshAccessManager.js +0 -0
- /package/dist/{src/NodeManager/provider/utils → packages/job-runtime/src/provider}/parseDockerStat.js +0 -0
- /package/dist/{src/NodeManager/utils → packages/job-runtime/src/provider}/timeoutPromiseWrapper.d.ts +0 -0
- /package/dist/{src/NodeManager/utils → packages/job-runtime/src/provider}/timeoutPromiseWrapper.js +0 -0
- /package/dist/{src/NodeManager/node/utils → packages/job-runtime/src/resources/helpers}/convertFromBytes.d.ts +0 -0
- /package/dist/{src/NodeManager/node/utils → packages/job-runtime/src/resources/helpers}/convertFromBytes.js +0 -0
- /package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/createHFArgs.d.ts +0 -0
- /package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/createHFArgs.js +0 -0
- /package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/createOllamaArgs.d.ts +0 -0
- /package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/createOllamaArgs.js +0 -0
- /package/dist/{src/NodeManager/node/resource → packages/job-runtime/src/resources}/helpers/isAuthGatedResource.js +0 -0
- /package/dist/{src/NodeManager/node/resource/definition/index.d.ts → packages/job-runtime/src/resources/helpers/nosanaBucket.d.ts} +0 -0
- /package/dist/{src/NodeManager/node/resource/definition/index.js → packages/job-runtime/src/resources/helpers/nosanaBucket.js} +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/TaskManagerRegistry.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/TaskManagerRegistry.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/executions/createDependencyMap.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/executions/createDependencyMap.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/executions/createExecutionPlan.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/executions/createOperationMap.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/executions/validateExecutionPlan.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/executions/validateExecutionPlan.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/finalizeEnv.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/getByPath.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/getByPath.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/index.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/index.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/interpolate.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/interpolate.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/interpolateOperation.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/resolveLiteralsInString.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/resolveLiteralsInString.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setContainerIp.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setContainerIp.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setHost.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setHost.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setResult.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setResult.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setResults.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/setResults.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/stanatizeArrays.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/globalStore/transformCollections.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/helpers/createDefaultOpState.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/helpers/createInitialFlow.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/loggers/StatsBuffer.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/loggers/logManager.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/loggers/logManager.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/loggers/statsManager.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/loggers/statsManager.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/getOperationsInfos.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/getOperationsInfos.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/restartTaskManagerGroupOperation.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/restartTaskManagerGroupOperation.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/restartTaskManagerOperation.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/restartTaskManagerOperation.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/stopAllTaskManagerOperations.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/stopAllTaskManagerOperations.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/stopTaskManagerGroupOperation.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/stopTaskManagerGroupOperation.js +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/stopTaskManagerOperation.d.ts +0 -0
- /package/dist/{src/NodeManager/node/task → packages/job-runtime/src/taskManager}/operations/stopTaskManagerOperation.js +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a job does with the image cache: whether a cached copy may be reused,
|
|
3
|
+
* and the record of what it pulled. The node's ImageManager holds one, and
|
|
4
|
+
* adds the market's images and the cache's upkeep around it.
|
|
5
|
+
*/
|
|
6
|
+
export class ImageCache {
|
|
7
|
+
constructor(containerOrchestration, repository, market_required_images = []) {
|
|
8
|
+
this.containerOrchestration = containerOrchestration;
|
|
9
|
+
this.repository = repository;
|
|
10
|
+
this.market_required_images = market_required_images;
|
|
11
|
+
}
|
|
12
|
+
/** The images the market requires, which every project may reuse. */
|
|
13
|
+
get marketImages() {
|
|
14
|
+
return this.market_required_images;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Takes the images the market requires. The node learns them only once it
|
|
18
|
+
* has fetched the market's resources, after the cache was built; a job's
|
|
19
|
+
* cache is built with them instead.
|
|
20
|
+
*/
|
|
21
|
+
setMarketImages(images) {
|
|
22
|
+
this.market_required_images = [...images];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Whether a job for `project` must re-authenticate before it may use this
|
|
26
|
+
* image, rather than reuse the cached copy. True only for a private image the
|
|
27
|
+
* node last pulled for a *different* project: the daemon holds one copy per
|
|
28
|
+
* image reference, so the caller forces a pull, which re-verifies this
|
|
29
|
+
* project's credentials against the registry (reusing cached layers) and
|
|
30
|
+
* denies a job that cannot authenticate.
|
|
31
|
+
*
|
|
32
|
+
* The project that already owns the cached image, a public image, and a
|
|
33
|
+
* market-required image (shared across the market by design) all reuse the
|
|
34
|
+
* cache with no registry round-trip.
|
|
35
|
+
*/
|
|
36
|
+
requiresReauth(image, project) {
|
|
37
|
+
if (this.market_required_images.includes(image))
|
|
38
|
+
return false;
|
|
39
|
+
const entry = this.repository.getImageResource(image);
|
|
40
|
+
return !!entry?.isPrivate && entry.project !== project;
|
|
41
|
+
}
|
|
42
|
+
async setImage(image, isPrivate = false, project) {
|
|
43
|
+
const imageObj = this.repository.getImageResource(image);
|
|
44
|
+
this.repository.updateImageResource(image, {
|
|
45
|
+
lastUsed: new Date(),
|
|
46
|
+
usage: (imageObj?.usage ?? 0) + 1,
|
|
47
|
+
// Never downgrade a known-private image to public — a later reuse by its
|
|
48
|
+
// owner arrives without credentials — and keep the owning project when
|
|
49
|
+
// this pull did not re-establish one. A different project claims the image
|
|
50
|
+
// only by passing its own project after a successful credentialed pull.
|
|
51
|
+
isPrivate: isPrivate || !!imageObj?.isPrivate,
|
|
52
|
+
project: project ?? imageObj?.project,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { ContainerCreateOptions, ContainerInspectInfo } from 'dockerode';
|
|
2
|
+
import type { RequiredResource, Resource } from '@nosana/kit';
|
|
3
|
+
import { type ContainerOrchestrationInterface } from '../../../container-orchestrator/src/index.js';
|
|
4
|
+
import { ProgressBarReporter } from './progressBarReporter.js';
|
|
5
|
+
import type { ResourceRecords } from './records.js';
|
|
6
|
+
/**
|
|
7
|
+
* Renders the runtime state that says why the download stopped, for inclusion in
|
|
8
|
+
* the error message. A process that is killed rather than failing logs nothing,
|
|
9
|
+
* so this is the only evidence of an OOM; a container the runtime could not
|
|
10
|
+
* create or start logs nothing either, and `State.Error` is Docker's only
|
|
11
|
+
* account of that. The run duration separates a download that died on contact
|
|
12
|
+
* from one the network dropped an hour in.
|
|
13
|
+
*
|
|
14
|
+
* Optional because the caller inspects on a best-effort basis; the fields
|
|
15
|
+
* themselves are always present when it succeeds.
|
|
16
|
+
*/
|
|
17
|
+
export declare function describeContainerState(state?: ContainerInspectInfo['State']): string;
|
|
18
|
+
/**
|
|
19
|
+
* The reasons the resource manager gave for failing, if it gave any.
|
|
20
|
+
*
|
|
21
|
+
* It reports failures as a JSON line on stderr — `{"event":"error","message":
|
|
22
|
+
* "..."}` — from every service it implements, then exits non-zero. Parallel
|
|
23
|
+
* download workers can each report their own failure before the run dies, so
|
|
24
|
+
* every such line is collected, in the order logged; the last is the one the
|
|
25
|
+
* run gave up on.
|
|
26
|
+
*/
|
|
27
|
+
export declare function findReportedErrors(logs: {
|
|
28
|
+
log?: string;
|
|
29
|
+
}[]): string[];
|
|
30
|
+
/**
|
|
31
|
+
* The fallback reason for a container that died without reporting through the
|
|
32
|
+
* envelope — a crash before the handlers install, or output lost to the kill.
|
|
33
|
+
* The raw stderr tail is the only account left of what happened, so the last
|
|
34
|
+
* few lines ride along rather than being discarded.
|
|
35
|
+
*/
|
|
36
|
+
export declare function describeUnreportedExit(logs: {
|
|
37
|
+
log?: string;
|
|
38
|
+
}[], statusCode: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* A download that failed. `reported` holds every reason the resource manager
|
|
41
|
+
* gave, oldest first (parallel download workers can each report their own);
|
|
42
|
+
* the message quotes only the last. The job's runtime records each as an op
|
|
43
|
+
* error.
|
|
44
|
+
*/
|
|
45
|
+
export declare class ResourceDownloadError extends Error {
|
|
46
|
+
readonly reported: string[];
|
|
47
|
+
constructor(message: string, reported: string[]);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* What a job does with the resource cache: the volume a resource is kept in,
|
|
51
|
+
* downloaded (or synced) by the resource manager image, and the record of it.
|
|
52
|
+
* The node's VolumeManager holds one, and adds the market's volumes and the
|
|
53
|
+
* cache's upkeep around it.
|
|
54
|
+
*/
|
|
55
|
+
export declare class VolumeCache {
|
|
56
|
+
protected containerOrchestration: ContainerOrchestrationInterface;
|
|
57
|
+
protected repository: ResourceRecords;
|
|
58
|
+
/** The image that downloads resources into volumes. */
|
|
59
|
+
readonly resourceManagerImage: string;
|
|
60
|
+
/** Keys of the volumes the market requires: shared, and never expired. */
|
|
61
|
+
protected marketVolumes: Set<string>;
|
|
62
|
+
protected progressBarReporter: ProgressBarReporter;
|
|
63
|
+
constructor(containerOrchestration: ContainerOrchestrationInterface, repository: ResourceRecords,
|
|
64
|
+
/** The image that downloads resources into volumes. */
|
|
65
|
+
resourceManagerImage: string, options?: {
|
|
66
|
+
marketVolumes?: Iterable<string>;
|
|
67
|
+
/** Its calls are the download progress in the logs. */
|
|
68
|
+
progressBarReporter?: ProgressBarReporter;
|
|
69
|
+
});
|
|
70
|
+
/** Keys of the volumes the market requires, which every project may reuse. */
|
|
71
|
+
get marketVolumeKeys(): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Takes the keys of the volumes the market requires. The node learns them
|
|
74
|
+
* only once it has fetched the market's resources, after the cache was
|
|
75
|
+
* built; a job's cache is built with them instead.
|
|
76
|
+
*/
|
|
77
|
+
setMarketVolumes(keys: Iterable<string>): void;
|
|
78
|
+
/**
|
|
79
|
+
* The DB key a job's resource must use, locking a resource to one project
|
|
80
|
+
* when it must not be shared across projects.
|
|
81
|
+
*
|
|
82
|
+
* Two things force a lock. A writable (`allowWrite`) mount can leave the job's
|
|
83
|
+
* own bytes in the cached volume, so a later job reusing it could be handed
|
|
84
|
+
* code an earlier project planted. An auth-gated resource is private to the
|
|
85
|
+
* credentials that fetched it, so a later job reusing the cache would read
|
|
86
|
+
* private data without presenting its own credentials. Either way the first
|
|
87
|
+
* such use claims the resource for its project — the volume is tagged and
|
|
88
|
+
* moved to a project-scoped key, which frees the shared key for the clean copy
|
|
89
|
+
* the next project downloads with its own credentials.
|
|
90
|
+
*
|
|
91
|
+
* Claiming renames the DB entry only; the Docker volume and its contents stay
|
|
92
|
+
* in place, so the claiming project inherits the already-downloaded data with
|
|
93
|
+
* no re-download. The next use of the shared key pays for a fresh pull.
|
|
94
|
+
*
|
|
95
|
+
* Once a project holds a claim, every later job of that project reuses it —
|
|
96
|
+
* read-only ones included, even public ones that would not have locked on
|
|
97
|
+
* their own. The claimed copy holds only what this project's own jobs put
|
|
98
|
+
* there, so reusing it leaks nothing across projects and spares the project a
|
|
99
|
+
* second download of a resource it already has.
|
|
100
|
+
*
|
|
101
|
+
* A resource with no claim for this project and nothing forcing one (a public,
|
|
102
|
+
* read-only mount) and market preloads stay on the shared key, reused freely.
|
|
103
|
+
*/
|
|
104
|
+
resolveResourceKey(resource: Resource, project?: string, lockToProject?: boolean): string;
|
|
105
|
+
createRemoteVolume(resource: RequiredResource, controller: AbortController, resourceKey?: string, project?: string): Promise<string>;
|
|
106
|
+
protected runResourceManagerContainer(volume: string, name: string, args: ContainerCreateOptions, controller: AbortController, syncing?: boolean): Promise<void>;
|
|
107
|
+
setVolume(bucket: string, volume: string, project?: string): Promise<void>;
|
|
108
|
+
hasVolume(resource: Resource, resourceKey?: string): Promise<boolean>;
|
|
109
|
+
getVolume(resource: RequiredResource | Resource, resourceKey?: string): Promise<string | undefined>;
|
|
110
|
+
}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { Presets } from 'cli-progress';
|
|
2
|
+
import { formatTime } from '../../../common/src/index.js';
|
|
3
|
+
import { liveAbortSignal, } from '../../../container-orchestrator/src/index.js';
|
|
4
|
+
import { convertFromBytes } from './helpers/convertFromBytes.js';
|
|
5
|
+
import { createHFArgs } from './helpers/createHFArgs.js';
|
|
6
|
+
import { createOllamaArgs } from './helpers/createOllamaArgs.js';
|
|
7
|
+
import { createResourceName } from './helpers/createResourceName.js';
|
|
8
|
+
import { createS3Args } from './helpers/createS3Args.js';
|
|
9
|
+
import { extractLogsAndResultsFromLogBuffer } from './helpers/extractLogsAndResultsFromLogBuffer.js';
|
|
10
|
+
import { ProgressBarReporter } from './progressBarReporter.js';
|
|
11
|
+
/**
|
|
12
|
+
* Renders the runtime state that says why the download stopped, for inclusion in
|
|
13
|
+
* the error message. A process that is killed rather than failing logs nothing,
|
|
14
|
+
* so this is the only evidence of an OOM; a container the runtime could not
|
|
15
|
+
* create or start logs nothing either, and `State.Error` is Docker's only
|
|
16
|
+
* account of that. The run duration separates a download that died on contact
|
|
17
|
+
* from one the network dropped an hour in.
|
|
18
|
+
*
|
|
19
|
+
* Optional because the caller inspects on a best-effort basis; the fields
|
|
20
|
+
* themselves are always present when it succeeds.
|
|
21
|
+
*/
|
|
22
|
+
export function describeContainerState(state) {
|
|
23
|
+
if (!state)
|
|
24
|
+
return '';
|
|
25
|
+
const parts = [
|
|
26
|
+
`exitCode: ${state.ExitCode}`,
|
|
27
|
+
`OOMKilled: ${state.OOMKilled}`
|
|
28
|
+
];
|
|
29
|
+
if (state.Error) {
|
|
30
|
+
parts.push(`error: ${state.Error}`);
|
|
31
|
+
}
|
|
32
|
+
const started = Date.parse(state.StartedAt);
|
|
33
|
+
const finished = Date.parse(state.FinishedAt);
|
|
34
|
+
// Docker reports a container that never started or never finished with the
|
|
35
|
+
// zero timestamp "0001-01-01T00:00:00Z"; a duration across one is noise.
|
|
36
|
+
if (started > 0 && finished >= started) {
|
|
37
|
+
parts.push(`ran for ${formatTime((finished - started) / 1000)}`);
|
|
38
|
+
}
|
|
39
|
+
return ` [${parts.join(', ')}]`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The reasons the resource manager gave for failing, if it gave any.
|
|
43
|
+
*
|
|
44
|
+
* It reports failures as a JSON line on stderr — `{"event":"error","message":
|
|
45
|
+
* "..."}` — from every service it implements, then exits non-zero. Parallel
|
|
46
|
+
* download workers can each report their own failure before the run dies, so
|
|
47
|
+
* every such line is collected, in the order logged; the last is the one the
|
|
48
|
+
* run gave up on.
|
|
49
|
+
*/
|
|
50
|
+
export function findReportedErrors(logs) {
|
|
51
|
+
const messages = [];
|
|
52
|
+
for (const log of logs) {
|
|
53
|
+
if (log.log?.includes('{"event":"error"')) {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = JSON.parse(log.log.slice(log.log.indexOf('{')));
|
|
56
|
+
if (typeof parsed.message === 'string')
|
|
57
|
+
messages.push(parsed.message);
|
|
58
|
+
}
|
|
59
|
+
catch { }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return messages;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The fallback reason for a container that died without reporting through the
|
|
66
|
+
* envelope — a crash before the handlers install, or output lost to the kill.
|
|
67
|
+
* The raw stderr tail is the only account left of what happened, so the last
|
|
68
|
+
* few lines ride along rather than being discarded.
|
|
69
|
+
*/
|
|
70
|
+
export function describeUnreportedExit(logs, statusCode) {
|
|
71
|
+
const tail = logs
|
|
72
|
+
.map((entry) => entry.log?.trim())
|
|
73
|
+
.filter((line) => !!line)
|
|
74
|
+
.slice(-3)
|
|
75
|
+
.join(' | ')
|
|
76
|
+
.slice(-400);
|
|
77
|
+
return `no reason reported (exit code ${statusCode})${tail ? `; stderr tail: ${tail}` : ''}`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A download that failed. `reported` holds every reason the resource manager
|
|
81
|
+
* gave, oldest first (parallel download workers can each report their own);
|
|
82
|
+
* the message quotes only the last. The job's runtime records each as an op
|
|
83
|
+
* error.
|
|
84
|
+
*/
|
|
85
|
+
export class ResourceDownloadError extends Error {
|
|
86
|
+
constructor(message, reported) {
|
|
87
|
+
super(message);
|
|
88
|
+
this.reported = reported;
|
|
89
|
+
this.name = 'ResourceDownloadError';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A resource rendered for an error message. Resources carry credentials (`IAM`,
|
|
94
|
+
* HF `accessToken`), and errors reach the logs and the support channel, so
|
|
95
|
+
* those fields are replaced rather than reported.
|
|
96
|
+
*/
|
|
97
|
+
function describeResource(resource) {
|
|
98
|
+
return JSON.stringify(resource, (key, value) => key === 'IAM' || key === 'accessToken' ? '[hidden]' : value);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* What a job does with the resource cache: the volume a resource is kept in,
|
|
102
|
+
* downloaded (or synced) by the resource manager image, and the record of it.
|
|
103
|
+
* The node's VolumeManager holds one, and adds the market's volumes and the
|
|
104
|
+
* cache's upkeep around it.
|
|
105
|
+
*/
|
|
106
|
+
export class VolumeCache {
|
|
107
|
+
constructor(containerOrchestration, repository,
|
|
108
|
+
/** The image that downloads resources into volumes. */
|
|
109
|
+
resourceManagerImage, options = {}) {
|
|
110
|
+
this.containerOrchestration = containerOrchestration;
|
|
111
|
+
this.repository = repository;
|
|
112
|
+
this.resourceManagerImage = resourceManagerImage;
|
|
113
|
+
this.marketVolumes = new Set(options.marketVolumes);
|
|
114
|
+
this.progressBarReporter = options.progressBarReporter ?? new ProgressBarReporter();
|
|
115
|
+
}
|
|
116
|
+
/** Keys of the volumes the market requires, which every project may reuse. */
|
|
117
|
+
get marketVolumeKeys() {
|
|
118
|
+
return [...this.marketVolumes];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Takes the keys of the volumes the market requires. The node learns them
|
|
122
|
+
* only once it has fetched the market's resources, after the cache was
|
|
123
|
+
* built; a job's cache is built with them instead.
|
|
124
|
+
*/
|
|
125
|
+
setMarketVolumes(keys) {
|
|
126
|
+
this.marketVolumes = new Set(keys);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The DB key a job's resource must use, locking a resource to one project
|
|
130
|
+
* when it must not be shared across projects.
|
|
131
|
+
*
|
|
132
|
+
* Two things force a lock. A writable (`allowWrite`) mount can leave the job's
|
|
133
|
+
* own bytes in the cached volume, so a later job reusing it could be handed
|
|
134
|
+
* code an earlier project planted. An auth-gated resource is private to the
|
|
135
|
+
* credentials that fetched it, so a later job reusing the cache would read
|
|
136
|
+
* private data without presenting its own credentials. Either way the first
|
|
137
|
+
* such use claims the resource for its project — the volume is tagged and
|
|
138
|
+
* moved to a project-scoped key, which frees the shared key for the clean copy
|
|
139
|
+
* the next project downloads with its own credentials.
|
|
140
|
+
*
|
|
141
|
+
* Claiming renames the DB entry only; the Docker volume and its contents stay
|
|
142
|
+
* in place, so the claiming project inherits the already-downloaded data with
|
|
143
|
+
* no re-download. The next use of the shared key pays for a fresh pull.
|
|
144
|
+
*
|
|
145
|
+
* Once a project holds a claim, every later job of that project reuses it —
|
|
146
|
+
* read-only ones included, even public ones that would not have locked on
|
|
147
|
+
* their own. The claimed copy holds only what this project's own jobs put
|
|
148
|
+
* there, so reusing it leaks nothing across projects and spares the project a
|
|
149
|
+
* second download of a resource it already has.
|
|
150
|
+
*
|
|
151
|
+
* A resource with no claim for this project and nothing forcing one (a public,
|
|
152
|
+
* read-only mount) and market preloads stay on the shared key, reused freely.
|
|
153
|
+
*/
|
|
154
|
+
resolveResourceKey(resource, project, lockToProject = false) {
|
|
155
|
+
const sharedKey = createResourceName(resource);
|
|
156
|
+
if (!project) {
|
|
157
|
+
return sharedKey;
|
|
158
|
+
}
|
|
159
|
+
const claimedKey = `${sharedKey}::${project}`;
|
|
160
|
+
// Already claimed by this project on an earlier job — reuse it, writes and
|
|
161
|
+
// all, whatever this job's own lock state. This is what lets a later
|
|
162
|
+
// read-only job read back a copy an earlier writable job of the same
|
|
163
|
+
// project produced, rather than re-downloading it.
|
|
164
|
+
if (this.repository.getVolumeResource(claimedKey)) {
|
|
165
|
+
return claimedKey;
|
|
166
|
+
}
|
|
167
|
+
// No claim yet, and nothing forces one: an unlocked (public, read-only)
|
|
168
|
+
// resource stays on the shared key, reused freely across projects.
|
|
169
|
+
if (!lockToProject) {
|
|
170
|
+
return sharedKey;
|
|
171
|
+
}
|
|
172
|
+
// First locked use of this resource by this project. An unclaimed shared
|
|
173
|
+
// volume already holds it: claim it in place rather than re-downloading.
|
|
174
|
+
// Moving it to the project key frees the shared key for the next project's
|
|
175
|
+
// clean copy.
|
|
176
|
+
const shared = this.repository.getVolumeResource(sharedKey);
|
|
177
|
+
if (shared && !shared.project) {
|
|
178
|
+
this.repository.updateVolumeResource(claimedKey, { ...shared, project });
|
|
179
|
+
this.repository.deleteVolumeResource(sharedKey);
|
|
180
|
+
}
|
|
181
|
+
return claimedKey;
|
|
182
|
+
}
|
|
183
|
+
async createRemoteVolume(resource, controller, resourceKey, project) {
|
|
184
|
+
const resourceName = resourceKey ?? createResourceName(resource);
|
|
185
|
+
// Checked before anything is allocated. Left to the download, an empty repo
|
|
186
|
+
// becomes a request for `/api/models//tree/main` and comes back as a bare
|
|
187
|
+
// 404 with nothing in it naming the resource at fault.
|
|
188
|
+
if (resource.type === 'HF' && !resource.repo) {
|
|
189
|
+
throw new Error(`missing repo for HF resource ${describeResource(resource)}`);
|
|
190
|
+
}
|
|
191
|
+
let volumeName = this.repository.getVolumeResource(resourceName)?.volume;
|
|
192
|
+
let sync = true;
|
|
193
|
+
if (!volumeName) {
|
|
194
|
+
sync = false;
|
|
195
|
+
const response = await this.containerOrchestration.createVolume();
|
|
196
|
+
// PODMAN returns `name`, Docker returns `Name`.
|
|
197
|
+
volumeName = response.name ?? response.Name;
|
|
198
|
+
// Recorded before the download starts, marked pending. Recording only
|
|
199
|
+
// after success left every crash mid-download with a full-size volume
|
|
200
|
+
// the DB had never heard of, which nothing ever swept. A pending entry
|
|
201
|
+
// is resynced when the resource is requested again and expires like any
|
|
202
|
+
// other entry if it never is.
|
|
203
|
+
this.repository.updateVolumeResource(resourceName, {
|
|
204
|
+
volume: volumeName,
|
|
205
|
+
required: this.marketVolumes.has(resourceName),
|
|
206
|
+
lastUsed: new Date(),
|
|
207
|
+
usage: 0,
|
|
208
|
+
pending: true,
|
|
209
|
+
project,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const resourceManagerImage = this.resourceManagerImage;
|
|
213
|
+
switch (resource.type) {
|
|
214
|
+
case 'S3': {
|
|
215
|
+
const s3Resource = resource;
|
|
216
|
+
if (s3Resource.url) {
|
|
217
|
+
const args = createS3Args(volumeName, {
|
|
218
|
+
url: s3Resource.url,
|
|
219
|
+
files: s3Resource.files,
|
|
220
|
+
bucket: s3Resource.bucket,
|
|
221
|
+
}, s3Resource.IAM, resourceManagerImage);
|
|
222
|
+
await this.runResourceManagerContainer(volumeName, resourceName, args, controller, sync);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
for (const bucket of s3Resource.buckets) {
|
|
226
|
+
const args = createS3Args(volumeName, { url: bucket.url, files: bucket.files }, s3Resource.IAM, resourceManagerImage);
|
|
227
|
+
await this.runResourceManagerContainer(volumeName, resourceName, args, controller, sync);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
this.setVolume(resourceName, volumeName, project);
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
case 'HF': {
|
|
234
|
+
const { repo, revision, files: hfFiles, accessToken, } = resource;
|
|
235
|
+
const args = createHFArgs(volumeName, { repo, revision, files: hfFiles }, accessToken, resourceManagerImage);
|
|
236
|
+
await this.runResourceManagerContainer(volumeName, resourceName, args, controller, sync);
|
|
237
|
+
this.setVolume(resourceName, volumeName, project);
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
case 'Ollama': {
|
|
241
|
+
const { model } = resource;
|
|
242
|
+
const args = createOllamaArgs(volumeName, model, resourceManagerImage);
|
|
243
|
+
await this.runResourceManagerContainer(volumeName, resourceName, args, controller, sync);
|
|
244
|
+
this.setVolume(resourceName, volumeName, project);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return volumeName;
|
|
249
|
+
}
|
|
250
|
+
async runResourceManagerContainer(volume, name, args, controller, syncing = false) {
|
|
251
|
+
const container = await this.containerOrchestration.runContainer(args);
|
|
252
|
+
try {
|
|
253
|
+
const logStream = await container.logs({
|
|
254
|
+
stdout: true,
|
|
255
|
+
stderr: false,
|
|
256
|
+
follow: true,
|
|
257
|
+
abortSignal: liveAbortSignal(controller?.signal),
|
|
258
|
+
});
|
|
259
|
+
let start = false;
|
|
260
|
+
let formatSize = 'kb';
|
|
261
|
+
logStream.on('data', (logBuffer) => {
|
|
262
|
+
try {
|
|
263
|
+
const logString = logBuffer.toString('utf8');
|
|
264
|
+
const logJSON = JSON.parse(logString.slice(8, logString.length - 1));
|
|
265
|
+
if (!start && logJSON.event === 'status') {
|
|
266
|
+
start = true;
|
|
267
|
+
const { value, format } = convertFromBytes(logJSON.size.total);
|
|
268
|
+
formatSize = format;
|
|
269
|
+
this.progressBarReporter.start(`${syncing ? 'Syncing' : 'Downloading'} resource ${name}`, {
|
|
270
|
+
format: `{bar} {percentage}% | {value}/{total}${format} | {valueFiles}/{totalFiles} files`,
|
|
271
|
+
}, value, 0, {
|
|
272
|
+
valueFiles: 0,
|
|
273
|
+
totalFiles: logJSON.count.total,
|
|
274
|
+
}, Presets.shades_classic);
|
|
275
|
+
}
|
|
276
|
+
else if (logJSON.event === 'status') {
|
|
277
|
+
const { value } = convertFromBytes(logJSON.size.current, formatSize);
|
|
278
|
+
this.progressBarReporter.update(value, {
|
|
279
|
+
valueFiles: logJSON.count.current,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
catch (error) { }
|
|
284
|
+
});
|
|
285
|
+
const { StatusCode } = await container.wait({
|
|
286
|
+
condition: 'not-running',
|
|
287
|
+
abortSignal: liveAbortSignal(controller?.signal),
|
|
288
|
+
});
|
|
289
|
+
if (StatusCode !== 0) {
|
|
290
|
+
const errrorBuffer = await container.logs({
|
|
291
|
+
follow: false,
|
|
292
|
+
stdout: false,
|
|
293
|
+
stderr: true,
|
|
294
|
+
tail: 24999,
|
|
295
|
+
timestamps: true,
|
|
296
|
+
});
|
|
297
|
+
const { logs } = extractLogsAndResultsFromLogBuffer(errrorBuffer, undefined);
|
|
298
|
+
// Read the state before the catch removes it: a killed process logs
|
|
299
|
+
// nothing, so the runtime's own record is the only account of why.
|
|
300
|
+
const state = await container
|
|
301
|
+
.inspect()
|
|
302
|
+
.then(({ State }) => State)
|
|
303
|
+
.catch(() => undefined);
|
|
304
|
+
const reported = findReportedErrors(logs);
|
|
305
|
+
// A non-zero exit is a failed download whether or not the container
|
|
306
|
+
// managed to report a reason, so this must throw either way: returning
|
|
307
|
+
// normally here reports success for an unfinished volume, and the run
|
|
308
|
+
// then fails later with the cause lost.
|
|
309
|
+
const reason = reported.at(-1) ?? describeUnreportedExit(logs, StatusCode);
|
|
310
|
+
throw new ResourceDownloadError(`resource download failed for ${name}: ${reason}${describeContainerState(state)}`, reported);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
this.progressBarReporter.stop(`${syncing ? 'Syncing' : 'Downloading'} resource ${name} stopped`);
|
|
315
|
+
// Force-removal also stops a download an abort left running, and
|
|
316
|
+
// untracks it so the next resync does not chase a container already gone.
|
|
317
|
+
await this.containerOrchestration.stopAndDeleteContainer(container.id);
|
|
318
|
+
// The volume goes with the failed download, and its entry goes with the
|
|
319
|
+
// volume. If the deletion itself fails, the entry must stay: a pending
|
|
320
|
+
// entry over a leftover volume is resynced or expired later, which is
|
|
321
|
+
// the point of writing it up front.
|
|
322
|
+
try {
|
|
323
|
+
await this.containerOrchestration.deleteVolume(volume);
|
|
324
|
+
this.repository.deleteVolumeResource(name);
|
|
325
|
+
}
|
|
326
|
+
catch { }
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
329
|
+
this.progressBarReporter.stop(`${syncing ? 'Synced' : 'Downloaded'} resource ${name} completed`);
|
|
330
|
+
await this.containerOrchestration.stopAndDeleteContainer(container.id);
|
|
331
|
+
}
|
|
332
|
+
async setVolume(bucket, volume, project) {
|
|
333
|
+
const volumeObj = this.repository.getVolumeResource(bucket);
|
|
334
|
+
this.repository.updateVolumeResource(bucket, {
|
|
335
|
+
volume,
|
|
336
|
+
required: this.marketVolumes.has(bucket),
|
|
337
|
+
lastUsed: new Date(),
|
|
338
|
+
usage: (volumeObj?.usage ?? 0) + 1,
|
|
339
|
+
// Only a completed sync reaches here, which is what pending means.
|
|
340
|
+
pending: false,
|
|
341
|
+
project,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
async hasVolume(resource, resourceKey) {
|
|
345
|
+
const key = resourceKey ?? createResourceName(resource);
|
|
346
|
+
const volume = this.repository.getVolumeResource(key)?.volume;
|
|
347
|
+
if (!volume) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
const dockerHasVolume = await this.containerOrchestration.hasVolume(volume);
|
|
351
|
+
if (!dockerHasVolume) {
|
|
352
|
+
this.repository.deleteVolumeResource(key);
|
|
353
|
+
}
|
|
354
|
+
return dockerHasVolume;
|
|
355
|
+
}
|
|
356
|
+
async getVolume(resource, resourceKey) {
|
|
357
|
+
return this.repository.getVolumeResource(resourceKey ?? createResourceName(resource))?.volume;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RequiredResource } from '@nosana/
|
|
1
|
+
import { RequiredResource } from '@nosana/kit';
|
|
2
2
|
export declare function createResourceName(resource: RequiredResource): string;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type { OperationResults, Log } from '@nosana/sdk';
|
|
1
|
+
import type { OperationResults, Log } from '@nosana/kit';
|
|
4
2
|
export declare function extractLogsAndResultsFromLogBuffer(logBuffer: Buffer, operationResults: OperationResults | undefined): {
|
|
5
3
|
logs: Log[];
|
|
6
4
|
results: {} | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parseLogFrames } from '
|
|
2
|
-
import { createResultsObject, extractResultFromLog, } from '
|
|
1
|
+
import { parseLogFrames } from '../../../../container-orchestrator/src/index.js';
|
|
2
|
+
import { createResultsObject, extractResultFromLog, } from '../../../../common/src/index.js';
|
|
3
3
|
export function extractLogsAndResultsFromLogBuffer(logBuffer, operationResults) {
|
|
4
4
|
const results = operationResults
|
|
5
5
|
? createResultsObject(operationResults)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The image and resource cache code a job's sidecar runs, and the node's
|
|
3
|
+
* cache upkeep builds on (`@nosana/job-runtime/resources`): the node's
|
|
4
|
+
* ImageManager and VolumeManager each hold one of these caches, and add the
|
|
5
|
+
* market's resources, the resync and the prune around it.
|
|
6
|
+
*/
|
|
7
|
+
export * from './records.js';
|
|
8
|
+
export { ImageCache } from './ImageCache.js';
|
|
9
|
+
export { VolumeCache, ResourceDownloadError, describeContainerState, describeUnreportedExit, findReportedErrors, } from './VolumeCache.js';
|
|
10
|
+
export { createResourceName } from './helpers/createResourceName.js';
|
|
11
|
+
export { nosanaBucket } from './helpers/nosanaBucket.js';
|
|
12
|
+
export { ProgressBarReporter } from './progressBarReporter.js';
|
|
13
|
+
export { MultiProgressBarReporter } from './multiProgressBarReporter.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The image and resource cache code a job's sidecar runs, and the node's
|
|
3
|
+
* cache upkeep builds on (`@nosana/job-runtime/resources`): the node's
|
|
4
|
+
* ImageManager and VolumeManager each hold one of these caches, and add the
|
|
5
|
+
* market's resources, the resync and the prune around it.
|
|
6
|
+
*/
|
|
7
|
+
export * from './records.js';
|
|
8
|
+
export { ImageCache } from './ImageCache.js';
|
|
9
|
+
export { VolumeCache, ResourceDownloadError, describeContainerState, describeUnreportedExit, findReportedErrors, } from './VolumeCache.js';
|
|
10
|
+
export { createResourceName } from './helpers/createResourceName.js';
|
|
11
|
+
export { nosanaBucket } from './helpers/nosanaBucket.js';
|
|
12
|
+
export { ProgressBarReporter } from './progressBarReporter.js';
|
|
13
|
+
export { MultiProgressBarReporter } from './multiProgressBarReporter.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ContainerOrchestrationInterface } from '../../../container-orchestrator/src/index.js';
|
|
2
|
+
import type { JobResources } from '../provider/ports.js';
|
|
3
|
+
import type { FlowStore } from '../store/FlowStore.js';
|
|
4
|
+
import type { ImageCache } from './ImageCache.js';
|
|
5
|
+
import { type VolumeCache } from './VolumeCache.js';
|
|
6
|
+
/**
|
|
7
|
+
* A job's images and remote resources, out of the cache shared by every job
|
|
8
|
+
* on the host: pulled and downloaded here, recorded in `images` and
|
|
9
|
+
* `volumes`' records. A failed download's reasons are written to the op's
|
|
10
|
+
* records as op errors.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createJobResources(containerOrchestration: ContainerOrchestrationInterface, images: ImageCache, volumes: VolumeCache, store: Pick<FlowStore, 'updateOpStateError'>): JobResources;
|