@nosana/node 1.1.73-dev.mr80.17351441846 → 1.1.73
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 +9 -10
- 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 +1 -3
- package/dist/packages/container-orchestrator/src/docker/index.js +21 -16
- package/dist/packages/container-orchestrator/src/hooks.d.ts +2 -9
- package/dist/packages/container-orchestrator/src/hooks.js +0 -5
- package/dist/packages/container-orchestrator/src/index.d.ts +0 -1
- package/dist/packages/container-orchestrator/src/index.js +0 -1
- package/dist/packages/container-orchestrator/src/interface.d.ts +1 -4
- package/dist/packages/container-orchestrator/src/labels.d.ts +0 -2
- package/dist/packages/container-orchestrator/src/labels.js +0 -2
- package/dist/packages/container-orchestrator/src/podman/index.js +9 -4
- package/dist/packages/container-orchestrator/src/podman/utils/createPodmanRunOptions.d.ts +1 -1
- package/dist/packages/container-orchestrator/src/types.d.ts +5 -0
- package/dist/src/NodeManager/clients/hostManager/index.js +3 -3
- package/dist/src/NodeManager/clients/types.utils.d.ts +1 -0
- package/dist/src/NodeManager/configs/configs.d.ts +2 -1
- package/dist/src/NodeManager/configs/configs.js +1 -0
- package/dist/src/NodeManager/db/index.d.ts +44 -11
- package/dist/src/NodeManager/db/index.js +3 -5
- package/dist/src/NodeManager/errors/NodeNotQualifiedError.js +2 -2
- package/dist/src/NodeManager/index.js +14 -25
- package/dist/src/NodeManager/input/OperatorInput.d.ts +2 -0
- package/dist/src/NodeManager/jobs/index.d.ts +6 -1
- package/dist/src/NodeManager/jobs/index.js +45 -2
- package/dist/src/NodeManager/monitoring/log/NodeLog.d.ts +8 -6
- package/dist/src/NodeManager/monitoring/log/NodeLog.js +461 -38
- package/dist/src/NodeManager/monitoring/log/console/ConsoleLogger.d.ts +1 -0
- package/dist/src/NodeManager/monitoring/log/console/ConsoleLogger.js +5 -5
- package/dist/{packages/common/src → src/NodeManager/monitoring/proxy}/loggingProxy.d.ts +1 -0
- package/dist/{packages/common/src → src/NodeManager/monitoring/proxy}/loggingProxy.js +1 -0
- package/dist/src/NodeManager/monitoring/reportError.js +3 -2
- package/dist/src/NodeManager/monitoring/state/NodeState.d.ts +1 -1
- package/dist/src/NodeManager/monitoring/state/NodeState.js +29 -1
- package/dist/src/NodeManager/node/Node.d.ts +8 -28
- package/dist/src/NodeManager/node/Node.js +45 -81
- package/dist/src/NodeManager/node/api/ApiEventEmitter.d.ts +1 -0
- package/dist/src/NodeManager/node/api/ApiHandler.d.ts +7 -21
- package/dist/src/NodeManager/node/api/ApiHandler.js +46 -67
- package/dist/src/NodeManager/node/api/eventsource/index.d.ts +6 -0
- package/dist/src/NodeManager/node/api/middlewares/index.d.ts +1 -0
- package/dist/src/NodeManager/node/api/middlewares/index.js +2 -0
- package/dist/src/NodeManager/node/api/middlewares/rest/verifyJobOwnerSignatureMiddleware.d.ts +5 -0
- package/dist/src/NodeManager/node/api/middlewares/rest/verifyJobOwnerSignatureMiddleware.js +29 -0
- package/dist/src/NodeManager/node/api/middlewares/ws/verifyWSJobOwnerSignatureMiddleware.js +8 -6
- package/dist/src/NodeManager/node/api/routes/get/index.d.ts +7 -0
- package/dist/src/NodeManager/node/api/routes/get/index.js +7 -0
- package/dist/src/NodeManager/node/api/routes/get/job-definition.d.ts +5 -0
- package/dist/src/NodeManager/node/api/routes/get/job-definition.js +16 -0
- package/dist/src/NodeManager/node/api/routes/get/job-info/buildInfoObject.d.ts +17 -0
- package/dist/src/NodeManager/node/api/routes/get/job-info/buildInfoObject.js +15 -0
- package/dist/src/NodeManager/node/api/routes/get/job-info/job-info.d.ts +5 -0
- package/dist/src/NodeManager/node/api/routes/get/job-info/job-info.js +18 -0
- package/dist/src/NodeManager/node/api/routes/get/job-info/pollActiveJob.d.ts +6 -0
- package/dist/src/NodeManager/node/api/routes/get/job-info/pollActiveJob.js +42 -0
- package/dist/src/NodeManager/node/api/routes/get/job-operation-info.d.ts +28 -0
- package/dist/src/NodeManager/node/api/routes/get/job-operation-info.js +53 -0
- package/dist/src/NodeManager/node/api/routes/get/job-results.d.ts +5 -0
- package/dist/src/NodeManager/node/api/routes/get/job-results.js +15 -0
- package/dist/src/NodeManager/node/api/routes/get/job-stats-stream.d.ts +5 -0
- package/dist/{packages/job-runtime/src/api/routes/stats.js → src/NodeManager/node/api/routes/get/job-stats-stream.js} +5 -25
- package/dist/src/NodeManager/node/api/routes/get/job-stats.d.ts +5 -0
- package/dist/src/NodeManager/node/api/routes/get/job-stats.js +22 -0
- package/dist/src/NodeManager/node/api/routes/get/service-url.d.ts +5 -0
- package/dist/src/NodeManager/node/api/routes/get/service-url.js +27 -0
- package/dist/src/NodeManager/node/api/routes/index.d.ts +1 -0
- package/dist/src/NodeManager/node/api/routes/index.js +1 -0
- package/dist/src/NodeManager/node/api/routes/post/index.d.ts +4 -0
- package/dist/src/NodeManager/node/api/routes/post/index.js +4 -0
- package/dist/src/NodeManager/node/api/routes/post/job-definition.d.ts +6 -0
- package/dist/src/NodeManager/node/api/routes/post/job-definition.js +15 -0
- package/dist/src/NodeManager/node/api/routes/post/job-operation-actions.d.ts +20 -0
- package/dist/src/NodeManager/node/api/routes/post/job-operation-actions.js +63 -0
- package/dist/src/NodeManager/node/api/routes/post/service-stop.d.ts +5 -0
- package/dist/src/NodeManager/node/api/routes/post/service-stop.js +13 -0
- package/dist/src/NodeManager/node/api/routes/post/ssh-authorize.d.ts +17 -0
- package/dist/src/NodeManager/node/api/routes/post/ssh-authorize.js +53 -0
- package/dist/src/NodeManager/node/api/routes/wss/index.d.ts +2 -0
- package/dist/src/NodeManager/node/api/routes/wss/index.js +2 -0
- package/dist/src/NodeManager/node/api/routes/wss/log.d.ts +9 -0
- package/dist/src/NodeManager/node/api/routes/wss/log.js +55 -2
- package/dist/src/NodeManager/node/api/routes/wss/status.js +4 -2
- package/dist/{packages/job-runtime/src/api/terminal/terminalBridge.d.ts → src/NodeManager/node/api/routes/wss/terminal/terminal.d.ts} +7 -6
- package/dist/{packages/job-runtime/src/api/terminal/terminalBridge.js → src/NodeManager/node/api/routes/wss/terminal/terminal.js} +23 -15
- package/dist/{packages/job-runtime/src/api → src/NodeManager/node/api/routes/wss}/terminal/terminalAuthorization.d.ts +1 -0
- package/dist/{packages/job-runtime/src/api → src/NodeManager/node/api/routes/wss}/terminal/terminalAuthorization.js +3 -3
- package/dist/src/NodeManager/node/api/types/index.d.ts +2 -2
- package/dist/{packages/job-runtime/src/api → src/NodeManager/node/api/utils}/interval.d.ts +5 -2
- package/dist/{packages/job-runtime/src/api → src/NodeManager/node/api/utils}/interval.js +1 -1
- package/dist/src/NodeManager/node/balance/balanceHandler.d.ts +5 -4
- package/dist/src/NodeManager/node/balance/balanceHandler.js +5 -6
- package/dist/src/NodeManager/node/expiry/expiryHandler.d.ts +10 -2
- package/dist/src/NodeManager/node/expiry/expiryHandler.js +36 -8
- package/dist/src/NodeManager/node/grid/gridHandler.d.ts +13 -0
- package/dist/src/NodeManager/node/grid/gridHandler.js +35 -0
- package/dist/src/NodeManager/node/health/healthHandler.d.ts +4 -3
- package/dist/src/NodeManager/node/health/healthHandler.js +8 -5
- package/dist/src/NodeManager/node/job/JobRegistry.d.ts +6 -16
- package/dist/src/NodeManager/node/job/JobRegistry.js +22 -68
- package/dist/src/NodeManager/node/job/defination/JobDefinitionStrategy.d.ts +13 -0
- package/dist/src/NodeManager/node/job/defination/JobDefinitionStrategy.js +21 -0
- package/dist/src/NodeManager/node/job/defination/strategy/ApiJobDefinitionStrategy.d.ts +8 -0
- package/dist/{packages/job-runtime/src/logistics/definition → src/NodeManager/node/job/defination/strategy}/ApiJobDefinitionStrategy.js +5 -5
- package/dist/{packages/job-runtime/src/logistics/definition → src/NodeManager/node/job/defination/strategy}/ApiListenJobDefinitionStrategy.d.ts +3 -2
- package/dist/src/NodeManager/node/job/defination/strategy/IpfsJobDefinitionStrategy.d.ts +5 -0
- package/dist/src/NodeManager/node/job/defination/strategy/IpfsJobDefinitionStrategy.js +11 -0
- package/dist/src/NodeManager/node/job/jobExternalUtil.d.ts +10 -0
- package/dist/src/NodeManager/node/job/jobExternalUtil.js +96 -0
- package/dist/src/NodeManager/node/job/jobHandler.d.ts +14 -78
- package/dist/src/NodeManager/node/job/jobHandler.js +129 -224
- package/dist/src/NodeManager/node/job/result/ResultReturnStrategy.d.ts +13 -0
- package/dist/src/NodeManager/node/job/result/ResultReturnStrategy.js +21 -0
- package/dist/{packages/job-runtime/src/logistics/result → src/NodeManager/node/job/result/startegy}/ApiListenResultReturnStrategy.d.ts +2 -1
- package/dist/src/NodeManager/node/job/result/startegy/ApiResultReturnStrategy.d.ts +8 -0
- package/dist/{packages/job-runtime/src/logistics/result → src/NodeManager/node/job/result/startegy}/ApiResultReturnStrategy.js +5 -5
- package/dist/src/NodeManager/node/key/keyHandler.d.ts +9 -15
- package/dist/src/NodeManager/node/key/keyHandler.js +9 -18
- package/dist/src/NodeManager/node/market/benchmark.d.ts +4 -11
- package/dist/src/NodeManager/node/market/benchmark.js +40 -55
- package/dist/src/NodeManager/node/market/hostManager.d.ts +16 -14
- package/dist/src/NodeManager/node/market/hostManager.js +12 -0
- package/dist/src/NodeManager/node/market/marketAccess.d.ts +3 -9
- package/dist/src/NodeManager/node/market/marketAccess.js +9 -27
- package/dist/src/NodeManager/node/market/marketHandler.d.ts +7 -11
- package/dist/src/NodeManager/node/market/marketHandler.js +18 -33
- package/dist/src/NodeManager/node/register/index.js +1 -1
- package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/createResourceName.d.ts +1 -1
- package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/createResourceName.js +1 -1
- package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/createS3Args.d.ts +1 -1
- package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/createS3Args.js +1 -1
- package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/isAuthGatedResource.d.ts +1 -1
- package/dist/src/NodeManager/node/resource/image/imageManager.d.ts +16 -12
- package/dist/src/NodeManager/node/resource/image/imageManager.js +35 -21
- package/dist/src/NodeManager/node/resource/resourceManager.d.ts +10 -26
- package/dist/src/NodeManager/node/resource/resourceManager.js +40 -48
- package/dist/src/NodeManager/node/resource/volume/volumeManager.d.ts +75 -11
- package/dist/src/NodeManager/node/resource/volume/volumeManager.js +347 -25
- package/dist/src/NodeManager/node/run/runHandler.d.ts +4 -17
- package/dist/src/NodeManager/node/run/runHandler.js +46 -69
- package/dist/src/NodeManager/node/stake/StakeHandler.d.ts +5 -18
- package/dist/src/NodeManager/node/stake/StakeHandler.js +24 -56
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/TaskManager.d.ts +47 -16
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/TaskManager.js +59 -20
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/executions/createExecutionPlan.js +1 -0
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/executions/createOperationMap.d.ts +1 -1
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/finalizeEnv.d.ts +1 -1
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/interpolateOperation.d.ts +1 -1
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setDefaults.d.ts +1 -1
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setDefaults.js +13 -10
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/stanatizeArrays.d.ts +1 -1
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/transformCollections.d.ts +1 -1
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/helpers/createDefaultOpState.d.ts +1 -1
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/helpers/createInitialFlow.d.ts +2 -2
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/loggers/StatsBuffer.d.ts +1 -1
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/enforceOperationTimeout.d.ts +1 -0
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/runTaskManagerOperation.d.ts +2 -2
- package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/runTaskManagerOperation.js +3 -2
- package/dist/{packages/job-runtime/src/resources/helpers → src/NodeManager/node/utils}/extractLogsAndResultsFromLogBuffer.d.ts +3 -1
- package/dist/{packages/job-runtime/src/resources/helpers → src/NodeManager/node/utils}/extractLogsAndResultsFromLogBuffer.js +2 -2
- package/dist/{packages/common/src → src/NodeManager/node/utils}/extractResultsFromLogs.d.ts +1 -1
- package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/utils}/multiProgressBarReporter.d.ts +2 -4
- package/dist/src/NodeManager/node/utils/multiProgressBarReporter.js +22 -0
- package/dist/src/NodeManager/node/utils/poll.d.ts +1 -1
- package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/utils}/progressBarReporter.d.ts +2 -4
- package/dist/src/NodeManager/node/utils/progressBarReporter.js +28 -0
- package/dist/{packages/job-runtime/src → src/NodeManager}/provider/ContainerStateManager.d.ts +3 -10
- package/dist/{packages/job-runtime/src → src/NodeManager}/provider/ContainerStateManager.js +5 -23
- package/dist/{packages/job-runtime/src → src/NodeManager}/provider/ExposedPortHealthCheck.d.ts +5 -4
- package/dist/src/NodeManager/provider/Provider.d.ts +92 -69
- package/dist/src/NodeManager/provider/Provider.js +534 -205
- package/dist/{packages/job-runtime/src → src/NodeManager}/provider/SshAccessManager.d.ts +4 -4
- package/dist/src/NodeManager/provider/orchestrationHooks.js +2 -2
- package/dist/{packages/job-runtime/src → src/NodeManager}/provider/sshSidecar.d.ts +7 -7
- package/dist/{packages/job-runtime/src → src/NodeManager}/provider/sshSidecar.js +4 -2
- package/dist/src/NodeManager/provider/types.d.ts +9 -0
- package/dist/{packages/container-orchestrator/src → src/NodeManager/provider}/utils/parseBuffer.d.ts +3 -1
- package/dist/{packages/job-runtime/src/provider → src/NodeManager/provider/utils}/parseDockerStat.d.ts +1 -1
- package/dist/src/NodeManager/provider/webTerminal.d.ts +24 -0
- package/dist/{packages/job-runtime/src/api/runtime/terminal.js → src/NodeManager/provider/webTerminal.js} +9 -13
- package/dist/src/NodeManager/repository/NodeRepository.d.ts +41 -5
- package/dist/src/NodeManager/repository/NodeRepository.js +155 -8
- package/dist/src/NodeManager/sdk/index.d.ts +9 -6
- package/dist/src/NodeManager/sdk/index.js +94 -78
- package/dist/src/NodeManager/types/index.d.ts +9 -0
- package/dist/src/NodeManager/utils/expose-util.d.ts +14 -0
- package/dist/{packages/job-runtime/src/provider/expose.js → src/NodeManager/utils/expose-util.js} +39 -8
- package/dist/src/NodeManager/utils/jobDefinitionParser.d.ts +4 -0
- package/dist/src/NodeManager/utils/jobDefinitionParser.js +7 -1
- package/dist/src/NodeManager/utils/ops-util.d.ts +3 -0
- package/dist/src/NodeManager/utils/ops-util.js +19 -0
- package/dist/src/NodeManager/utils/tolerateBrokenStdio.d.ts +1 -0
- package/dist/src/NodeManager/utils/utils.d.ts +2 -1
- package/dist/src/NodeManager/utils/utils.js +4 -1
- package/dist/src/cli/commands/address/action.js +2 -3
- package/dist/src/cli/commands/run/action.d.ts +0 -5
- package/dist/src/cli/commands/run/action.js +18 -65
- package/dist/src/cli/commands/run/generateDeploymentEndpointsTable.d.ts +2 -2
- package/dist/src/cli/commands/run/generateDeploymentEndpointsTable.js +5 -6
- package/dist/src/cli/commands/sharedOptions/--api.d.ts +2 -0
- package/dist/src/cli/commands/sharedOptions/--api.js +2 -0
- package/dist/src/cli/commands/sharedOptions/--tee-runtime.js +1 -1
- package/dist/src/cli/commands/sharedOptions/--timeout.d.ts +2 -0
- package/dist/src/cli/commands/sharedOptions/--timeout.js +12 -0
- package/dist/src/cli/commands/start/action.d.ts +1 -0
- package/dist/src/cli/commands/start/action.js +1 -0
- package/dist/src/cli/createNosanaCli.js +4 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/ipfs/IpfsClient.d.ts +1 -3
- 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/npm-shrinkwrap.json +1466 -3257
- package/package.json +9 -10
- package/dist/packages/common/src/OperationError.d.ts +0 -14
- package/dist/packages/common/src/OperationError.js +0 -18
- package/dist/packages/common/src/expose-id.d.ts +0 -12
- package/dist/packages/common/src/expose-id.js +0 -23
- package/dist/packages/common/src/index.d.ts +0 -11
- package/dist/packages/common/src/index.js +0 -11
- package/dist/packages/common/src/jobPhaseLog.d.ts +0 -42
- package/dist/packages/common/src/jobPhaseLog.js +0 -207
- package/dist/packages/job-runtime/src/api/eventsource.d.ts +0 -6
- package/dist/packages/job-runtime/src/api/middlewares/verifyJobOwnerSignature.d.ts +0 -13
- package/dist/packages/job-runtime/src/api/middlewares/verifyJobOwnerSignature.js +0 -39
- package/dist/packages/job-runtime/src/api/middlewares/verifyWSSignatures.d.ts +0 -10
- package/dist/packages/job-runtime/src/api/middlewares/verifyWSSignatures.js +0 -34
- package/dist/packages/job-runtime/src/api/paths.d.ts +0 -52
- package/dist/packages/job-runtime/src/api/paths.js +0 -52
- package/dist/packages/job-runtime/src/api/router.d.ts +0 -10
- package/dist/packages/job-runtime/src/api/router.js +0 -64
- package/dist/packages/job-runtime/src/api/routes/definitionAndResults.d.ts +0 -8
- package/dist/packages/job-runtime/src/api/routes/definitionAndResults.js +0 -69
- package/dist/packages/job-runtime/src/api/routes/info.d.ts +0 -23
- package/dist/packages/job-runtime/src/api/routes/info.js +0 -69
- package/dist/packages/job-runtime/src/api/routes/operations.d.ts +0 -36
- package/dist/packages/job-runtime/src/api/routes/operations.js +0 -120
- package/dist/packages/job-runtime/src/api/routes/ssh.d.ts +0 -11
- package/dist/packages/job-runtime/src/api/routes/ssh.js +0 -83
- package/dist/packages/job-runtime/src/api/routes/stats.d.ts +0 -4
- package/dist/packages/job-runtime/src/api/runtime/terminal.d.ts +0 -15
- package/dist/packages/job-runtime/src/api/types.d.ts +0 -170
- package/dist/packages/job-runtime/src/api/wsClose.d.ts +0 -6
- package/dist/packages/job-runtime/src/api/wsClose.js +0 -10
- package/dist/packages/job-runtime/src/api/wsHandler.d.ts +0 -10
- package/dist/packages/job-runtime/src/api/wsHandler.js +0 -145
- package/dist/packages/job-runtime/src/chain.d.ts +0 -28
- package/dist/packages/job-runtime/src/chain.js +0 -72
- package/dist/packages/job-runtime/src/config.d.ts +0 -39
- package/dist/packages/job-runtime/src/config.js +0 -57
- package/dist/packages/job-runtime/src/host/HostClient.d.ts +0 -29
- package/dist/packages/job-runtime/src/host/HostClient.js +0 -91
- package/dist/packages/job-runtime/src/host/contract.d.ts +0 -171
- package/dist/packages/job-runtime/src/host/contract.js +0 -163
- package/dist/packages/job-runtime/src/host/hostPorts.d.ts +0 -7
- package/dist/packages/job-runtime/src/host/hostPorts.js +0 -13
- package/dist/packages/job-runtime/src/host/index.d.ts +0 -10
- package/dist/packages/job-runtime/src/host/index.js +0 -10
- package/dist/packages/job-runtime/src/logistics/JobDefinitionStrategy.d.ts +0 -21
- package/dist/packages/job-runtime/src/logistics/JobDefinitionStrategy.js +0 -27
- package/dist/packages/job-runtime/src/logistics/ResultReturnStrategy.d.ts +0 -21
- package/dist/packages/job-runtime/src/logistics/ResultReturnStrategy.js +0 -27
- package/dist/packages/job-runtime/src/logistics/definition/ApiJobDefinitionStrategy.d.ts +0 -11
- package/dist/packages/job-runtime/src/logistics/ports.d.ts +0 -10
- package/dist/packages/job-runtime/src/logistics/ports.js +0 -1
- package/dist/packages/job-runtime/src/logistics/result/ApiResultReturnStrategy.d.ts +0 -11
- package/dist/packages/job-runtime/src/main.d.ts +0 -1
- package/dist/packages/job-runtime/src/main.js +0 -83
- package/dist/packages/job-runtime/src/provider/ContainerProvider.d.ts +0 -82
- package/dist/packages/job-runtime/src/provider/ContainerProvider.js +0 -449
- package/dist/packages/job-runtime/src/provider/expose.d.ts +0 -12
- package/dist/packages/job-runtime/src/provider/gpu/gpuSampler.d.ts +0 -24
- package/dist/packages/job-runtime/src/provider/gpu/gpuSampler.js +0 -97
- package/dist/packages/job-runtime/src/provider/gpu/gpuStats.d.ts +0 -63
- package/dist/packages/job-runtime/src/provider/gpu/gpuStats.js +0 -144
- package/dist/packages/job-runtime/src/provider/ports.d.ts +0 -59
- package/dist/packages/job-runtime/src/provider/ports.js +0 -1
- package/dist/packages/job-runtime/src/resources/FileResourceRecords.d.ts +0 -21
- package/dist/packages/job-runtime/src/resources/FileResourceRecords.js +0 -53
- package/dist/packages/job-runtime/src/resources/ImageCache.d.ts +0 -35
- package/dist/packages/job-runtime/src/resources/ImageCache.js +0 -55
- package/dist/packages/job-runtime/src/resources/VolumeCache.d.ts +0 -110
- package/dist/packages/job-runtime/src/resources/VolumeCache.js +0 -359
- package/dist/packages/job-runtime/src/resources/index.d.ts +0 -13
- package/dist/packages/job-runtime/src/resources/index.js +0 -13
- package/dist/packages/job-runtime/src/resources/jobResources.d.ts +0 -12
- package/dist/packages/job-runtime/src/resources/jobResources.js +0 -88
- package/dist/packages/job-runtime/src/resources/multiProgressBarReporter.js +0 -12
- package/dist/packages/job-runtime/src/resources/progressBarReporter.js +0 -12
- package/dist/packages/job-runtime/src/resources/records.d.ts +0 -67
- package/dist/packages/job-runtime/src/resources/records.js +0 -6
- package/dist/packages/job-runtime/src/runtime/RuntimeLog.d.ts +0 -26
- package/dist/packages/job-runtime/src/runtime/RuntimeLog.js +0 -79
- package/dist/packages/job-runtime/src/runtime/retrieveJobDefinition.d.ts +0 -6
- package/dist/packages/job-runtime/src/runtime/retrieveJobDefinition.js +0 -19
- package/dist/packages/job-runtime/src/runtime/runJob.d.ts +0 -31
- package/dist/packages/job-runtime/src/runtime/runJob.js +0 -534
- package/dist/packages/job-runtime/src/runtime/streams.d.ts +0 -32
- package/dist/packages/job-runtime/src/runtime/streams.js +0 -81
- package/dist/packages/job-runtime/src/server.d.ts +0 -23
- package/dist/packages/job-runtime/src/server.js +0 -66
- package/dist/packages/job-runtime/src/store/FlowStore.d.ts +0 -62
- package/dist/packages/job-runtime/src/store/FlowStore.js +0 -170
- package/dist/packages/job-runtime/src/taskManager/index.d.ts +0 -11
- package/dist/packages/job-runtime/src/taskManager/index.js +0 -8
- package/dist/packages/job-runtime/src/taskManager/ports/FlowRepository.d.ts +0 -22
- package/dist/packages/job-runtime/src/taskManager/ports/FlowRepository.js +0 -1
- package/dist/packages/job-runtime/src/taskManager/ports/OrchestrationProvider.d.ts +0 -24
- package/dist/packages/job-runtime/src/taskManager/ports/OrchestrationProvider.js +0 -1
- package/dist/packages/job-runtime/src/taskManager/ports/TaskContext.d.ts +0 -9
- package/dist/packages/job-runtime/src/taskManager/ports/TaskContext.js +0 -1
- package/dist/packages/job-runtime/src/taskManager/ports/index.d.ts +0 -3
- package/dist/packages/job-runtime/src/taskManager/ports/index.js +0 -1
- package/dist/packages/job-runtime/src/taskManager/runtimeConfig.d.ts +0 -23
- package/dist/packages/job-runtime/src/taskManager/runtimeConfig.js +0 -14
- package/dist/packages/job-runtime/src/taskManager/stopReasons.d.ts +0 -10
- package/dist/packages/job-runtime/src/taskManager/stopReasons.js +0 -9
- package/dist/packages/job-runtime/src/taskManager/types.d.ts +0 -53
- package/dist/packages/job-runtime/src/taskManager/types.js +0 -3
- package/dist/packages/job-runtime/src/utils/abort.d.ts +0 -17
- package/dist/packages/job-runtime/src/utils/abort.js +0 -55
- package/dist/packages/job-runtime/src/utils/files.d.ts +0 -7
- package/dist/packages/job-runtime/src/utils/files.js +0 -19
- package/dist/src/NodeManager/node/api/jobRuntimeProxy.d.ts +0 -29
- package/dist/src/NodeManager/node/api/jobRuntimeProxy.js +0 -105
- package/dist/src/NodeManager/node/job/JobRuntimeHost.d.ts +0 -26
- package/dist/src/NodeManager/node/job/JobRuntimeHost.js +0 -87
- package/dist/src/NodeManager/node/job/JobRuntimeSession.d.ts +0 -91
- package/dist/src/NodeManager/node/job/JobRuntimeSession.js +0 -213
- package/dist/src/NodeManager/node/utils/subscription.d.ts +0 -8
- package/dist/src/NodeManager/node/utils/subscription.js +0 -37
- package/dist/src/cli/commands/run/jobRuntimeConsole.d.ts +0 -10
- package/dist/src/cli/commands/run/jobRuntimeConsole.js +0 -26
- /package/dist/{packages/job-runtime/src/api/eventsource.js → src/NodeManager/node/api/eventsource/index.js} +0 -0
- /package/dist/{packages/job-runtime/src/logistics/definition → src/NodeManager/node/job/defination/strategy}/ApiListenJobDefinitionStrategy.js +0 -0
- /package/dist/{packages/job-runtime/src/logistics/result → src/NodeManager/node/job/result/startegy}/ApiListenResultReturnStrategy.js +0 -0
- /package/dist/{packages/job-runtime/src/resources/helpers/nosanaBucket.d.ts → src/NodeManager/node/resource/definition/index.d.ts} +0 -0
- /package/dist/{packages/job-runtime/src/resources/helpers/nosanaBucket.js → src/NodeManager/node/resource/definition/index.js} +0 -0
- /package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/createHFArgs.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/createHFArgs.js +0 -0
- /package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/createOllamaArgs.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/createOllamaArgs.js +0 -0
- /package/dist/{packages/job-runtime/src/resources → src/NodeManager/node/resource}/helpers/isAuthGatedResource.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/TaskManagerRegistry.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/TaskManagerRegistry.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/executions/createDependencyMap.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/executions/createDependencyMap.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/executions/createExecutionPlan.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/executions/createOperationMap.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/executions/validateExecutionPlan.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/executions/validateExecutionPlan.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/finalizeEnv.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/getByPath.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/getByPath.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/index.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/index.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/interpolate.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/interpolate.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/interpolateOperation.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/resolveLiteralsInString.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/resolveLiteralsInString.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setContainerIp.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setContainerIp.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setHost.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setHost.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setResult.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setResult.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setResults.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/setResults.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/stanatizeArrays.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/globalStore/transformCollections.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/helpers/createDefaultOpState.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/helpers/createInitialFlow.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/loggers/StatsBuffer.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/loggers/logManager.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/loggers/logManager.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/loggers/statsManager.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/loggers/statsManager.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/enforceOperationTimeout.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/getOperationsInfos.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/getOperationsInfos.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/restartTaskManagerGroupOperation.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/restartTaskManagerGroupOperation.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/restartTaskManagerOperation.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/restartTaskManagerOperation.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/stopAllTaskManagerOperations.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/stopAllTaskManagerOperations.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/stopTaskManagerGroupOperation.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/stopTaskManagerGroupOperation.js +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/stopTaskManagerOperation.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/taskManager → src/NodeManager/node/task}/operations/stopTaskManagerOperation.js +0 -0
- /package/dist/{packages/job-runtime/src/resources/helpers → src/NodeManager/node/utils}/convertFromBytes.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/resources/helpers → src/NodeManager/node/utils}/convertFromBytes.js +0 -0
- /package/dist/{packages/common/src → src/NodeManager/node/utils}/extractResultsFromLogs.js +0 -0
- /package/dist/{packages/job-runtime/src → src/NodeManager}/provider/ExposedPortHealthCheck.js +0 -0
- /package/dist/{packages/job-runtime/src → src/NodeManager}/provider/SshAccessManager.js +0 -0
- /package/dist/{packages/job-runtime/src/api → src/NodeManager/provider}/types.js +0 -0
- /package/dist/{packages/container-orchestrator/src → src/NodeManager/provider}/utils/parseBuffer.js +0 -0
- /package/dist/{packages/job-runtime/src/provider → src/NodeManager/provider/utils}/parseDockerStat.js +0 -0
- /package/dist/{packages/common/src → src/NodeManager/utils}/formatTime.d.ts +0 -0
- /package/dist/{packages/common/src → src/NodeManager/utils}/formatTime.js +0 -0
- /package/dist/{packages/job-runtime/src/provider → src/NodeManager/utils}/timeoutPromiseWrapper.d.ts +0 -0
- /package/dist/{packages/job-runtime/src/provider → src/NodeManager/utils}/timeoutPromiseWrapper.js +0 -0
|
@@ -1,359 +0,0 @@
|
|
|
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,13 +0,0 @@
|
|
|
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';
|
|
@@ -1,13 +0,0 @@
|
|
|
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';
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { createLoggingProxy } from '../../../common/src/index.js';
|
|
2
|
-
import { createResourceName } from './helpers/createResourceName.js';
|
|
3
|
-
import { isAuthGatedResource } from './helpers/isAuthGatedResource.js';
|
|
4
|
-
import { ResourceDownloadError } from './VolumeCache.js';
|
|
5
|
-
/**
|
|
6
|
-
* An operation's remote resources as volumes. Logged as the node's
|
|
7
|
-
* ResourceManager was, which is what the job log's download lines read.
|
|
8
|
-
*/
|
|
9
|
-
class ResourceVolumes {
|
|
10
|
-
constructor(volumes) {
|
|
11
|
-
this.volumes = volumes;
|
|
12
|
-
}
|
|
13
|
-
async getResourceVolumes(resources, controller, project) {
|
|
14
|
-
const mounts = [];
|
|
15
|
-
for (const resource of resources) {
|
|
16
|
-
const allowWrite = resource.type === 'S3' && !!resource.allowWrite;
|
|
17
|
-
// A writable mount can leave the job's bytes behind, and an auth-gated
|
|
18
|
-
// remote is private to the credentials that fetched it; either way the
|
|
19
|
-
// volume must be locked to this project rather than shared, so a different
|
|
20
|
-
// project pulls its own clean copy with its own credentials.
|
|
21
|
-
const lockToProject = allowWrite || isAuthGatedResource(resource);
|
|
22
|
-
// Locks the resource to this project (claiming the shared copy if one
|
|
23
|
-
// exists) so its volume is never reused across projects. Unlocked
|
|
24
|
-
// resources resolve to the shared key, untouched — unless this project
|
|
25
|
-
// already holds a claim, which is reused for every later job.
|
|
26
|
-
const resourceKey = this.volumes.resolveResourceKey(resource, project, lockToProject);
|
|
27
|
-
// A project-scoped key must keep carrying its project so a read-only
|
|
28
|
-
// reuse does not clear the claim; the shared key carries none. The key
|
|
29
|
-
// itself is the source of truth here, not this job's lock state.
|
|
30
|
-
const claimedForProject = resourceKey !== createResourceName(resource);
|
|
31
|
-
await this.volumes.createRemoteVolume(resource, controller, resourceKey, claimedForProject ? project : undefined);
|
|
32
|
-
if ((await this.volumes.hasVolume(resource, resourceKey)) === false) {
|
|
33
|
-
throw new Error(`Missing required resource ${createResourceName(resource)}.`);
|
|
34
|
-
}
|
|
35
|
-
mounts.push({
|
|
36
|
-
dest: resource.type === 'Ollama'
|
|
37
|
-
? resource.target === undefined
|
|
38
|
-
? '/root/.ollama/models'
|
|
39
|
-
: resource.target
|
|
40
|
-
: resource.target,
|
|
41
|
-
// There since hasVolume found it.
|
|
42
|
-
name: (await this.volumes.getVolume(resource, resourceKey)),
|
|
43
|
-
readonly: !allowWrite,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return mounts;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* A job's images and remote resources, out of the cache shared by every job
|
|
51
|
-
* on the host: pulled and downloaded here, recorded in `images` and
|
|
52
|
-
* `volumes`' records. A failed download's reasons are written to the op's
|
|
53
|
-
* records as op errors.
|
|
54
|
-
*/
|
|
55
|
-
export function createJobResources(containerOrchestration, images, volumes, store) {
|
|
56
|
-
const resourceVolumes = createLoggingProxy(new ResourceVolumes(volumes), 'ResourceManager');
|
|
57
|
-
const pullImage = async (image, { auth, controller, project } = {}) => {
|
|
58
|
-
// Force a re-pull when a private image is owned by a different project,
|
|
59
|
-
// so this job must re-authenticate against the registry (reusing cached
|
|
60
|
-
// layers) instead of reusing a copy it is not entitled to. The owning
|
|
61
|
-
// project and public images reuse the cache with no pull.
|
|
62
|
-
await containerOrchestration.pullImage(image, auth, controller, images.requiresReauth(image, project));
|
|
63
|
-
// Record the image, tagging it private and owned by this project when it
|
|
64
|
-
// came from an auth-gated registry, so a later job from another project
|
|
65
|
-
// is forced to re-authenticate rather than reuse the cache.
|
|
66
|
-
await images.setImage(image, !!auth, auth ? project : undefined);
|
|
67
|
-
};
|
|
68
|
-
return {
|
|
69
|
-
pullImage,
|
|
70
|
-
async getResourceVolumes(resources, controller, job, project) {
|
|
71
|
-
await pullImage(volumes.resourceManagerImage, { controller });
|
|
72
|
-
try {
|
|
73
|
-
return await resourceVolumes.getResourceVolumes(resources, controller, project);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
if (error instanceof ResourceDownloadError) {
|
|
77
|
-
for (const message of error.reported) {
|
|
78
|
-
store.updateOpStateError(job.id, job.opIndex, {
|
|
79
|
-
event: 'resource-error',
|
|
80
|
-
message,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
throw error;
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An image pull's per-layer progress bars. Its calls are what is reported:
|
|
3
|
-
* the logging proxy carries them to the node's log and the job's.
|
|
4
|
-
*/
|
|
5
|
-
export class MultiProgressBarReporter {
|
|
6
|
-
start(name, optProgressBar) { }
|
|
7
|
-
update(event) { }
|
|
8
|
-
stop(name) {
|
|
9
|
-
return name;
|
|
10
|
-
}
|
|
11
|
-
async completed() { }
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A resource download's progress bar. Its calls are what is reported: the
|
|
3
|
-
* logging proxy carries them to the node's log and the job's.
|
|
4
|
-
*/
|
|
5
|
-
export class ProgressBarReporter {
|
|
6
|
-
async start(name, optProgressBar, total, startValue, payload, progressBarPreset) { }
|
|
7
|
-
async update(current, payload) { }
|
|
8
|
-
async stop(name) {
|
|
9
|
-
return name;
|
|
10
|
-
}
|
|
11
|
-
async completed() { }
|
|
12
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The image and resource cache's records: the node keeps them, a job's
|
|
3
|
-
* sidecar works on a copy of them (see FileResourceRecords) and hands back
|
|
4
|
-
* what it changed.
|
|
5
|
-
*/
|
|
6
|
-
export type ResourceHistory = {
|
|
7
|
-
lastUsed: Date;
|
|
8
|
-
usage: number;
|
|
9
|
-
required: boolean;
|
|
10
|
-
isPrivate?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* The project a resource is scoped to when it must not be shared freely
|
|
13
|
-
* across projects. Absent on shared, public resources.
|
|
14
|
-
*
|
|
15
|
-
* For a volume it is set once the resource is mounted writable (`allowWrite`)
|
|
16
|
-
* or fetched from an auth-gated remote: a writable mount can leave the job's
|
|
17
|
-
* own bytes behind, and an auth-gated resource is private to the credentials
|
|
18
|
-
* that fetched it, so the volume is keyed by project and never reused by
|
|
19
|
-
* another — a different project falls through to a clean copy of its own.
|
|
20
|
-
*
|
|
21
|
-
* For a private image it is the project the image was last pulled for. The
|
|
22
|
-
* daemon holds one copy per image reference, so this gates reuse rather than
|
|
23
|
-
* separating storage: a job from a different project must re-authenticate
|
|
24
|
-
* (forcing a pull) before it may reuse the cached copy.
|
|
25
|
-
*/
|
|
26
|
-
project?: string;
|
|
27
|
-
};
|
|
28
|
-
export type VolumeResource = ResourceHistory & {
|
|
29
|
-
volume: string;
|
|
30
|
-
/**
|
|
31
|
-
* True from the moment the Docker volume is created until its download
|
|
32
|
-
* completes. The entry is written before the download starts so that a
|
|
33
|
-
* crash mid-download cannot orphan the volume: a pending entry is resynced
|
|
34
|
-
* when its resource is requested again, and expired like any other entry
|
|
35
|
-
* otherwise. Absent on entries written before this field existed.
|
|
36
|
-
*/
|
|
37
|
-
pending?: boolean;
|
|
38
|
-
};
|
|
39
|
-
/** What the cache code reads and writes of the records. */
|
|
40
|
-
export interface ResourceRecords {
|
|
41
|
-
getImageResource(image: string): ResourceHistory | undefined;
|
|
42
|
-
updateImageResource(image: string, fields: Partial<ResourceHistory>): void;
|
|
43
|
-
getVolumeResource(key: string): VolumeResource | undefined;
|
|
44
|
-
updateVolumeResource(key: string, fields: Partial<VolumeResource>): void;
|
|
45
|
-
deleteVolumeResource(key: string): void;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* The node's records as a job starts, and which of them the market requires
|
|
49
|
-
* (shared by every project on the market, and never expired).
|
|
50
|
-
*/
|
|
51
|
-
export interface ResourceCacheSnapshot {
|
|
52
|
-
images: Record<string, ResourceHistory>;
|
|
53
|
-
volumes: Record<string, VolumeResource>;
|
|
54
|
-
marketImages: string[];
|
|
55
|
-
/** Resource keys (createResourceName), not the resources: no credentials. */
|
|
56
|
-
marketVolumes: string[];
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* What a job changed in the records: each entry it wrote, whole, and `null`
|
|
60
|
-
* for each volume entry it deleted. The node writes them back once the job is
|
|
61
|
-
* over, stamped as used then.
|
|
62
|
-
*/
|
|
63
|
-
export interface ResourceCacheChanges {
|
|
64
|
-
version: number;
|
|
65
|
-
images: Record<string, ResourceHistory>;
|
|
66
|
-
volumes: Record<string, VolumeResource | null>;
|
|
67
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type JobRuntimeConsole } from '../host/contract.js';
|
|
2
|
-
import type { LogStream } from './streams.js';
|
|
3
|
-
type PhaseType = 'process' | 'success' | 'info' | 'error';
|
|
4
|
-
/**
|
|
5
|
-
* The sidecar's counterpart of the node's NodeLog, for its one job: the
|
|
6
|
-
* logging proxy's traces of the job's phases (its pulls and downloads and
|
|
7
|
-
* their progress among them) become `/log` entries and `system` lines in `/flog`, and the phase lines go to the
|
|
8
|
-
* console, which is the container's log. With an `entries` console every
|
|
9
|
-
* entry goes there instead, whole, for `nosana node run` to render.
|
|
10
|
-
*/
|
|
11
|
-
export declare class RuntimeLog {
|
|
12
|
-
private readonly job;
|
|
13
|
-
private readonly stream;
|
|
14
|
-
private readonly consoleOutput;
|
|
15
|
-
private readonly onLog;
|
|
16
|
-
constructor(job: string, stream: LogStream, consoleOutput?: JobRuntimeConsole);
|
|
17
|
-
close(): void;
|
|
18
|
-
/** A phase of the job's own lifecycle (resolving, validating, publishing). */
|
|
19
|
-
phase(type: PhaseType, message: string): void;
|
|
20
|
-
private process;
|
|
21
|
-
/** Into `/log`, and onto an `entries` console as one marked line. */
|
|
22
|
-
private push;
|
|
23
|
-
/** The node's NodeLog.addFlog: a `system` line in the task's `/flog`. */
|
|
24
|
-
private addFlog;
|
|
25
|
-
}
|
|
26
|
-
export {};
|