mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
update compute status query and jsdoc (#1361)
This commit is contained in:
parent
ea9bceb092
commit
4157e1e473
@ -528,26 +528,21 @@ export class Provider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get status for a specific jobId/documentId/owner.
|
/** Get compute status for a specific jobId/documentId/owner.
|
||||||
* @param {string} did
|
* @param {string} providerUri The URI of the provider we want to query
|
||||||
* @param {string} consumerAddress
|
* @param {string} consumerAddress The consumer ethereum address
|
||||||
* @param {string} providerUri
|
* @param {string} jobId The ID of a compute job.
|
||||||
* @param {Web3} web3
|
* @param {string} did The ID of the asset
|
||||||
* @param {AbortSignal} signal abort signal
|
* @param {AbortSignal} signal abort signal
|
||||||
* @param {string} jobId
|
|
||||||
* @return {Promise<ComputeJob | ComputeJob[]>}
|
* @return {Promise<ComputeJob | ComputeJob[]>}
|
||||||
*/
|
*/
|
||||||
public async computeStatus(
|
public async computeStatus(
|
||||||
providerUri: string,
|
providerUri: string,
|
||||||
signal?: AbortSignal,
|
consumerAddress: string,
|
||||||
jobId?: string,
|
jobId?: string,
|
||||||
did?: string,
|
did?: string,
|
||||||
consumerAddress?: string
|
signal?: AbortSignal
|
||||||
): Promise<ComputeJob | ComputeJob[]> {
|
): Promise<ComputeJob | ComputeJob[]> {
|
||||||
if (!jobId && !did && !consumerAddress) {
|
|
||||||
throw new Error('You need at least one of jobId, did, consumerAddress')
|
|
||||||
}
|
|
||||||
|
|
||||||
const providerEndpoints = await this.getEndpoints(providerUri)
|
const providerEndpoints = await this.getEndpoints(providerUri)
|
||||||
const serviceEndpoints = await this.getServiceEndpoints(
|
const serviceEndpoints = await this.getServiceEndpoints(
|
||||||
providerUri,
|
providerUri,
|
||||||
@ -557,8 +552,8 @@ export class Provider {
|
|||||||
? this.getEndpointURL(serviceEndpoints, 'computeStatus').urlPath
|
? this.getEndpointURL(serviceEndpoints, 'computeStatus').urlPath
|
||||||
: null
|
: null
|
||||||
|
|
||||||
let url = '?documentId=' + noZeroX(did)
|
let url = `?consumerAddress=${consumerAddress}`
|
||||||
url += (consumerAddress && `&consumerAddress=${consumerAddress}`) || ''
|
url += (did && `&documentId=${noZeroX(did)}`) || ''
|
||||||
url += (jobId && `&jobId=${jobId}`) || ''
|
url += (jobId && `&jobId=${jobId}`) || ''
|
||||||
|
|
||||||
if (!computeStatusUrl) return null
|
if (!computeStatusUrl) return null
|
||||||
|
@ -338,10 +338,9 @@ describe('Simple compute tests', async () => {
|
|||||||
assert(computeJobs, 'Cannot start compute job')
|
assert(computeJobs, 'Cannot start compute job')
|
||||||
const jobStatus = await ProviderInstance.computeStatus(
|
const jobStatus = await ProviderInstance.computeStatus(
|
||||||
providerUrl,
|
providerUrl,
|
||||||
null,
|
consumerAccount,
|
||||||
computeJobs[0].jobId,
|
computeJobs[0].jobId,
|
||||||
resolvedDDOAsset.id,
|
resolvedDDOAsset.id
|
||||||
consumerAccount
|
|
||||||
)
|
)
|
||||||
assert(jobStatus)
|
assert(jobStatus)
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user