From 4e52e2578345024521c6438f3ae4f7bc30c5b835 Mon Sep 17 00:00:00 2001 From: selmazrg Date: Mon, 19 Jun 2023 14:09:26 +0200 Subject: [PATCH] feat(sparkR): integration of sparkr --- roles/spark/client/tasks/install.yml | 16 ++++++++++++++++ .../common/templates/sparkr-shell-command.j2 | 7 +++++++ tdp_vars_defaults/spark/spark.yml | 3 +++ tdp_vars_defaults/spark3/spark3.yml | 3 +++ 4 files changed, 29 insertions(+) create mode 100644 roles/spark/common/templates/sparkr-shell-command.j2 diff --git a/roles/spark/client/tasks/install.yml b/roles/spark/client/tasks/install.yml index 2a52d2dd..df0aced5 100644 --- a/roles/spark/client/tasks/install.yml +++ b/roles/spark/client/tasks/install.yml @@ -67,3 +67,19 @@ owner: root group: root mode: "755" + +- name: "Render /usr/bin/{{ spark_version }}R-shell command" + ansible.builtin.template: + src: sparkr-shell-command.j2 + dest: "/usr/bin/{{ spark_version }}r-shell" + owner: root + group: root + mode: "755" + when: (spark_version == "spark3") and spark_enable_r + +- name: Create symbolic link to R library + ansible.builtin.file: + src: "{{ spark_install_dir }}/R/lib/SparkR" + dest: "/usr/lib64/R/library/SparkR" + state: link + when: (spark_version == "spark3") and spark_enable_r diff --git a/roles/spark/common/templates/sparkr-shell-command.j2 b/roles/spark/common/templates/sparkr-shell-command.j2 new file mode 100644 index 00000000..a35e0ca6 --- /dev/null +++ b/roles/spark/common/templates/sparkr-shell-command.j2 @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + + +export YARN_CONF_DIR=/etc/hadoop/conf + + +/opt/tdp/spark3/bin/sparkR "$@" diff --git a/tdp_vars_defaults/spark/spark.yml b/tdp_vars_defaults/spark/spark.yml index f93a225b..ca890b83 100644 --- a/tdp_vars_defaults/spark/spark.yml +++ b/tdp_vars_defaults/spark/spark.yml @@ -32,6 +32,9 @@ hbase_install_dir: "{{ spark_root_dir }}/hbase" # Spark pid directories spark_pid_dir: /var/run/spark +# SparkR +spark_enable_r: false + #Spark logging configuration # Root logger should be: [RFA | DRFA] spark_root_logger: RFA diff --git a/tdp_vars_defaults/spark3/spark3.yml b/tdp_vars_defaults/spark3/spark3.yml index 9f70449c..5f7d076e 100644 --- a/tdp_vars_defaults/spark3/spark3.yml +++ b/tdp_vars_defaults/spark3/spark3.yml @@ -27,6 +27,9 @@ spark_hs_conf_dir: "{{ spark_conf_dir }}/conf.hs" # Spark pid directories spark_pid_dir: /var/run/spark3 +# SparkR +spark_enable_r: false + #Spark3 logging configuration # Root logger should be: [RFA | DRFA] spark_root_logger: RFA