From 8a60aaf3f5091b3c7e46190d176c89634a23d025 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann <m@kretschmann.io> Date: Mon, 29 Nov 2021 15:57:12 +0000 Subject: [PATCH] add default compute environment options --- src/components/Publish/_constants.tsx | 15 ++++++++++++++- src/components/Publish/_utils.ts | 19 +++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/Publish/_constants.tsx b/src/components/Publish/_constants.tsx index 359b188ac..4ed088420 100644 --- a/src/components/Publish/_constants.tsx +++ b/src/components/Publish/_constants.tsx @@ -89,7 +89,7 @@ export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [ image: 'node', tag: 'latest', entrypoint: 'node $ALGO', - checksum: '' // TODO: how to get? + checksum: '' // TODO: how to get? Most likely needs to be fetched from DockerHub. }, { image: 'python', @@ -98,3 +98,16 @@ export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [ 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 +} diff --git a/src/components/Publish/_utils.ts b/src/components/Publish/_utils.ts index 3439758ca..932611d05 100644 --- a/src/components/Publish/_utils.ts +++ b/src/components/Publish/_utils.ts @@ -2,7 +2,10 @@ import { mapTimeoutStringToSeconds } from '@utils/ddo' import { getEncryptedFileUrls } from '@utils/provider' import { sha256 } from 'js-sha256' import slugify from 'slugify' -import { algorithmContainerPresets } from './_constants' +import { + algorithmContainerPresets, + computeEnvironmentDefaults +} from './_constants' import { FormPublishData } from './_types' export function getFieldContent( @@ -129,19 +132,7 @@ export async function transformPublishFormToDdo( serviceEndpoint: providerUrl.url, timeout: mapTimeoutStringToSeconds(timeout), ...(access === 'compute' && { - // TODO: get all the default values we want to send here. - compute: { - namespace: 'ocean-compute', - cpu: 1, - gpu: 1, - gpuType: '', - memory: '', - volumeSize: '', - allowRawAlgorithm: false, - allowNetworkAccess: false, - publisherTrustedAlgorithmPublishers: null, - publisherTrustedAlgorithms: null - } + compute: computeEnvironmentDefaults }) }