1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

add default compute environment options

This commit is contained in:
Matthias Kretschmann 2021-11-29 15:57:12 +00:00
parent 3aa739fce0
commit 8a60aaf3f5
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 19 additions and 15 deletions

View File

@ -89,7 +89,7 @@ export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [
image: 'node', image: 'node',
tag: 'latest', tag: 'latest',
entrypoint: 'node $ALGO', entrypoint: 'node $ALGO',
checksum: '' // TODO: how to get? checksum: '' // TODO: how to get? Most likely needs to be fetched from DockerHub.
}, },
{ {
image: 'python', image: 'python',
@ -98,3 +98,16 @@ export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [
checksum: '' checksum: ''
} }
] ]
export const computeEnvironmentDefaults: ServiceComputeOptions = {
namespace: 'ocean-compute',
cpu: 1,
gpu: 0,
gpuType: '',
memory: '1Gb',
volumeSize: '1Gb',
allowRawAlgorithm: false,
allowNetworkAccess: true,
publisherTrustedAlgorithmPublishers: null,
publisherTrustedAlgorithms: null
}

View File

@ -2,7 +2,10 @@ import { mapTimeoutStringToSeconds } from '@utils/ddo'
import { getEncryptedFileUrls } from '@utils/provider' import { getEncryptedFileUrls } from '@utils/provider'
import { sha256 } from 'js-sha256' import { sha256 } from 'js-sha256'
import slugify from 'slugify' import slugify from 'slugify'
import { algorithmContainerPresets } from './_constants' import {
algorithmContainerPresets,
computeEnvironmentDefaults
} from './_constants'
import { FormPublishData } from './_types' import { FormPublishData } from './_types'
export function getFieldContent( export function getFieldContent(
@ -129,19 +132,7 @@ export async function transformPublishFormToDdo(
serviceEndpoint: providerUrl.url, serviceEndpoint: providerUrl.url,
timeout: mapTimeoutStringToSeconds(timeout), timeout: mapTimeoutStringToSeconds(timeout),
...(access === 'compute' && { ...(access === 'compute' && {
// TODO: get all the default values we want to send here. compute: computeEnvironmentDefaults
compute: {
namespace: 'ocean-compute',
cpu: 1,
gpu: 1,
gpuType: '',
memory: '',
volumeSize: '',
allowRawAlgorithm: false,
allowNetworkAccess: false,
publisherTrustedAlgorithmPublishers: null,
publisherTrustedAlgorithms: null
}
}) })
} }