mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
updated checkoutput
This commit is contained in:
parent
56b0e7b97e
commit
dec6c35319
@ -105,23 +105,29 @@ export class OceanCompute extends Instantiable {
|
||||
* @param {Object} output Output section used for publishing the result.
|
||||
* @return {Promise<Output>} Returns output object
|
||||
*/
|
||||
public async checkoutput(consumerAccount: Account, output?: Output): Promise<Output> {
|
||||
if (!output) {
|
||||
// build a minimal object and return it
|
||||
return this.getminimaloutput()
|
||||
private checkOutput(consumerAccount: Account, output?: Output): Output {
|
||||
const isDefault =
|
||||
!output || (!output.publishAlgorithmLog && !output.publishOutput)
|
||||
|
||||
if (isDefault) {
|
||||
return {
|
||||
publishAlgorithmLog: false,
|
||||
publishOutput: false
|
||||
}
|
||||
}
|
||||
if (!output.publishAlgorithmLog && !output.publishOutput) {
|
||||
return this.getminimaloutput()
|
||||
|
||||
return {
|
||||
publishAlgorithmLog: output.publishAlgorithmLog,
|
||||
publishOutput: output.publishOutput,
|
||||
brizoAddress: output.brizoAddress || this.config.brizoAddress,
|
||||
brizoUri: output.brizoUri || this.config.brizoUri,
|
||||
metadataUri: output.metadataUri || this.config.aquariusUri,
|
||||
nodeUri: output.nodeUri || this.config.nodeUri,
|
||||
owner: output.owner || consumerAccount.getId(),
|
||||
secretStoreUri: output.secretStoreUri || this.config.secretStoreUri
|
||||
}
|
||||
if (!output.brizoAddress) output.brizoAddress = this.config.brizoAddress
|
||||
if (!output.brizoUri) output.brizoUri = this.config.brizoUri
|
||||
if (!output.metadataUri) output.metadataUri = this.config.aquariusUri
|
||||
if (!output.nodeUri) output.nodeUri = this.config.nodeUri
|
||||
if (!output.owner) output.owner = consumerAccount.getId()
|
||||
if (!output.secretStoreUri) output.secretStoreUri = this.config.secretStoreUri
|
||||
return output
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start the execution of a compute job.
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
@ -138,7 +144,7 @@ export class OceanCompute extends Instantiable {
|
||||
algorithmMeta?: MetaData,
|
||||
output?: Output
|
||||
): Promise<ComputeJob> {
|
||||
output = await this.checkoutput(consumerAccount, output)
|
||||
output = this.checkoutput(consumerAccount, output)
|
||||
const status = await this.ocean.brizo.compute(
|
||||
'post',
|
||||
agreementId,
|
||||
|
Loading…
Reference in New Issue
Block a user