mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Return proper value from the compute endpoints.
This commit is contained in:
parent
75a0ef05d9
commit
e2ed974af2
@ -134,13 +134,13 @@ export class Brizo extends Instantiable {
|
||||
|
||||
// construct Brizo URL
|
||||
let url = serviceEndpoint
|
||||
url += `&signature=${signature}`
|
||||
url += `?signature=${signature}`
|
||||
url += `&consumerAddress=${address}`
|
||||
url += `&serviceAgreementId=${noZeroX(serviceAgreementId)}`
|
||||
url += algorithmDid && `&algorithmDid=${algorithmDid}`
|
||||
url += algorithmMeta && `&algorithmMeta=${algorithmMeta}`
|
||||
url += output && `&output=${output}`
|
||||
url += jobId && `&jobId=${jobId}`
|
||||
url += algorithmDid && `&algorithmDid=${algorithmDid}` || ''
|
||||
url += algorithmMeta && `&algorithmMeta=${algorithmMeta}` || ''
|
||||
url += output && `&output=${JSON.stringify(output)}` || ''
|
||||
url += jobId && `&jobId=${jobId}` || ''
|
||||
|
||||
// switch fetch method
|
||||
let fetch
|
||||
|
@ -6,16 +6,20 @@ import { SubscribablePromise } from '../utils'
|
||||
import { OrderProgressStep } from './utils/ServiceUtils'
|
||||
import { DID } from '../squid'
|
||||
|
||||
export enum ComputeJobStatus {
|
||||
Started,
|
||||
ConfiguringVolumes,
|
||||
RunningAlgorithm,
|
||||
FilteringResults,
|
||||
PublishingResult,
|
||||
Completed,
|
||||
Stopped,
|
||||
Deleted
|
||||
}
|
||||
|
||||
export const ComputeJobStatus = Object.freeze({
|
||||
Started: 10,
|
||||
ConfiguringVolumes: 20,
|
||||
ProvisioningSuccess: 30,
|
||||
DataProvisioningFailed: 31,
|
||||
AlgorithmProvisioningFailed: 32,
|
||||
RunningAlgorithm: 40,
|
||||
FilteringResults: 50,
|
||||
PublishingResult: 60,
|
||||
Completed: 70,
|
||||
Stopped: 80,
|
||||
Deleted: 90
|
||||
})
|
||||
|
||||
export interface Output {
|
||||
publishAlgorithmLog?: boolean
|
||||
@ -36,7 +40,7 @@ export interface ComputeJob {
|
||||
jobId: string
|
||||
dateCreated: string
|
||||
dateFinished: string
|
||||
status: ComputeJobStatus
|
||||
status: number
|
||||
statusText: string
|
||||
algorithmLogUrl: string
|
||||
resultsUrls: string[]
|
||||
@ -133,7 +137,7 @@ export class OceanCompute extends Instantiable {
|
||||
output?: Output
|
||||
): Promise<ComputeJob> {
|
||||
output = this.checkOutput(consumerAccount, output)
|
||||
const status = await this.ocean.brizo.compute(
|
||||
const computeJobsList = await this.ocean.brizo.compute(
|
||||
'post',
|
||||
agreementId,
|
||||
consumerAccount,
|
||||
@ -143,7 +147,7 @@ export class OceanCompute extends Instantiable {
|
||||
output
|
||||
)
|
||||
|
||||
return status as ComputeJob
|
||||
return computeJobsList[0] as ComputeJob
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,7 +162,7 @@ export class OceanCompute extends Instantiable {
|
||||
agreementId: string,
|
||||
jobId: string
|
||||
): Promise<ComputeJob> {
|
||||
const status = await this.ocean.brizo.compute(
|
||||
const computeJobsList = await this.ocean.brizo.compute(
|
||||
'put',
|
||||
agreementId,
|
||||
consumerAccount,
|
||||
@ -167,7 +171,7 @@ export class OceanCompute extends Instantiable {
|
||||
jobId
|
||||
)
|
||||
|
||||
return status as ComputeJob
|
||||
return computeJobsList[0] as ComputeJob
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,7 +186,7 @@ export class OceanCompute extends Instantiable {
|
||||
agreementId: string,
|
||||
jobId: string
|
||||
): Promise<ComputeJob> {
|
||||
const status = await this.ocean.brizo.compute(
|
||||
const computeJobsList = await this.ocean.brizo.compute(
|
||||
'delete',
|
||||
agreementId,
|
||||
consumerAccount,
|
||||
@ -191,7 +195,7 @@ export class OceanCompute extends Instantiable {
|
||||
jobId
|
||||
)
|
||||
|
||||
return status as ComputeJob
|
||||
return computeJobsList[0] as ComputeJob
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,7 +227,7 @@ export class OceanCompute extends Instantiable {
|
||||
agreementId?: string,
|
||||
jobId?: string
|
||||
): Promise<ComputeJob[]> {
|
||||
const status = await this.ocean.brizo.compute(
|
||||
const computeJobsList = await this.ocean.brizo.compute(
|
||||
'get',
|
||||
agreementId,
|
||||
consumerAccount,
|
||||
@ -232,7 +236,7 @@ export class OceanCompute extends Instantiable {
|
||||
jobId
|
||||
)
|
||||
|
||||
return status as ComputeJob[]
|
||||
return computeJobsList as ComputeJob[]
|
||||
}
|
||||
|
||||
/**
|
||||
@ -247,7 +251,7 @@ export class OceanCompute extends Instantiable {
|
||||
agreementId: string,
|
||||
jobId: string
|
||||
): Promise<ComputeJob> {
|
||||
const status = await this.ocean.brizo.compute(
|
||||
const computeJobsList = await this.ocean.brizo.compute(
|
||||
'get',
|
||||
agreementId,
|
||||
consumerAccount,
|
||||
@ -256,6 +260,6 @@ export class OceanCompute extends Instantiable {
|
||||
jobId
|
||||
)
|
||||
|
||||
return status as ComputeJob
|
||||
return computeJobsList[0] as ComputeJob
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user