From d5fbd1a183a03c746472b06e12eb30f49f3e44bb Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 20 Jan 2025 15:30:11 +0000 Subject: [PATCH 1/4] wip: updating the compute env spces --- src/@types/Compute.ts | 58 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/src/@types/Compute.ts b/src/@types/Compute.ts index 85b5b123b..93a3b4515 100644 --- a/src/@types/Compute.ts +++ b/src/@types/Compute.ts @@ -6,16 +6,58 @@ export type ComputeResultType = | 'configrationLog' | 'publishLog' +// OLD V1 ComputeEnvironment specs +// export interface ComputeEnvironment { +// id: string +// cpuNumber: number +// cpuType: string +// gpuNumber: number +// gpuType: string +// ramGB: number +// diskGB: number +// priceMin: number +// desc: string +// currentJobs: number +// maxJobs: number +// consumerAddress: string +// storageExpiry: number +// maxJobDuration: number +// lastSeen: number +// free: boolean +// } + +// new V2 C2D Compute Environment specs + +export type ComputeResourceType = 'cpu' | 'memory' | 'storage' + +export interface ComputeResourcesPricingInfo { + type: ComputeResourceType + price: number +} +export interface ComputeEnvFees { + feeToken: string + prices: ComputeResourcesPricingInfo[] +} +export interface ComputeEnvFeesStructure { + [chainId: string]: ComputeEnvFees +} export interface ComputeEnvironment { id: string - cpuNumber: number - cpuType: string - gpuNumber: number - gpuType: string - ramGB: number - diskGB: number - priceMin: number - desc: string + // cpuNumber: number + // cpuType: string + // gpuNumber: number + // gpuType: string + // ramGB: number + // diskGB: number + // priceMin: number + totalCpu: number // total cpu available for jobs + maxCpu: number // max cpu for a single job. Imagine a K8 cluster with two nodes, each node with 10 cpus. Total=20, but at most you can allocate 10 cpu for a job + totalRam: number // total gb of RAM + maxRam: number // max allocatable GB RAM for a single job. + maxDisk: number // max GB of disck allocatable for a single job + fees: ComputeEnvFeesStructure + // legacy + description: string currentJobs: number maxJobs: number consumerAddress: string From b272ef68da6479f064556084ec81a1d46a140b31 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Tue, 21 Jan 2025 10:51:39 +0000 Subject: [PATCH 2/4] wip: update specs and docs --- docs/interfaces/ComputeEnvironment.md | 89 +++++++++++++++------------ src/@types/Compute.ts | 6 ++ 2 files changed, 56 insertions(+), 39 deletions(-) diff --git a/docs/interfaces/ComputeEnvironment.md b/docs/interfaces/ComputeEnvironment.md index 52997d032..a43ac78a0 100644 --- a/docs/interfaces/ComputeEnvironment.md +++ b/docs/interfaces/ComputeEnvironment.md @@ -7,20 +7,21 @@ ### Properties - [consumerAddress](ComputeEnvironment.md#consumeraddress) -- [cpuNumber](ComputeEnvironment.md#cpunumber) -- [cpuType](ComputeEnvironment.md#cputype) +- [totalCpu](ComputeEnvironment.md#totalCpu) +- [maxCpu](ComputeEnvironment.md#maxCpu) +- [totalRam](ComputeEnvironment.md#totalRam) +- [maxRam](ComputeEnvironment.md#maxRam) +- [maxDisk](ComputeEnvironment.md#maxDisk) - [currentJobs](ComputeEnvironment.md#currentjobs) -- [desc](ComputeEnvironment.md#desc) -- [diskGB](ComputeEnvironment.md#diskgb) -- [gpuNumber](ComputeEnvironment.md#gpunumber) -- [gpuType](ComputeEnvironment.md#gputype) +- [description](ComputeEnvironment.md#description) +- [fees](ComputeEnvironment.md#ComputeEnvFeesStructure) - [id](ComputeEnvironment.md#id) - [lastSeen](ComputeEnvironment.md#lastseen) - [maxJobDuration](ComputeEnvironment.md#maxjobduration) - [maxJobs](ComputeEnvironment.md#maxjobs) -- [priceMin](ComputeEnvironment.md#pricemin) -- [ramGB](ComputeEnvironment.md#ramgb) - [storageExpiry](ComputeEnvironment.md#storageexpiry) +- [lastSeen](ComputeEnvironment.md#lastSeen) +- [free](ComputeEnvironment.md#free) ## Properties @@ -30,27 +31,27 @@ #### Defined in -[@types/Compute.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L21) +[@types/Compute.ts:68](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L68) ___ -### cpuNumber +### totalCpu -• **cpuNumber**: `number` +• **totalCpu**: `number` #### Defined in -[@types/Compute.ts:11](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L11) +[@types/Compute.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L58) ___ -### cpuType +### maxCpu -• **cpuType**: `string` +• **maxCpu**: `number` #### Defined in -[@types/Compute.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L12) +[@types/Compute.ts:59](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L59) ___ @@ -60,47 +61,47 @@ ___ #### Defined in -[@types/Compute.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L19) +[@types/Compute.ts:66](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L66) ___ -### desc +### description -• **desc**: `string` +• **description**: `string` #### Defined in -[@types/Compute.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L18) +[@types/Compute.ts:65](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L65) ___ -### diskGB +### maxDisk -• **diskGB**: `number` +• **maxDisk**: `number` #### Defined in -[@types/Compute.ts:16](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L16) +[@types/Compute.ts:62](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L62) ___ -### gpuNumber +### maxRam -• **gpuNumber**: `number` +• **maxRam**: `number` #### Defined in -[@types/Compute.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L13) +[@types/Compute.ts:61](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L61) ___ -### gpuType +### totalRam -• **gpuType**: `string` +• **totalRam**: `number` #### Defined in -[@types/Compute.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L14) +[@types/Compute.ts:60](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L60) ___ @@ -110,7 +111,7 @@ ___ #### Defined in -[@types/Compute.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L10) +[@types/Compute.ts:49](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L49) ___ @@ -120,7 +121,7 @@ ___ #### Defined in -[@types/Compute.ts:24](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L24) +[@types/Compute.ts:71](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L71) ___ @@ -130,7 +131,7 @@ ___ #### Defined in -[@types/Compute.ts:23](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L23) +[@types/Compute.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L70) ___ @@ -140,27 +141,27 @@ ___ #### Defined in -[@types/Compute.ts:20](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L20) +[@types/Compute.ts:67](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L67) ___ -### priceMin +### fees -• **priceMin**: `number` +• **fees**: `ComputeEnvFeesStructure` #### Defined in -[@types/Compute.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L17) +[@types/Compute.ts:63](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L63) ___ -### ramGB +### free -• **ramGB**: `number` +• **free**: `boolean` #### Defined in -[@types/Compute.ts:15](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L15) +[@types/Compute.ts:72](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L72) ___ @@ -170,4 +171,14 @@ ___ #### Defined in -[@types/Compute.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L22) +[@types/Compute.ts:69](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L69) + +___ + +### platform + +• **platform**: `RunningPlatform[]` + +#### Defined in + +[@types/Compute.ts:73](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L73) diff --git a/src/@types/Compute.ts b/src/@types/Compute.ts index 93a3b4515..d6b065f43 100644 --- a/src/@types/Compute.ts +++ b/src/@types/Compute.ts @@ -27,6 +27,10 @@ export type ComputeResultType = // } // new V2 C2D Compute Environment specs +export interface RunningPlatform { + architecture: string + os: string +} export type ComputeResourceType = 'cpu' | 'memory' | 'storage' @@ -43,6 +47,7 @@ export interface ComputeEnvFeesStructure { } export interface ComputeEnvironment { id: string + // legacy // cpuNumber: number // cpuType: string // gpuNumber: number @@ -65,6 +70,7 @@ export interface ComputeEnvironment { maxJobDuration: number lastSeen: number free: boolean + platform?: RunningPlatform[] // array due to k8 support } export interface ComputeResult { From dad53c6dc903d51f87c8c03523a94405ea2d8ead Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Tue, 21 Jan 2025 15:20:04 +0000 Subject: [PATCH 3/4] try add -f flag --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 179f031f4..8664b8006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,12 +119,12 @@ jobs: - run: npm run build:metadata - name: Delete default runner images run: | - docker image rm node:18 - docker image rm node:18-alpine - docker image rm node:20 - docker image rm debian:10 - docker image rm debian:11 - docker image rm moby/buildkit:latest + docker image rm -f node:18 + docker image rm -f node:18-alpine + docker image rm -f node:20 + docker image rm -f debian:10 + docker image rm -f debian:11 + docker image rm -f moby/buildkit:latest - name: Wait for contracts deployment and C2D cluster to be ready working-directory: ${{ github.workspace }}/barge run: | From c5afd5ac2770e8573c3db84b0f6dfda923eaa391 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Tue, 21 Jan 2025 17:34:03 +0000 Subject: [PATCH 4/4] added types docs --- docs/interfaces/ComputeEnvFees.md | 30 +++++++++++++++++++ docs/interfaces/ComputeEnvFeesStructure.md | 20 +++++++++++++ .../interfaces/ComputeResourcesPricingInfo.md | 30 +++++++++++++++++++ docs/interfaces/RunningPlatform.md | 30 +++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 docs/interfaces/ComputeEnvFees.md create mode 100644 docs/interfaces/ComputeEnvFeesStructure.md create mode 100644 docs/interfaces/ComputeResourcesPricingInfo.md create mode 100644 docs/interfaces/RunningPlatform.md diff --git a/docs/interfaces/ComputeEnvFees.md b/docs/interfaces/ComputeEnvFees.md new file mode 100644 index 000000000..af6c71ecc --- /dev/null +++ b/docs/interfaces/ComputeEnvFees.md @@ -0,0 +1,30 @@ +[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeEnvFees + +# Interface: ComputeEnvFees + +## Table of contents + +### Properties + +- [feeToken](ComputeEnvFees.md#feeToken) +- [prices](ComputeEnvFees.md#prices) + +## Properties + +### feeToken + +• **feeToken**: `string` + +#### Defined in + +[@types/Compute.ts:42](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L42) + +___ + +### prices + +• **prices**: `ComputeResourcesPricingInfo`[] + +#### Defined in + +[@types/Compute.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L43) diff --git a/docs/interfaces/ComputeEnvFeesStructure.md b/docs/interfaces/ComputeEnvFeesStructure.md new file mode 100644 index 000000000..069dc662a --- /dev/null +++ b/docs/interfaces/ComputeEnvFeesStructure.md @@ -0,0 +1,20 @@ +[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeEnvFeesStructure + +# Interface: ComputeEnvFeesStructure + +## Table of contents + +### Properties + +- [feeToken](ComputeEnvFeesStructure.md#chainId) + +## Properties + +### chainId + +• **chainId**: `ComputeEnvFees` + +#### Defined in + +[@types/Compute.ts:42](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L46) + diff --git a/docs/interfaces/ComputeResourcesPricingInfo.md b/docs/interfaces/ComputeResourcesPricingInfo.md new file mode 100644 index 000000000..fcf6d6090 --- /dev/null +++ b/docs/interfaces/ComputeResourcesPricingInfo.md @@ -0,0 +1,30 @@ +[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / ComputeResourcesPricingInfo + +# Interface: ComputeResourcesPricingInfo + +## Table of contents + +### Properties + +- [type](ComputeResourcesPricingInfo.md#type) +- [price](ComputeResourcesPricingInfo.md#price) + +## Properties + +### type + +• **type**: `ComputeResourceType` + +#### Defined in + +[@types/Compute.ts:38](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L38) + +___ + +### price + +• **price**: `number` + +#### Defined in + +[@types/Compute.ts:39](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L39) diff --git a/docs/interfaces/RunningPlatform.md b/docs/interfaces/RunningPlatform.md new file mode 100644 index 000000000..e6add7f78 --- /dev/null +++ b/docs/interfaces/RunningPlatform.md @@ -0,0 +1,30 @@ +[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / RunningPlatform + +# Interface: RunningPlatform + +## Table of contents + +### Properties + +- [architecture](RunningPlatform.md#architecture) +- [os](RunningPlatform.md#os) + +## Properties + +### architecture + +• **architecture**: `string` + +#### Defined in + +[@types/Compute.ts:31](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L31) + +___ + +### os + +• **os**: `string` + +#### Defined in + +[@types/Compute.ts:32](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L32)