output: html_document: default pdf_document: default
The super simple R library for distributed computing using map-reduce.
Install ravana package by using this command in R: devtools::install_github("arupkamal/ravana")
Create the Ravana database by running this SQL: https://github.com/arupkamal/ravana/blob/main/Database%20Setup/01_database_setup.sql
Create the Ravana user by running this SQL: https://github.com/arupkamal/ravana/blob/main/Database%20Setup/02_role_setup.sql
Create the Ravana tables by running this SQL: https://github.com/arupkamal/ravana/blob/main/Database%20Setup/03_table_setup.sql
Create the Ravana functions by running this SQL: https://github.com/arupkamal/ravana/blob/main/Database%20Setup/04_function_setup.sql
Install R in the master node.
Install ravana package by using this command in R: devtools::install_github("arupkamal/ravana")
Create the ravana.R file with the following code:
library(ravana)init_cluster('Ravana', settingspath = 'C:/R')
is_prime <- function(n) { n == 2L || all(n %% 2L:max(2,floor(sqrt(n))) != 0) }
check these numebers if they are primes
numbers_to_check <- seq(1000001, 1010001, 2)
share the function in the cluster
share_function(is_prime)
share the object in the cluster
share_object(numbers_to_check)
taskid <- ravana_map(is_prime, numbers_to_check) res = ravana_reduce(taskid)
print all the Prime numbers found through this process
print(res[res$mappedresults==TRUE,]$mappedparameters)
Setting up a Worker node
1. Install R in the worker node.Install ravana package by using this command in R: devtools::install_github("arupkamal/ravana")
Create the worker.R file with the following code:
library(ravana) init_cluster('Ravana', settingspath = 'C:/R') set_worker() run_worker() disconnect()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.