mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
update compute status
This commit is contained in:
parent
6cfd79d3f0
commit
1aefaf8116
@ -175,7 +175,8 @@ export class Compute extends Instantiable {
|
|||||||
* Returns information about the status of all compute jobs, or a single compute job.
|
* 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 {Account} consumerAccount The account of the consumer ordering the service.
|
||||||
* @param {string} did Decentralized identifier.
|
* @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)
|
* @param {boolean} sign If the provider request is going to be signed(default) (full status) or not (short status)
|
||||||
* @return {Promise<ComputeJob[]>} Returns the status
|
* @return {Promise<ComputeJob[]>} Returns the status
|
||||||
*/
|
*/
|
||||||
@ -183,6 +184,7 @@ export class Compute extends Instantiable {
|
|||||||
consumerAccount: Account,
|
consumerAccount: Account,
|
||||||
did?: string,
|
did?: string,
|
||||||
jobId?: string,
|
jobId?: string,
|
||||||
|
txId?: string,
|
||||||
sign = true
|
sign = true
|
||||||
): Promise<ComputeJob[]> {
|
): Promise<ComputeJob[]> {
|
||||||
let provider: Provider
|
let provider: Provider
|
||||||
@ -204,7 +206,7 @@ export class Compute extends Instantiable {
|
|||||||
undefined,
|
undefined,
|
||||||
jobId,
|
jobId,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
txId,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
|
@ -195,7 +195,7 @@ export class Provider extends Instantiable {
|
|||||||
''
|
''
|
||||||
url += (jobId && `&jobId=${jobId}`) || ''
|
url += (jobId && `&jobId=${jobId}`) || ''
|
||||||
url += `&consumerAddress=${address}`
|
url += `&consumerAddress=${address}`
|
||||||
url += `&transferTxId=${txId}` || ''
|
url += (txId && `&transferTxId=${txId}`) || ''
|
||||||
url +=
|
url +=
|
||||||
(algorithmTransferTxId && `&algorithmTransferTxId=${algorithmTransferTxId}`) || ''
|
(algorithmTransferTxId && `&algorithmTransferTxId=${algorithmTransferTxId}`) || ''
|
||||||
url += (algorithmDataToken && `&algorithmDataToken=${algorithmDataToken}`) || ''
|
url += (algorithmDataToken && `&algorithmDataToken=${algorithmDataToken}`) || ''
|
||||||
|
@ -40,6 +40,7 @@ describe('Compute flow', () => {
|
|||||||
let data: { t: number; url: string }
|
let data: { t: number; url: string }
|
||||||
let blob: string
|
let blob: string
|
||||||
let jobId: string
|
let jobId: string
|
||||||
|
let computeOrderId: string
|
||||||
|
|
||||||
let cluster: Cluster
|
let cluster: Cluster
|
||||||
let servers: Server[]
|
let servers: Server[]
|
||||||
@ -330,17 +331,17 @@ describe('Compute flow', () => {
|
|||||||
|
|
||||||
it('Bob starts compute job with a raw Algo', async () => {
|
it('Bob starts compute job with a raw Algo', async () => {
|
||||||
const output = {}
|
const output = {}
|
||||||
const order = await ocean.compute.order(
|
computeOrderId = await ocean.compute.order(
|
||||||
bob.getId(),
|
bob.getId(),
|
||||||
ddo.id,
|
ddo.id,
|
||||||
computeService.index,
|
computeService.index,
|
||||||
undefined,
|
undefined,
|
||||||
algorithmMeta
|
algorithmMeta
|
||||||
)
|
)
|
||||||
assert(order != null)
|
assert(computeOrderId != null)
|
||||||
const response = await ocean.compute.start(
|
const response = await ocean.compute.start(
|
||||||
ddo.id,
|
ddo.id,
|
||||||
order,
|
computeOrderId,
|
||||||
tokenAddress,
|
tokenAddress,
|
||||||
bob,
|
bob,
|
||||||
undefined,
|
undefined,
|
||||||
@ -352,14 +353,31 @@ describe('Compute flow', () => {
|
|||||||
jobId = response.jobId
|
jobId = response.jobId
|
||||||
assert(response.status >= 10)
|
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 () => {
|
it('Bob should get status of a compute job without signing', async () => {
|
||||||
assert(jobId != null)
|
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)
|
assert(response[0].jobId === jobId)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should get status of all compute jobs for an address without signing', async () => {
|
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)
|
assert(response.length > 0)
|
||||||
})
|
})
|
||||||
it('Bob should get status of a compute job', async () => {
|
it('Bob should get status of a compute job', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user