From 127e0f78f20c2e036b47132d89882ec109183c9f Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Wed, 19 Jun 2024 12:01:54 +0100 Subject: [PATCH 1/9] support for legacy field name --- src/components/httpRoutes/compute.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/httpRoutes/compute.ts b/src/components/httpRoutes/compute.ts index 130dbaf9f..22696bea4 100644 --- a/src/components/httpRoutes/compute.ts +++ b/src/components/httpRoutes/compute.ts @@ -143,7 +143,7 @@ computeRoutes.get(`${SERVICES_API_BASE_PATH}/compute`, async (req, res) => { command: PROTOCOL_COMMANDS.COMPUTE_GET_STATUS, node: (req.query.node as string) || null, consumerAddress: (req.query.consumerAddress as string) || null, - did: (req.query.did as string) || null, + did: (req.query.did as string) || (req.query.documentId as string) || null, jobId: (req.query.jobId as string) || null } const response = await new ComputeGetStatusHandler(req.oceanNode).handle( From 254aba263dd338592397729747a093e639f52a8a Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Wed, 19 Jun 2024 14:53:29 +0100 Subject: [PATCH 2/9] some fixes on fields names, call to get status --- src/@types/commands.ts | 3 ++- src/components/core/compute/getStatus.ts | 2 +- src/components/httpRoutes/compute.ts | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/@types/commands.ts b/src/@types/commands.ts index d9be897be..3082e6ae5 100644 --- a/src/@types/commands.ts +++ b/src/@types/commands.ts @@ -173,8 +173,9 @@ export interface ComputeGetResultCommand extends Command { export interface ComputeGetStatusCommand extends Command { consumerAddress?: string - did?: string + did?: string // TODO is this needed? jobId?: string + agreementId?: string } export interface ValidateChainId { diff --git a/src/components/core/compute/getStatus.ts b/src/components/core/compute/getStatus.ts index 23682e27d..d55b7a8c1 100644 --- a/src/components/core/compute/getStatus.ts +++ b/src/components/core/compute/getStatus.ts @@ -54,7 +54,7 @@ export class ComputeGetStatusHandler extends Handler { const engine = await C2DEngine.getC2DByHash(cluster.hash) const jobs = await engine.getComputeJobStatus( task.consumerAddress, - task.did, + task.agreementId, jobId ) response.push(...jobs) diff --git a/src/components/httpRoutes/compute.ts b/src/components/httpRoutes/compute.ts index 22696bea4..1f901f48e 100644 --- a/src/components/httpRoutes/compute.ts +++ b/src/components/httpRoutes/compute.ts @@ -143,8 +143,10 @@ computeRoutes.get(`${SERVICES_API_BASE_PATH}/compute`, async (req, res) => { command: PROTOCOL_COMMANDS.COMPUTE_GET_STATUS, node: (req.query.node as string) || null, consumerAddress: (req.query.consumerAddress as string) || null, + // TODO: is any of these 2 really needed? did: (req.query.did as string) || (req.query.documentId as string) || null, - jobId: (req.query.jobId as string) || null + jobId: (req.query.jobId as string) || null, + agreementId: (req.query.agreementId as string) || null } const response = await new ComputeGetStatusHandler(req.oceanNode).handle( statusComputeTask From 16621ff7300af467e33d0b92c706c3db33d4aa84 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Wed, 19 Jun 2024 15:12:03 +0100 Subject: [PATCH 3/9] rm did and documentId, the field should be agreementId instead --- src/@types/commands.ts | 2 +- src/components/core/compute/getStatus.ts | 4 ++-- src/components/httpRoutes/compute.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/@types/commands.ts b/src/@types/commands.ts index 3082e6ae5..c80527363 100644 --- a/src/@types/commands.ts +++ b/src/@types/commands.ts @@ -173,7 +173,7 @@ export interface ComputeGetResultCommand extends Command { export interface ComputeGetStatusCommand extends Command { consumerAddress?: string - did?: string // TODO is this needed? + // did?: string // TODO is this needed? jobId?: string agreementId?: string } diff --git a/src/components/core/compute/getStatus.ts b/src/components/core/compute/getStatus.ts index d55b7a8c1..378e31800 100644 --- a/src/components/core/compute/getStatus.ts +++ b/src/components/core/compute/getStatus.ts @@ -21,8 +21,8 @@ export class ComputeGetStatusHandler extends Handler { return buildInvalidRequestMessage( 'Parameter : "consumerAddress" is not a valid web3 address' ) - } else if (!command.consumerAddress && !command.jobId && !command.did) { - const error = 'Missing jobId or consumerAddress or did' + } else if (!command.consumerAddress && !command.jobId && !command.agreementId) { + const error = 'Missing "jobId" or "consumerAddress" or "agreementId"' CORE_LOGGER.logMessage(error, true) return buildInvalidRequestMessage(error) } diff --git a/src/components/httpRoutes/compute.ts b/src/components/httpRoutes/compute.ts index 1f901f48e..160423636 100644 --- a/src/components/httpRoutes/compute.ts +++ b/src/components/httpRoutes/compute.ts @@ -144,7 +144,7 @@ computeRoutes.get(`${SERVICES_API_BASE_PATH}/compute`, async (req, res) => { node: (req.query.node as string) || null, consumerAddress: (req.query.consumerAddress as string) || null, // TODO: is any of these 2 really needed? - did: (req.query.did as string) || (req.query.documentId as string) || null, + // did: (req.query.did as string) || (req.query.documentId as string) || null, jobId: (req.query.jobId as string) || null, agreementId: (req.query.agreementId as string) || null } From 9a0ac280dd52fbe46a6809f5c29a3a2b58c1dfb2 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Wed, 19 Jun 2024 15:27:35 +0100 Subject: [PATCH 4/9] put it back, need more thinking --- src/@types/commands.ts | 2 +- src/components/core/compute/getStatus.ts | 10 ++++++++-- src/components/httpRoutes/compute.ts | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/@types/commands.ts b/src/@types/commands.ts index c80527363..3082e6ae5 100644 --- a/src/@types/commands.ts +++ b/src/@types/commands.ts @@ -173,7 +173,7 @@ export interface ComputeGetResultCommand extends Command { export interface ComputeGetStatusCommand extends Command { consumerAddress?: string - // did?: string // TODO is this needed? + did?: string // TODO is this needed? jobId?: string agreementId?: string } diff --git a/src/components/core/compute/getStatus.ts b/src/components/core/compute/getStatus.ts index 378e31800..3f346c0b5 100644 --- a/src/components/core/compute/getStatus.ts +++ b/src/components/core/compute/getStatus.ts @@ -21,8 +21,13 @@ export class ComputeGetStatusHandler extends Handler { return buildInvalidRequestMessage( 'Parameter : "consumerAddress" is not a valid web3 address' ) - } else if (!command.consumerAddress && !command.jobId && !command.agreementId) { - const error = 'Missing "jobId" or "consumerAddress" or "agreementId"' + } else if ( + !command.consumerAddress && + !command.jobId && + !command.did && + !command.agreementId + ) { + const error = 'Missing one of ["jobId","consumerAddress","did","agreementId"]' CORE_LOGGER.logMessage(error, true) return buildInvalidRequestMessage(error) } @@ -50,6 +55,7 @@ export class ComputeGetStatusHandler extends Handler { allC2dClusters = allC2dClusters.filter((arr) => arr.hash === hash) jobId = task.jobId.slice(index + 1) } + // TODO check for (const cluster of allC2dClusters) { const engine = await C2DEngine.getC2DByHash(cluster.hash) const jobs = await engine.getComputeJobStatus( diff --git a/src/components/httpRoutes/compute.ts b/src/components/httpRoutes/compute.ts index 160423636..1f901f48e 100644 --- a/src/components/httpRoutes/compute.ts +++ b/src/components/httpRoutes/compute.ts @@ -144,7 +144,7 @@ computeRoutes.get(`${SERVICES_API_BASE_PATH}/compute`, async (req, res) => { node: (req.query.node as string) || null, consumerAddress: (req.query.consumerAddress as string) || null, // TODO: is any of these 2 really needed? - // did: (req.query.did as string) || (req.query.documentId as string) || null, + did: (req.query.did as string) || (req.query.documentId as string) || null, jobId: (req.query.jobId as string) || null, agreementId: (req.query.agreementId as string) || null } From 0f4261c228b0aebaed62f22bd011a51502140c18 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Wed, 19 Jun 2024 16:20:04 +0100 Subject: [PATCH 5/9] fix tests, refactor field --- src/@types/commands.ts | 1 - src/components/core/compute/getStatus.ts | 9 ++------- src/components/httpRoutes/compute.ts | 2 -- src/test/integration/compute.test.ts | 4 ++-- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/@types/commands.ts b/src/@types/commands.ts index 3082e6ae5..8d6efbbe4 100644 --- a/src/@types/commands.ts +++ b/src/@types/commands.ts @@ -173,7 +173,6 @@ export interface ComputeGetResultCommand extends Command { export interface ComputeGetStatusCommand extends Command { consumerAddress?: string - did?: string // TODO is this needed? jobId?: string agreementId?: string } diff --git a/src/components/core/compute/getStatus.ts b/src/components/core/compute/getStatus.ts index 3f346c0b5..551b4e89c 100644 --- a/src/components/core/compute/getStatus.ts +++ b/src/components/core/compute/getStatus.ts @@ -21,13 +21,8 @@ export class ComputeGetStatusHandler extends Handler { return buildInvalidRequestMessage( 'Parameter : "consumerAddress" is not a valid web3 address' ) - } else if ( - !command.consumerAddress && - !command.jobId && - !command.did && - !command.agreementId - ) { - const error = 'Missing one of ["jobId","consumerAddress","did","agreementId"]' + } else if (!command.consumerAddress && !command.jobId && !command.agreementId) { + const error = 'Missing one of ["jobId","consumerAddress","agreementId"]' CORE_LOGGER.logMessage(error, true) return buildInvalidRequestMessage(error) } diff --git a/src/components/httpRoutes/compute.ts b/src/components/httpRoutes/compute.ts index 1f901f48e..f78cac533 100644 --- a/src/components/httpRoutes/compute.ts +++ b/src/components/httpRoutes/compute.ts @@ -143,8 +143,6 @@ computeRoutes.get(`${SERVICES_API_BASE_PATH}/compute`, async (req, res) => { command: PROTOCOL_COMMANDS.COMPUTE_GET_STATUS, node: (req.query.node as string) || null, consumerAddress: (req.query.consumerAddress as string) || null, - // TODO: is any of these 2 really needed? - did: (req.query.did as string) || (req.query.documentId as string) || null, jobId: (req.query.jobId as string) || null, agreementId: (req.query.agreementId as string) || null } diff --git a/src/test/integration/compute.test.ts b/src/test/integration/compute.test.ts index dba83dad7..216119dc3 100644 --- a/src/test/integration/compute.test.ts +++ b/src/test/integration/compute.test.ts @@ -571,7 +571,7 @@ describe('Compute', () => { const statusComputeTask: ComputeGetStatusCommand = { command: PROTOCOL_COMMANDS.COMPUTE_GET_STATUS, consumerAddress: null, - did: null, + agreementId: null, jobId } const response = await new ComputeGetStatusHandler(oceanNode).handle( @@ -589,7 +589,7 @@ describe('Compute', () => { const statusComputeTask: ComputeGetStatusCommand = { command: PROTOCOL_COMMANDS.COMPUTE_GET_STATUS, consumerAddress: wallet.address, - did: null, + agreementId: null, jobId: null } const response = await new ComputeGetStatusHandler(oceanNode).handle( From 15a300c668a281009f2c3ce9b62782a58eb23863 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Fri, 28 Jun 2024 11:09:23 +0100 Subject: [PATCH 6/9] remove TODO --- src/components/core/compute/getStatus.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/core/compute/getStatus.ts b/src/components/core/compute/getStatus.ts index 551b4e89c..f29c8018a 100644 --- a/src/components/core/compute/getStatus.ts +++ b/src/components/core/compute/getStatus.ts @@ -50,7 +50,7 @@ export class ComputeGetStatusHandler extends Handler { allC2dClusters = allC2dClusters.filter((arr) => arr.hash === hash) jobId = task.jobId.slice(index + 1) } - // TODO check + for (const cluster of allC2dClusters) { const engine = await C2DEngine.getC2DByHash(cluster.hash) const jobs = await engine.getComputeJobStatus( From 89a276236e3c0ec6b20ff69ba169f4ce83211047 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 16 Sep 2024 09:08:41 +0100 Subject: [PATCH 7/9] fix ci deprecated versions --- .github/workflows/ci.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38d27dbed..4e8ed8a0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,12 +15,12 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 'v20.16.0' - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -33,7 +33,7 @@ jobs: dockertest: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: docker build -t 'ocean-node:mybuild' . build: @@ -46,12 +46,12 @@ jobs: node: ['18.20.4', 'v20.16.0', 'v22.5.1'] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -64,12 +64,12 @@ jobs: test_unit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 'v20.16.0' - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -97,12 +97,12 @@ jobs: test_integration: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 'v20.16.0' - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -183,15 +183,15 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: 'v20.16.0' - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -253,7 +253,7 @@ jobs: if: ${{ failure() }} - name: Checkout Ocean Node - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: 'oceanprotocol/ocean-node' path: 'ocean-node' @@ -291,7 +291,7 @@ jobs: echo "Ocean Node did not start in time" exit 1 - name: Checkout Ocean CLI - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: 'oceanprotocol/ocean-cli' path: 'ocean-cli' From b38f03ae0ac9da5a9c8be26c511ead7652385307 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 16 Sep 2024 09:14:17 +0100 Subject: [PATCH 8/9] fix ci deprecated versions --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e8ed8a0b..3a1238597 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,7 +89,7 @@ jobs: DB_URL: 'http://localhost:8108/?apiKey=xyz' FEE_TOKENS: '{ "1": "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", "137": "0x282d8efCe846A88B159800bd4130ad77443Fa1A1", "80001": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8", "56": "0xDCe07662CA8EbC241316a15B611c89711414Dd1a" }' FEE_AMOUNT: '{ "amount": 1, "unit": "MB" }' - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: coverage path: coverage/ From 734a33e6ec68e98d2f22c91d4b2c318691812919 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 16 Sep 2024 09:14:37 +0100 Subject: [PATCH 9/9] fix ci deprecated versions --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a1238597..8341aac1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -173,7 +173,7 @@ jobs: - name: docker logs run: docker logs ocean-ocean-contracts-1 && docker logs ocean-kindcluster-1 && docker logs ocean-computetodata-1 && docker logs ocean-typesense-1 if: ${{ failure() }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: coverage path: coverage/