diff --git a/src/ocean/Compute.ts b/src/ocean/Compute.ts index ab5e196c..145b74cf 100644 --- a/src/ocean/Compute.ts +++ b/src/ocean/Compute.ts @@ -175,7 +175,8 @@ export class Compute extends Instantiable { * Returns information about the status of all compute jobs, or a single compute job. * @param {Account} consumerAccount The account of the consumer ordering the service. * @param {string} did Decentralized identifier. - * @param {string} jobId The ID of the compute job to be stopped + * @param {string} jobId The jobId of the compute job + * @param {string} jobId The Order transaction id * @param {boolean} sign If the provider request is going to be signed(default) (full status) or not (short status) * @return {Promise} Returns the status */ @@ -183,6 +184,7 @@ export class Compute extends Instantiable { consumerAccount: Account, did?: string, jobId?: string, + txId?: string, sign = true ): Promise { let provider: Provider @@ -204,7 +206,7 @@ export class Compute extends Instantiable { undefined, jobId, undefined, - undefined, + txId, undefined, undefined, undefined, diff --git a/src/provider/Provider.ts b/src/provider/Provider.ts index fd3d5757..7ebc2e38 100644 --- a/src/provider/Provider.ts +++ b/src/provider/Provider.ts @@ -195,7 +195,7 @@ export class Provider extends Instantiable { '' url += (jobId && `&jobId=${jobId}`) || '' url += `&consumerAddress=${address}` - url += `&transferTxId=${txId}` || '' + url += (txId && `&transferTxId=${txId}`) || '' url += (algorithmTransferTxId && `&algorithmTransferTxId=${algorithmTransferTxId}`) || '' url += (algorithmDataToken && `&algorithmDataToken=${algorithmDataToken}`) || '' diff --git a/test/integration/ComputeFlow.test.ts b/test/integration/ComputeFlow.test.ts index b9bf131c..ddf2ed18 100644 --- a/test/integration/ComputeFlow.test.ts +++ b/test/integration/ComputeFlow.test.ts @@ -40,6 +40,7 @@ describe('Compute flow', () => { let data: { t: number; url: string } let blob: string let jobId: string + let computeOrderId: string let cluster: Cluster let servers: Server[] @@ -330,17 +331,17 @@ describe('Compute flow', () => { it('Bob starts compute job with a raw Algo', async () => { const output = {} - const order = await ocean.compute.order( + computeOrderId = await ocean.compute.order( bob.getId(), ddo.id, computeService.index, undefined, algorithmMeta ) - assert(order != null) + assert(computeOrderId != null) const response = await ocean.compute.start( ddo.id, - order, + computeOrderId, tokenAddress, bob, undefined, @@ -352,14 +353,31 @@ describe('Compute flow', () => { jobId = response.jobId assert(response.status >= 10) }) + it('Bob should get status of a compute job with a specific order txId', async () => { + assert(jobId != null) + const response = await ocean.compute.status( + bob, + undefined, + undefined, + computeOrderId, + true + ) + assert(response[0].jobId === jobId) + }) it('Bob should get status of a compute job without signing', async () => { assert(jobId != null) - const response = await ocean.compute.status(bob, ddo.id, jobId, false) + const response = await ocean.compute.status(bob, ddo.id, jobId, undefined, false) assert(response[0].jobId === jobId) }) it('should get status of all compute jobs for an address without signing', async () => { - const response = await ocean.compute.status(bob, undefined, undefined, false) + const response = await ocean.compute.status( + bob, + undefined, + undefined, + undefined, + false + ) assert(response.length > 0) }) it('Bob should get status of a compute job', async () => {