1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

wip get results

This commit is contained in:
Bogdan Fazakas 2022-03-31 11:49:42 +03:00
parent 6708b91400
commit f36f3bcc14
2 changed files with 44 additions and 40 deletions

View File

@ -214,10 +214,11 @@ async function getJobs(
assets: Asset[]
): Promise<ComputeJobMetaData[]> {
const computeJobs: ComputeJobMetaData[] = []
for await (const providerUrl of providerUrls) {
// commented loop since we decide how to filter jobs
// for await (const providerUrl of providerUrls) {
try {
const providerComputeJobs = (await ProviderInstance.computeStatus(
providerUrl,
providerUrls[0],
accountId
)) as ComputeJob[]
@ -249,7 +250,7 @@ async function getJobs(
} catch (err) {
LoggerInstance.error(err.message)
}
}
// }
return computeJobs
}
export async function getComputeJobs(

View File

@ -1,4 +1,4 @@
import { LoggerInstance } from '@oceanprotocol/lib'
import { LoggerInstance, Provider } from '@oceanprotocol/lib'
import React, { ReactElement, useState } from 'react'
import Loader from '@shared/atoms/Loader'
import { ListItem } from '@shared/atoms/Lists'
@ -13,7 +13,8 @@ export default function Results({
}: {
job: ComputeJobMetaData
}): ReactElement {
const { accountId } = useWeb3()
const providerInstance = new Provider()
const { accountId, web3 } = useWeb3()
const [isLoading, setIsLoading] = useState(false)
const [hasFetched, setHasFetched] = useState(false)
const isFinished = job.dateFinished !== null
@ -23,13 +24,15 @@ export default function Results({
try {
setIsLoading(true)
// const jobStatus = await ocean.compute.status(
// account,
// job.did,
// undefined,
// undefined,
// job.jobId
// )
console.log('getResults job: ', job)
const jobResult = await providerInstance.computeResult(
job.jobId,
0,
accountId,
'https://v4.provider.rinkeby.oceanprotocol.com/',
web3
)
console.log('getResults jobResult: ', jobResult)
// if (jobStatus?.length > 0) {
// job.algorithmLogUrl = jobStatus[0].algorithmLogUrl
// job.resultsUrl = jobStatus[0].resultsUrl