Skip to content

Commit bbc5656

Browse files
committed
fix status detailed flag
1 parent ed2a82d commit bbc5656

3 files changed

Lines changed: 8 additions & 20 deletions

File tree

docs/env.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Environmental variables are also tracked in `ENVIRONMENT_VARIABLES` within `src/
127127

128128
## Compute
129129

130-
- `C2D_DOWNLOAD_TIMEOUT`: Per-file timeout (in seconds) for downloading the algorithm and each input asset during a C2D job. If a download exceeds this timeout, the job fails instead of getting stuck. Defaults to `900` (15 minutes). Example: `900`
130+
- `C2D_DOWNLOAD_TIMEOUT`: Timeout (in seconds) for pulling the algorithm docker image during a C2D job. If the pull exceeds this timeout, the job fails with `PullImageFailed` instead of getting stuck. Defaults to `900` (15 minutes). Example: `900`
131131

132132
The `DOCKER_COMPUTE_ENVIRONMENTS` environment variable is used to configure Docker-based compute environments in Ocean Node. This guide will walk you through the options available for defining `DOCKER_COMPUTE_ENVIRONMENTS` and how to set it up correctly. For configuring compute environments and setting prices for each resource (including pricing units and examples), see [Compute pricing](compute-pricing.md).
133133

src/components/c2d/compute_engine_docker.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ export class C2DEngineDocker extends C2DEngine {
16951695
}
16961696
}
16971697

1698-
private getDownloadTimeoutMs(): number {
1698+
private getImagePullTimeoutMs(): number {
16991699
const raw = ENVIRONMENT_VARIABLES.C2D_DOWNLOAD_TIMEOUT.value
17001700
const parsed = raw ? parseInt(raw, 10) : NaN
17011701
if (Number.isFinite(parsed) && parsed > 0) {
@@ -1704,22 +1704,6 @@ export class C2DEngineDocker extends C2DEngine {
17041704
return 15 * 60 * 1000
17051705
}
17061706

1707-
private async pipelineWithDownloadTimeout(
1708-
source: NodeJS.ReadableStream,
1709-
destination: NodeJS.WritableStream
1710-
): Promise<void> {
1711-
const timeoutMs = this.getDownloadTimeoutMs()
1712-
const controller = new AbortController()
1713-
const timer = setTimeout(() => {
1714-
controller.abort(new Error(`Download timed out after ${timeoutMs / 1000}s`))
1715-
}, timeoutMs)
1716-
try {
1717-
await pipeline(source, destination, { signal: controller.signal })
1718-
} finally {
1719-
clearTimeout(timer)
1720-
}
1721-
}
1722-
17231707
// eslint-disable-next-line require-await
17241708
private async processJob(job: DBComputeJob) {
17251709
CORE_LOGGER.info(
@@ -2573,6 +2557,7 @@ export class C2DEngineDocker extends C2DEngine {
25732557
)
25742558
}
25752559

2560+
pullOptions.abortSignal = AbortSignal.timeout(this.getImagePullTimeoutMs())
25762561
const pullStream = await this.docker.pull(job.containerImage, pullOptions)
25772562
await new Promise((resolve, reject) => {
25782563
let wroteStatusBanner = false
@@ -2909,7 +2894,7 @@ export class C2DEngineDocker extends C2DEngine {
29092894
}
29102895

29112896
if (storage) {
2912-
await this.pipelineWithDownloadTimeout(
2897+
await pipeline(
29132898
(await storage.getReadableStream()).stream,
29142899
createWriteStream(fullAlgoPath)
29152900
)
@@ -3018,7 +3003,7 @@ export class C2DEngineDocker extends C2DEngine {
30183003
const fullPath = jobFolderPath + '/data/inputs/' + fileInfo[0].name
30193004
appendFileSync(configLogPath, `Downloading asset to ${fullPath}\n`)
30203005
try {
3021-
await this.pipelineWithDownloadTimeout(
3006+
await pipeline(
30223007
(await storage.getReadableStream()).stream,
30233008
createWriteStream(fullPath)
30243009
)

src/components/core/utils/statusHandler.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ export async function status(
170170
CORE_LOGGER.log(LOG_LEVELS_STR.LEVEL_ERROR, `Error getting c2d clusters: ${error}`)
171171
}
172172
nodeStatus.supportedSchemas = typesenseSchemas.ddoSchemas
173+
} else {
174+
delete nodeStatus.c2dClusters
175+
delete nodeStatus.supportedSchemas
173176
}
174177

175178
if (config.persistentStorage) {

0 commit comments

Comments
 (0)