README.md

output: html_document: default pdf_document: default

ravana

The super simple R library for distributed computing using map-reduce.

Setup

1. Install PostgreSQL 13 or greater from https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

  1. Install ravana package by using this command in R: devtools::install_github("arupkamal/ravana")

  2. Create the Ravana database by running this SQL: https://github.com/arupkamal/ravana/blob/main/Database%20Setup/01_database_setup.sql

  3. Create the Ravana user by running this SQL: https://github.com/arupkamal/ravana/blob/main/Database%20Setup/02_role_setup.sql

  4. Create the Ravana tables by running this SQL: https://github.com/arupkamal/ravana/blob/main/Database%20Setup/03_table_setup.sql

  5. Create the Ravana functions by running this SQL: https://github.com/arupkamal/ravana/blob/main/Database%20Setup/04_function_setup.sql

Getting started

Setting up a Cluster

  1. Install R in the master node.

  2. Install ravana package by using this command in R: devtools::install_github("arupkamal/ravana")

  3. 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.

  1. Install ravana package by using this command in R: devtools::install_github("arupkamal/ravana")

  2. Create the worker.R file with the following code:

  library(ravana)
  init_cluster('Ravana', settingspath  = 'C:/R')
  set_worker()
  run_worker()
  disconnect()
  



arupkamal/ravana documentation built on Dec. 19, 2021, 5:34 a.m.