Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix output stage w main merge. #613

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading