Skip to content

Commit

Permalink
complete checkfor platform and arch if present on manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ocean committed Dec 3, 2024
1 parent 2584990 commit 21632b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/components/core/compute/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,13 @@ export class ComputeInitializeHandler extends Handler {
if (hasDockerImages) {
const algoImage = getAlgorithmImage(task.algorithm)
if (algoImage) {
const validation: ValidateParams =
await C2DEngineDocker.checkDockerImage(algoImage)
const env = await this.getOceanNode()
.getC2DEngines()
.getExactComputeEnv(task.compute.env, ddo.chainId)
const validation: ValidateParams = await C2DEngineDocker.checkDockerImage(
algoImage,
env.platform
)
if (!validation.valid) {
return {
stream: null,
Expand Down
6 changes: 3 additions & 3 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ function getDockerFreeComputeOptions(
feeToken: ZeroAddress,
chainId: 8996,
free: true,
platform: [{ architecture: os.machine(), os: os.platform() }]
platform: { architecture: os.machine(), os: os.platform() }
}

if (existsEnvironmentVariable(ENVIRONMENT_VARIABLES.DOCKER_FREE_COMPUTE, isStartup)) {
Expand All @@ -411,7 +411,7 @@ function getDockerFreeComputeOptions(
) as ComputeEnvironmentBaseConfig
doComputeEnvChecks([options])
const env = { ...options } as ComputeEnvironment
env.platform = [{ architecture: os.machine(), os: os.platform() }]
env.platform = { architecture: os.machine(), os: os.platform() }
return env
} catch (error) {
CONFIG_LOGGER.logMessageWithEmoji(
Expand Down Expand Up @@ -462,7 +462,7 @@ function getDockerComputeEnvironments(isStartup?: boolean): ComputeEnvironment[]
doComputeEnvChecks(options)
const envs = { ...options } as ComputeEnvironment[]
envs.forEach((env) => {
env.platform = [{ architecture: os.machine(), os: os.platform() }]
env.platform = { architecture: os.machine(), os: os.platform() }
})
return envs
} catch (error) {
Expand Down

0 comments on commit 21632b9

Please sign in to comment.