Skip to content

Conversation

@mariacarmina
Copy link
Contributor

@mariacarmina mariacarmina commented May 12, 2025

Fixes #1515 .

Changes proposed in this PR:

  • adding sequence flow diagrams for free + paid compute
  • explainin the entire free and paid flow diagrams
  • refactor existing documentation for c2d
  • create documentation for escrow contract
  • update code example for c2d in ocean.js

@mariacarmina mariacarmina self-assigned this May 12, 2025
@mariacarmina mariacarmina marked this pull request as ready for review May 22, 2025 20:28
@mariacarmina mariacarmina changed the title C2D refactor for docs. Refactor C2D docs. May 22, 2025
Copy link
Contributor

@giurgiur99 giurgiur99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes 🙏

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update with latest screenshot without paid resources? Thanks.

In the C2D workflow, the following steps are performed:

1. The consumer initiates a compute-to-data job by selecting the desired data asset and algorithm, and then, the orders are validated via the dApp used.
2. A dedicated and isolated execution pod is created for the C2D job.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Container not pod for now

3. The execution pod loads the specified algorithm into its environment.
4. The execution pod securely loads the selected dataset for processing.
5. The algorithm is executed on the loaded dataset within the isolated execution pod.
6. The results and logs generated by the algorithm are securely returned to the user.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can mention that we use a web3 auto-generated/custom PK and this is how we ensure private access to results

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can mention the signature generation that it is required on get results endpoint.


Now, let's delve into the inner workings of the Provider. Initially, it verifies whether the Consumer has sent the appropriate datatokens to gain access to the desired data. Once validated, the Provider interacts with the Operator-Service, a microservice responsible for coordinating the job execution. The Provider submits a request to the Operator-Service, which subsequently forwards the request to the Operator-Engine, the actual compute system in operation.

The Operator-Engine, equipped with functionalities like running Kubernetes compute jobs, carries out the necessary computations as per the requirements. Throughout the computation process, the Operator-Engine informs the Operator-Service of the job's progress. Finally, when the job reaches completion, the Operator-Engine signals the Operator-Service, ensuring that the Provider receives notification of the job's successful conclusion.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No kubernetes for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is old stack, will remove these lines.

- `GetComputeEnvironments` - returns list of environments that can be selected to run the algorithm on
- `InitializeCompute` - generates provider fees necessary for asset's ordering
- `FreeStartCompute` - runs algorithms without necessary publish the assets on-chain (dataset and algorithm), using free resources from the selected environment
- `PaidStartCompute` - runs algorithms with on-chain assets (dataset and algorithm), using paid resources from the selected environment. The payment is requested at every start compute call, being handled by `Escrow` contract.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startCompute

COMPUTE_START: 'startCompute',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list represents the handlers from Ocean Node, not the command names

- `FreeStartCompute` - runs algorithms without necessary publish the assets on-chain (dataset and algorithm), using free resources from the selected environment
- `PaidStartCompute` - runs algorithms with on-chain assets (dataset and algorithm), using paid resources from the selected environment. The payment is requested at every start compute call, being handled by `Escrow` contract.
- `ComputeGetStatus` - retrieves compute job status.
- `ComputeStop` - stops compute job execution when the job is `Running`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  COMPUTE_STOP: 'stopCompute',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list represents the handlers from Ocean Node, not the command names

- `PaidStartCompute` - runs algorithms with on-chain assets (dataset and algorithm), using paid resources from the selected environment. The payment is requested at every start compute call, being handled by `Escrow` contract.
- `ComputeGetStatus` - retrieves compute job status.
- `ComputeStop` - stops compute job execution when the job is `Running`.
- `ComputeGetResult` - returns compute job results when job is `Finished`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COMPUTE_GET_RESULT: 'getComputeResult',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list represents the handlers from Ocean Node, not the command names


One of its responsibility revolves around fetching and preparing the required assets and files, ensuring a smooth and seamless execution of the job. By meticulously handling the environment configuration, the **C2D Engine** guarantees that all necessary components are in place, setting the stage for a successful job execution.

1. **Fetching Dataset Assets**: It downloads the files corresponding to datasets and saves them in the location `/data/inputs/DID/`. The files are named based on their array index ranging from 0 to X, depending on the total number of files associated with the dataset.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dataset can be did/url/arweave/ipfs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also need to specify for the algorithm as well, good catch!


## Prerequisites

The prerequisite for this flow is the algorithm code which can be input for consumers components: Ocean CLI and it is open for integration with other systems (e.g. Ocean Enterprise Marketplace).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI and vscode extension, might be useful to add links

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are linked in Setup , but I will link as well in the Prerequisites, thank you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dataset here will be url/did/ipfs/arweave.

We will now use the c2d_examples not algo_dockers repo

Copy link
Contributor

@giurgiur99 giurgiur99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken links for Architecture & Overview Guides

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I referenced statically .md files for each section, in md works fine. How does it look for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PaidStartCompute -> startCompute
ComputeGetStatus -> getComputeStatus
ComputeStop -> stopCompute
ComputeGetResult -> getComputeResult

The rest should be lowercase to follow the names from P2P handler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I targeted only handler names which are valid for both protocols as specified "which includes handlers for operations that can be called via HTTP and P2P protocols". If we want to ref commands and HTTP endpoint names, we can link the README for Ocean Node API.md.
I can add the link for it and keep the handler names as they are currently described in the documentation.

The rest should be lowercase to follow the names from P2P handler

The handlers (which include the core functionality) are used for both protocols in the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use kubernetes at the moment, therfore no pods

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I specified that currently only Docker engine is supported and in the future we can extend to support Kubernetes as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are still called pods in some place here in the .md. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a screenshot from the latest version of vscode extension? Also for now in extension we only use the rawAlgorithm and send the algo in the request, no did, ipfs, ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sure, I have added 2 screenhots for VS code extension and updated algorithms supported formats. Thanks!


1. The consumer initiates a compute-to-data job by selecting the desired data asset and algorithm, and then, the orders are validated via the dApp used.
2. A dedicated and isolated execution container is created for the C2D job.
3. The execution pod loads the specified algorithm into its environment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep but here and below they are still called "pods". Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are still called pods in some place here in the .md. Thanks!

@ndrpp
Copy link
Member

ndrpp commented Oct 8, 2025

Whilst checking the docs in the onboarding phase I found these links from the docs that don't work:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create docs for new C2D free and paid flows

4 participants