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.
|
||||
* @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<ComputeJob[]>} Returns the status
|
||||
*/
|
||||
@ -183,6 +184,7 @@ export class Compute extends Instantiable {
|
||||
consumerAccount: Account,
|
||||
did?: string,
|
||||
jobId?: string,
|
||||
txId?: string,
|
||||
sign = true
|
||||
): Promise<ComputeJob[]> {
|
||||
let provider: Provider
|
||||
@ -204,7 +206,7 @@ export class Compute extends Instantiable {
|
||||
undefined,
|
||||
jobId,
|
||||
undefined,
|
||||
undefined,
|
||||
txId,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
|
@ -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}`) || ''
|
||||
|
@ -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 () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user