Package: ravop
RavopRavop 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.InstallationpipinstallravopUsageThis 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 theRavop Repositoryin theexamplesfolders.Setting Environment VariablesCreate a .env file and add the following environment variables:RAVENVERSE_URL=http://0.0.0.0:9999RAVENVERSE_FTP_HOST=0.0.0.0Load environment variables at the beginning of your code using:fromdotenvimportload_dotenvload_dotenv()Authentication and Graph DefinitionThe 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.importravopasRR.initialize('<TOKEN>')Defining a GraphIn the Ravenverse, each script executed by a requester is treated as a collection of Ravop Operations called Graph.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 useR.flush()method.The next step involves the creation of a Graph...R.flush()R.Graph(name='test',algorithm='addition',approach='distributed')Note:nameandalgorithmparameters can be set to any string. However, theapproachneeds to be set to either "distributed" or "federated".Creating Math Operations (Ops)a=R.t([1,2,3])b=R.t([4,5,6])c=a+bMaking Ops PersistPersisting 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 thenameparameter for each persisting Op is unique within a graph so that later it can be retrieved.c.persist_op(name='c_output')Activate the GraphOnce 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.R.activate()This function displays the cost of the graph and the maximum number of allowable Providers that can compute this graph.Execute the GraphOn 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.R.execute(participants=1)R.track_progress()Theparticipantsparameter must be a number less than the maximum number of allowable Providers (displayed after activation). This will be the number of Providers allowed to participate in the graph. The computation will begin only once this number of Providers are actively participating in this graph.Fetching ResultsThe Requester can now fetch the computed results of the Ops that they had previously set to persist.output=R.fetch_persisting_op(op_name="c_output")print(output)DocumentationRavop documentationLicenseThis project is licensed under the MIT License - see theLICENSEfile for details