ravop


Nameravop JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/ravenprotocol/ravop
Summary
upload_time2023-02-07 14:30:51
maintainer
docs_urlNone
authorRaven Protocol
requires_python
licenseMIT
keywords ravop requester library
VCS
bugtrack_url
requirements numpy requests python-socketio python-engineio python-dotenv speedtest-cli alive-progress
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Ravop

Ravop is one of the crucial build blocks of Ravenverse. It is a library for requesters to create and interact with ops, perform mathematical calculations, and write algorithms. 

## Installation

```bash
pip install ravop
```

## Usage

This section covers how a requester can create a simple graph and include Ops for adding 2 Tensors using Ravop module.

>**Note:** The complete scripts of the functionalities demonstrated in this document are available in the [Ravop Repository](https://github.com/ravenprotocol/ravop) in the ```examples``` folders.

### Setting Environment Variables
Create a .env file and add the following environment variables:

```bash
RAVENVERSE_URL=http://0.0.0.0:9999
RAVENVERSE_FTP_HOST=0.0.0.0
```

Load environment variables at the beginning of your code using:

```python
from dotenv import load_dotenv
load_dotenv()
```

### Authentication and Graph Definition

The Requester must connect to the Ravenverse using a unique token that they can generate by logging in on Raven's Website using their MetaMask wallet credentials.   

```python
import ravop as R
R.initialize('<TOKEN>')
```

### Defining a Graph

In the Ravenverse, each script executed by a requester is treated as a collection of Ravop Operations called Graph.<br> 
> **Note:** In the current release, the requester can execute only 1 graph with their unique token. Therefore, to clear any previous/existing graphs, the requester must use ```R.flush()``` method. <br>

The next step involves the creation of a Graph... 

```python
R.flush()

R.Graph(name='test', algorithm='addition', approach='distributed')
```
> **Note:** ```name``` and ```algorithm``` parameters can be set to any string. However, the ```approach``` needs to be set to either "distributed" or "federated". 

### Creating Math Operations (Ops)

```python
a = R.t([1, 2, 3])
b = R.t([4, 5, 6])
c = a + b
```

### Making Ops Persist

Persisting Ops are a special category of Ops that stay in the ravenverse once the graph gets executed. The requester must explicitly mention which ops they want to save in their code. It is a good idea to write the code such that persisting ops contain the relevant results (in this case, variable - c).

> **Note:** Make sure that the ```name``` parameter for each persisting Op is unique within a graph so that later it can be retrieved.

```python
c.persist_op(name='c_output')
```

### Activate the Graph

Once all Ops of the graph have been defined, the requester must activate their graph. This step completes the compilation procedure and makes the graph ready for execution. No more Ops can be added to the graph after this.

```python
R.activate()
```

### Execute the Graph
On execution, the graph will be split into smaller subgraphs which will be distributed to the participating compute nodes in the network. The requester can also track the progress of the graph.

```python
R.execute()
R.track_progress()
```

### Fetching Results

The Requester can now fetch the computed results of the Ops that they had previously set to persist.

```python
output = R.fetch_persisting_op(op_name="c_output")
print(output)
```

## Documentation
    
[Ravop documentation](https://ravenprotocol.gitbook.io/ravenverse/ravop)


## License

<a href="https://github.com/ravenprotocol/ravop/blob/main/LICENSE.rst"><img src="https://img.shields.io/github/license/ravenprotocol/ravop"></a>

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ravenprotocol/ravop",
    "name": "ravop",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Ravop,requester library",
    "author": "Raven Protocol",
    "author_email": "kailash@ravenprotocol.com",
    "download_url": "https://files.pythonhosted.org/packages/dd/c3/d493ec4b6ca50a65d93af41340db964880233b0532d8acc2df84f5ca5461/ravop-0.11.tar.gz",
    "platform": null,
    "description": "# Ravop\n\nRavop is one of the crucial build blocks of Ravenverse. It is a library for requesters to create and interact with ops, perform mathematical calculations, and write algorithms. \n\n## Installation\n\n```bash\npip install ravop\n```\n\n## Usage\n\nThis section covers how a requester can create a simple graph and include Ops for adding 2 Tensors using Ravop module.\n\n>**Note:** The complete scripts of the functionalities demonstrated in this document are available in the [Ravop Repository](https://github.com/ravenprotocol/ravop) in the ```examples``` folders.\n\n### Setting Environment Variables\nCreate a .env file and add the following environment variables:\n\n```bash\nRAVENVERSE_URL=http://0.0.0.0:9999\nRAVENVERSE_FTP_HOST=0.0.0.0\n```\n\nLoad environment variables at the beginning of your code using:\n\n```python\nfrom dotenv import load_dotenv\nload_dotenv()\n```\n\n### Authentication and Graph Definition\n\nThe Requester must connect to the Ravenverse using a unique token that they can generate by logging in on Raven's Website using their MetaMask wallet credentials.   \n\n```python\nimport ravop as R\nR.initialize('<TOKEN>')\n```\n\n### Defining a Graph\n\nIn the Ravenverse, each script executed by a requester is treated as a collection of Ravop Operations called Graph.<br> \n> **Note:** In the current release, the requester can execute only 1 graph with their unique token. Therefore, to clear any previous/existing graphs, the requester must use ```R.flush()``` method. <br>\n\nThe next step involves the creation of a Graph... \n\n```python\nR.flush()\n\nR.Graph(name='test', algorithm='addition', approach='distributed')\n```\n> **Note:** ```name``` and ```algorithm``` parameters can be set to any string. However, the ```approach``` needs to be set to either \"distributed\" or \"federated\". \n\n### Creating Math Operations (Ops)\n\n```python\na = R.t([1, 2, 3])\nb = R.t([4, 5, 6])\nc = a + b\n```\n\n### Making Ops Persist\n\nPersisting Ops are a special category of Ops that stay in the ravenverse once the graph gets executed. The requester must explicitly mention which ops they want to save in their code. It is a good idea to write the code such that persisting ops contain the relevant results (in this case, variable - c).\n\n> **Note:** Make sure that the ```name``` parameter for each persisting Op is unique within a graph so that later it can be retrieved.\n\n```python\nc.persist_op(name='c_output')\n```\n\n### Activate the Graph\n\nOnce all Ops of the graph have been defined, the requester must activate their graph. This step completes the compilation procedure and makes the graph ready for execution. No more Ops can be added to the graph after this.\n\n```python\nR.activate()\n```\n\n### Execute the Graph\nOn execution, the graph will be split into smaller subgraphs which will be distributed to the participating compute nodes in the network. The requester can also track the progress of the graph.\n\n```python\nR.execute()\nR.track_progress()\n```\n\n### Fetching Results\n\nThe Requester can now fetch the computed results of the Ops that they had previously set to persist.\n\n```python\noutput = R.fetch_persisting_op(op_name=\"c_output\")\nprint(output)\n```\n\n## Documentation\n    \n[Ravop documentation](https://ravenprotocol.gitbook.io/ravenverse/ravop)\n\n\n## License\n\n<a href=\"https://github.com/ravenprotocol/ravop/blob/main/LICENSE.rst\"><img src=\"https://img.shields.io/github/license/ravenprotocol/ravop\"></a>\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "",
    "version": "0.11",
    "split_keywords": [
        "ravop",
        "requester library"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ddc3d493ec4b6ca50a65d93af41340db964880233b0532d8acc2df84f5ca5461",
                "md5": "663ad6865eaba26af59334363bca5302",
                "sha256": "fa271e9cf097dba10876c8615f879753a33979eba7f01dda9dab0ee9d34374db"
            },
            "downloads": -1,
            "filename": "ravop-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "663ad6865eaba26af59334363bca5302",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18129,
            "upload_time": "2023-02-07T14:30:51",
            "upload_time_iso_8601": "2023-02-07T14:30:51.307637Z",
            "url": "https://files.pythonhosted.org/packages/dd/c3/d493ec4b6ca50a65d93af41340db964880233b0532d8acc2df84f5ca5461/ravop-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-07 14:30:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "ravenprotocol",
    "github_project": "ravop",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.21.5"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.27.1"
                ]
            ]
        },
        {
            "name": "python-socketio",
            "specs": [
                [
                    "==",
                    "5.4.1"
                ]
            ]
        },
        {
            "name": "python-engineio",
            "specs": [
                [
                    "==",
                    "4.2.1"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    "==",
                    "0.20.0"
                ]
            ]
        },
        {
            "name": "speedtest-cli",
            "specs": [
                [
                    "==",
                    "2.1.3"
                ]
            ]
        },
        {
            "name": "alive-progress",
            "specs": [
                [
                    "==",
                    "2.4.1"
                ]
            ]
        }
    ],
    "lcname": "ravop"
}
        
Elapsed time: 0.07006s