Skip to content

Commit

Permalink
Fix output stage w main merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariacarmina committed Aug 14, 2024
1 parent 0db9171 commit 73aa3f1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ For configuring allowed validators for verifying an asset signature before index
export ALLOWED_VALIDATORS=[\"0x123\",\"0x456\"]
```

For configuring a C2D (Compute to Data) cluster(s), please set the following environment variable (array of 1 or multiple cluster URLS):
For configuring a C2D (Compute to Data) cluster(s), please set the following environment variable (array of 1 or multiple cluster URLS) and node URI that C2D points to, in order fetch the datasets & algorithms:

```bash
export OPERATOR_SERVICE_URL=[\"http://example.c2d.cluster1.com\",\"http://example.cd2.cluster2.com\"]
export C2D_NODE_URI='http://127.0.0.1:8081' #for e.g.
```

For configuring the Indexer crawling interval in miliseconds (default, if not set, is 30 secs)
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/@types/OceanNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface OceanNodeConfig {
supportedNetworks?: RPCS
indexingNetworks?: RPCS
c2dClusters: C2DClusterInfo[]
c2dNodeUri: string
accountPurgatoryUrl: string
assetPurgatoryUrl: string
allowedAdmins?: string[]
Expand Down
12 changes: 10 additions & 2 deletions src/components/c2d/compute_engines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export class C2DEngineOPFK8 extends C2DEngine {
): Promise<ComputeJob[]> {
// let's build the stage first
// start with stage.input
const config = await getConfiguration()
const stagesInput: OPFK8ComputeStageInput[] = []
let index = 0
for (const asset of assets) {
Expand All @@ -217,6 +218,14 @@ export class C2DEngineOPFK8 extends C2DEngine {
})
index++
}
let getOuput = {}
if (output) {
getOuput = output
} else if (config.hasHttp && config.c2dNodeUri) {
getOuput = {
metadataUri: config.c2dNodeUri
}
}
// continue with algorithm
const stageAlgorithm: OPFK8ComputeStageAlgorithm = {}
if (algorithm.url) {
Expand All @@ -237,7 +246,7 @@ export class C2DEngineOPFK8 extends C2DEngine {
index: 0,
input: stagesInput,
algorithm: stageAlgorithm,
output: output || {},
output: getOuput,
compute: {
Instances: 1,
namespace: environment,
Expand All @@ -250,7 +259,6 @@ export class C2DEngineOPFK8 extends C2DEngine {
}
// and the full payload
const nonce: number = new Date().getTime()
const config = await getConfiguration()
const providerSignature = await sign(String(nonce), config.keys.privateKey)
const payload: OPFK8ComputeStart = {
workflow,
Expand Down
3 changes: 2 additions & 1 deletion src/test/integration/compute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,8 @@ describe('Compute', () => {
serviceId: publishedAlgoDataset.ddo.services[0].id,
transferTxId: algoOrderTxId,
meta: publishedAlgoDataset.ddo.metadata.algorithm
}
},
output: {}
// additionalDatasets?: ComputeAsset[]
// output?: ComputeOutput
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ async function getEnvConfig(isStartup?: boolean): Promise<OceanNodeConfig> {
indexingNetworks,
feeStrategy: getOceanNodeFees(supportedNetworks, isStartup),
c2dClusters: getC2DClusterEnvironment(isStartup),
c2dNodeUri: getEnvValue(process.env.C2D_NODE_URI, ''),
accountPurgatoryUrl: getEnvValue(process.env.ACCOUNT_PURGATORY_URL, ''),
assetPurgatoryUrl: getEnvValue(process.env.ASSET_PURGATORY_URL, ''),
allowedAdmins: getAllowedAdmins(isStartup),
Expand Down

0 comments on commit 73aa3f1

Please sign in to comment.