1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

update asset timeouts

This commit is contained in:
Bogdan Fazakas 2022-09-09 12:20:41 +03:00
parent 479234d806
commit 9fc8a8ebb3

View File

@ -32,16 +32,16 @@ let publisherAccount: string
let providerInitializeComputeResults let providerInitializeComputeResults
let computeEnvs let computeEnvs
let addresses: any let addresses: any
let ddoWith1mTimeoutId let ddoWith5mTimeoutId
let ddoWithNoTimeoutId let ddoWithNoTimeoutId
let algoDdoWith1mTimeoutId let algoDdoWith5mTimeoutId
let algoDdoWithNoTimeoutId let algoDdoWithNoTimeoutId
let freeComputeJobId: string let freeComputeJobId: string
let resolvedDdoWith1mTimeout let resolvedDdoWith5mTimeout
let resolvedDdoWithNoTimeout let resolvedDdoWithNoTimeout
let resolvedAlgoDdoWith1mTimeout let resolvedAlgoDdoWith5mTimeout
let resolvedAlgoDdoWithNoTimeout let resolvedAlgoDdoWithNoTimeout
let freeEnvDatasetTxId let freeEnvDatasetTxId
@ -98,7 +98,7 @@ const ddoWithNoTimeout = {
] ]
} }
const ddoWith1mTimeout = { const ddoWith5mTimeout = {
'@context': ['https://w3id.org/did/v1'], '@context': ['https://w3id.org/did/v1'],
id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c', id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c',
version: '4.1.0', version: '4.1.0',
@ -124,7 +124,7 @@ const ddoWith1mTimeout = {
files: '', files: '',
datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3', datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3',
serviceEndpoint: 'https://v4.provider.rinkeby.oceanprotocol.com', serviceEndpoint: 'https://v4.provider.rinkeby.oceanprotocol.com',
timeout: 60, timeout: 300,
compute: { compute: {
publisherTrustedAlgorithmPublishers: [], publisherTrustedAlgorithmPublishers: [],
publisherTrustedAlgorithms: [], publisherTrustedAlgorithms: [],
@ -187,7 +187,7 @@ const algoDdoWithNoTimeout = {
] ]
} }
const algoDdoWith1mTimeout = { const algoDdoWith5mTimeout = {
'@context': ['https://w3id.org/did/v1'], '@context': ['https://w3id.org/did/v1'],
id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c', id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c',
version: '4.1.0', version: '4.1.0',
@ -224,7 +224,7 @@ const algoDdoWith1mTimeout = {
files: '', files: '',
datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3', datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3',
serviceEndpoint: 'https://v4.provider.rinkeby.oceanprotocol.com', serviceEndpoint: 'https://v4.provider.rinkeby.oceanprotocol.com',
timeout: 60 timeout: 300
} }
] ]
} }
@ -360,12 +360,12 @@ describe('Simple compute tests', async () => {
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
publisherAccount = accounts[0] publisherAccount = accounts[0]
consumerAccount = accounts[1] consumerAccount = accounts[1]
ddoWith1mTimeoutId = await createAsset( ddoWith5mTimeoutId = await createAsset(
'D1Min', 'D1Min',
'D1M', 'D1M',
publisherAccount, publisherAccount,
assetUrl, assetUrl,
ddoWith1mTimeout, ddoWith5mTimeout,
providerUrl providerUrl
) )
ddoWithNoTimeoutId = await createAsset( ddoWithNoTimeoutId = await createAsset(
@ -376,12 +376,12 @@ describe('Simple compute tests', async () => {
ddoWithNoTimeout, ddoWithNoTimeout,
providerUrl providerUrl
) )
algoDdoWith1mTimeoutId = await createAsset( algoDdoWith5mTimeoutId = await createAsset(
'A1Min', 'A1Min',
'A1M', 'A1M',
publisherAccount, publisherAccount,
algoAssetUrl, algoAssetUrl,
algoDdoWith1mTimeout, algoDdoWith5mTimeout,
providerUrl providerUrl
) )
@ -396,12 +396,12 @@ describe('Simple compute tests', async () => {
}) })
it('should resolve published datasets and algorithms', async () => { it('should resolve published datasets and algorithms', async () => {
resolvedDdoWith1mTimeout = await aquarius.waitForAqua(ddoWith1mTimeoutId) resolvedDdoWith5mTimeout = await aquarius.waitForAqua(ddoWith5mTimeoutId)
assert(resolvedDdoWith1mTimeout, 'Cannot fetch DDO from Aquarius') assert(resolvedDdoWith5mTimeout, 'Cannot fetch DDO from Aquarius')
resolvedDdoWithNoTimeout = await aquarius.waitForAqua(ddoWithNoTimeoutId) resolvedDdoWithNoTimeout = await aquarius.waitForAqua(ddoWithNoTimeoutId)
assert(resolvedDdoWithNoTimeout, 'Cannot fetch DDO from Aquarius') assert(resolvedDdoWithNoTimeout, 'Cannot fetch DDO from Aquarius')
resolvedAlgoDdoWith1mTimeout = await aquarius.waitForAqua(algoDdoWith1mTimeoutId) resolvedAlgoDdoWith5mTimeout = await aquarius.waitForAqua(algoDdoWith5mTimeoutId)
assert(resolvedAlgoDdoWith1mTimeout, 'Cannot fetch DDO from Aquarius') assert(resolvedAlgoDdoWith5mTimeout, 'Cannot fetch DDO from Aquarius')
resolvedAlgoDdoWithNoTimeout = await aquarius.waitForAqua(algoDdoWithNoTimeoutId) resolvedAlgoDdoWithNoTimeout = await aquarius.waitForAqua(algoDdoWithNoTimeoutId)
assert(resolvedAlgoDdoWithNoTimeout, 'Cannot fetch DDO from Aquarius') assert(resolvedAlgoDdoWithNoTimeout, 'Cannot fetch DDO from Aquarius')
}) })
@ -409,7 +409,7 @@ describe('Simple compute tests', async () => {
it('should send DT to consumer', async () => { it('should send DT to consumer', async () => {
const datatoken = new Datatoken(web3) const datatoken = new Datatoken(web3)
await datatoken.mint( await datatoken.mint(
resolvedDdoWith1mTimeout.services[0].datatokenAddress, resolvedDdoWith5mTimeout.services[0].datatokenAddress,
publisherAccount, publisherAccount,
'10', '10',
consumerAccount consumerAccount
@ -421,7 +421,7 @@ describe('Simple compute tests', async () => {
consumerAccount consumerAccount
) )
await datatoken.mint( await datatoken.mint(
resolvedAlgoDdoWith1mTimeout.services[0].datatokenAddress, resolvedAlgoDdoWith5mTimeout.services[0].datatokenAddress,
publisherAccount, publisherAccount,
'10', '10',
consumerAccount consumerAccount
@ -453,14 +453,14 @@ describe('Simple compute tests', async () => {
const assets: ComputeAsset[] = [ const assets: ComputeAsset[] = [
{ {
documentId: resolvedDdoWith1mTimeout.id, documentId: resolvedDdoWith5mTimeout.id,
serviceId: resolvedDdoWith1mTimeout.services[0].id serviceId: resolvedDdoWith5mTimeout.services[0].id
} }
] ]
const dtAddressArray = [resolvedDdoWith1mTimeout.services[0].datatokenAddress] const dtAddressArray = [resolvedDdoWith5mTimeout.services[0].datatokenAddress]
const algo: ComputeAlgorithm = { const algo: ComputeAlgorithm = {
documentId: resolvedAlgoDdoWith1mTimeout.id, documentId: resolvedAlgoDdoWith5mTimeout.id,
serviceId: resolvedAlgoDdoWith1mTimeout.services[0].id serviceId: resolvedAlgoDdoWith5mTimeout.services[0].id
} }
providerInitializeComputeResults = await ProviderInstance.initializeCompute( providerInitializeComputeResults = await ProviderInstance.initializeCompute(
@ -478,7 +478,7 @@ describe('Simple compute tests', async () => {
) )
algo.transferTxId = await handleOrder( algo.transferTxId = await handleOrder(
providerInitializeComputeResults.algorithm, providerInitializeComputeResults.algorithm,
resolvedAlgoDdoWith1mTimeout.services[0].datatokenAddress, resolvedAlgoDdoWith5mTimeout.services[0].datatokenAddress,
consumerAccount, consumerAccount,
computeEnv.consumerAddress, computeEnv.consumerAddress,
0 0
@ -517,7 +517,7 @@ describe('Simple compute tests', async () => {
providerUrl, providerUrl,
consumerAccount, consumerAccount,
freeComputeJobId, freeComputeJobId,
resolvedDdoWith1mTimeout.id resolvedDdoWith5mTimeout.id
)) as ComputeJob )) as ComputeJob
assert(jobStatus, 'Cannot retrieve compute status!') assert(jobStatus, 'Cannot retrieve compute status!')
const mytime = new Date() const mytime = new Date()
@ -533,14 +533,14 @@ describe('Simple compute tests', async () => {
const assets: ComputeAsset[] = [ const assets: ComputeAsset[] = [
{ {
documentId: resolvedDdoWith1mTimeout.id, documentId: resolvedDdoWith5mTimeout.id,
serviceId: resolvedDdoWith1mTimeout.services[0].id, serviceId: resolvedDdoWith5mTimeout.services[0].id,
transferTxId: freeEnvDatasetTxId transferTxId: freeEnvDatasetTxId
} }
] ]
const algo: ComputeAlgorithm = { const algo: ComputeAlgorithm = {
documentId: resolvedAlgoDdoWith1mTimeout.id, documentId: resolvedAlgoDdoWith5mTimeout.id,
serviceId: resolvedAlgoDdoWith1mTimeout.services[0].id, serviceId: resolvedAlgoDdoWith5mTimeout.services[0].id,
transferTxId: freeEnvAlgoTxId transferTxId: freeEnvAlgoTxId
} }
const mytime = new Date() const mytime = new Date()
@ -601,14 +601,14 @@ describe('Simple compute tests', async () => {
const assets: ComputeAsset[] = [ const assets: ComputeAsset[] = [
{ {
documentId: resolvedDdoWith1mTimeout.id, documentId: resolvedDdoWith5mTimeout.id,
serviceId: resolvedDdoWith1mTimeout.services[0].id serviceId: resolvedDdoWith5mTimeout.services[0].id
} }
] ]
const dtAddressArray = [resolvedDdoWith1mTimeout.services[0].datatokenAddress] const dtAddressArray = [resolvedDdoWith5mTimeout.services[0].datatokenAddress]
const algo: ComputeAlgorithm = { const algo: ComputeAlgorithm = {
documentId: resolvedAlgoDdoWith1mTimeout.id, documentId: resolvedAlgoDdoWith5mTimeout.id,
serviceId: resolvedAlgoDdoWith1mTimeout.services[0].id serviceId: resolvedAlgoDdoWith5mTimeout.services[0].id
} }
providerInitializeComputeResults = await ProviderInstance.initializeCompute( providerInitializeComputeResults = await ProviderInstance.initializeCompute(
@ -625,7 +625,7 @@ describe('Simple compute tests', async () => {
) )
algo.transferTxId = await handleOrder( algo.transferTxId = await handleOrder(
providerInitializeComputeResults.algorithm, providerInitializeComputeResults.algorithm,
resolvedAlgoDdoWith1mTimeout.services[0].datatokenAddress, resolvedAlgoDdoWith5mTimeout.services[0].datatokenAddress,
consumerAccount, consumerAccount,
computeEnv.consumerAddress, computeEnv.consumerAddress,
0 0
@ -669,15 +669,15 @@ describe('Simple compute tests', async () => {
const assets: ComputeAsset[] = [ const assets: ComputeAsset[] = [
{ {
documentId: resolvedDdoWith1mTimeout.id, documentId: resolvedDdoWith5mTimeout.id,
serviceId: resolvedDdoWith1mTimeout.services[0].id, serviceId: resolvedDdoWith5mTimeout.services[0].id,
transferTxId: freeEnvDatasetTxId transferTxId: freeEnvDatasetTxId
} }
] ]
const dtAddressArray = [resolvedDdoWith1mTimeout.services[0].datatokenAddress] const dtAddressArray = [resolvedDdoWith5mTimeout.services[0].datatokenAddress]
const algo: ComputeAlgorithm = { const algo: ComputeAlgorithm = {
documentId: resolvedAlgoDdoWith1mTimeout.id, documentId: resolvedAlgoDdoWith5mTimeout.id,
serviceId: resolvedAlgoDdoWith1mTimeout.services[0].id, serviceId: resolvedAlgoDdoWith5mTimeout.services[0].id,
transferTxId: freeEnvAlgoTxId transferTxId: freeEnvAlgoTxId
} }
@ -710,7 +710,7 @@ describe('Simple compute tests', async () => {
) )
algo.transferTxId = await handleOrder( algo.transferTxId = await handleOrder(
providerInitializeComputeResults.algorithm, providerInitializeComputeResults.algorithm,
resolvedAlgoDdoWith1mTimeout.services[0].datatokenAddress, resolvedAlgoDdoWith5mTimeout.services[0].datatokenAddress,
consumerAccount, consumerAccount,
computeEnv.consumerAddress, computeEnv.consumerAddress,
0 0
@ -749,15 +749,15 @@ describe('Simple compute tests', async () => {
const assets: ComputeAsset[] = [ const assets: ComputeAsset[] = [
{ {
documentId: resolvedDdoWith1mTimeout.id, documentId: resolvedDdoWith5mTimeout.id,
serviceId: resolvedDdoWith1mTimeout.services[0].id, serviceId: resolvedDdoWith5mTimeout.services[0].id,
transferTxId: paidEnvDatasetTxId transferTxId: paidEnvDatasetTxId
} }
] ]
const dtAddressArray = [resolvedDdoWith1mTimeout.services[0].datatokenAddress] const dtAddressArray = [resolvedDdoWith5mTimeout.services[0].datatokenAddress]
const algo: ComputeAlgorithm = { const algo: ComputeAlgorithm = {
documentId: resolvedAlgoDdoWith1mTimeout.id, documentId: resolvedAlgoDdoWith5mTimeout.id,
serviceId: resolvedAlgoDdoWith1mTimeout.services[0].id, serviceId: resolvedAlgoDdoWith5mTimeout.services[0].id,
transferTxId: paidEnvAlgoTxId transferTxId: paidEnvAlgoTxId
} }
@ -789,7 +789,7 @@ describe('Simple compute tests', async () => {
) )
algo.transferTxId = await handleOrder( algo.transferTxId = await handleOrder(
providerInitializeComputeResults.algorithm, providerInitializeComputeResults.algorithm,
resolvedAlgoDdoWith1mTimeout.services[0].datatokenAddress, resolvedAlgoDdoWith5mTimeout.services[0].datatokenAddress,
consumerAccount, consumerAccount,
computeEnv.consumerAddress, computeEnv.consumerAddress,
0 0
@ -828,7 +828,7 @@ describe('Simple compute tests', async () => {
providerUrl, providerUrl,
consumerAccount, consumerAccount,
freeComputeJobId, freeComputeJobId,
resolvedDdoWith1mTimeout.id resolvedDdoWith5mTimeout.id
)) as ComputeJob )) as ComputeJob
assert(jobStatus, 'Cannot retrieve compute status!') assert(jobStatus, 'Cannot retrieve compute status!')
}) })
@ -852,14 +852,14 @@ describe('Simple compute tests', async () => {
// const assets: ComputeAsset[] = [ // const assets: ComputeAsset[] = [
// { // {
// documentId: resolvedDdoWith1mTimeout.id, // documentId: resolvedDdoWith5mTimeout.id,
// serviceId: resolvedDdoWith1mTimeout.services[0].id, // serviceId: resolvedDdoWith5mTimeout.services[0].id,
// transferTxId: paidEnvDatasetTxId // transferTxId: paidEnvDatasetTxId
// } // }
// ] // ]
// const algo: ComputeAlgorithm = { // const algo: ComputeAlgorithm = {
// documentId: resolvedAlgoDdoWith1mTimeout.id, // documentId: resolvedAlgoDdoWith5mTimeout.id,
// serviceId: resolvedAlgoDdoWith1mTimeout.services[0].id, // serviceId: resolvedAlgoDdoWith5mTimeout.services[0].id,
// transferTxId: paidEnvAlgoTxId // transferTxId: paidEnvAlgoTxId
// } // }