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[] assets: Asset[]
): Promise<ComputeJobMetaData[]> { ): Promise<ComputeJobMetaData[]> {
const computeJobs: 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 { try {
const providerComputeJobs = (await ProviderInstance.computeStatus( const providerComputeJobs = (await ProviderInstance.computeStatus(
providerUrl, providerUrls[0],
accountId accountId
)) as ComputeJob[] )) as ComputeJob[]
@ -249,7 +250,7 @@ async function getJobs(
} catch (err) { } catch (err) {
LoggerInstance.error(err.message) LoggerInstance.error(err.message)
} }
} // }
return computeJobs return computeJobs
} }
export async function getComputeJobs( 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 React, { ReactElement, useState } from 'react'
import Loader from '@shared/atoms/Loader' import Loader from '@shared/atoms/Loader'
import { ListItem } from '@shared/atoms/Lists' import { ListItem } from '@shared/atoms/Lists'
@ -13,7 +13,8 @@ export default function Results({
}: { }: {
job: ComputeJobMetaData job: ComputeJobMetaData
}): ReactElement { }): ReactElement {
const { accountId } = useWeb3() const providerInstance = new Provider()
const { accountId, web3 } = useWeb3()
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
const [hasFetched, setHasFetched] = useState(false) const [hasFetched, setHasFetched] = useState(false)
const isFinished = job.dateFinished !== null const isFinished = job.dateFinished !== null
@ -23,13 +24,15 @@ export default function Results({
try { try {
setIsLoading(true) setIsLoading(true)
// const jobStatus = await ocean.compute.status( console.log('getResults job: ', job)
// account, const jobResult = await providerInstance.computeResult(
// job.did, job.jobId,
// undefined, 0,
// undefined, accountId,
// job.jobId 'https://v4.provider.rinkeby.oceanprotocol.com/',
// ) web3
)
console.log('getResults jobResult: ', jobResult)
// if (jobStatus?.length > 0) { // if (jobStatus?.length > 0) {
// job.algorithmLogUrl = jobStatus[0].algorithmLogUrl // job.algorithmLogUrl = jobStatus[0].algorithmLogUrl
// job.resultsUrl = jobStatus[0].resultsUrl // job.resultsUrl = jobStatus[0].resultsUrl