diff options
author | demon <demon@FreeBSD.org> | 2015-02-16 21:16:34 +0800 |
---|---|---|
committer | demon <demon@FreeBSD.org> | 2015-02-16 21:16:34 +0800 |
commit | d33662a7cca4a3fb52c714fe8fc101563c61572c (patch) | |
tree | 92344984c9643018e99a3281009eab18a86b3e0c | |
parent | 5d3c2a201831a8848afd9b3e9562862154842fde (diff) | |
download | freebsd-ports-gnome-d33662a7cca4a3fb52c714fe8fc101563c61572c.tar.gz freebsd-ports-gnome-d33662a7cca4a3fb52c714fe8fc101563c61572c.tar.zst freebsd-ports-gnome-d33662a7cca4a3fb52c714fe8fc101563c61572c.zip |
Protect datanode and nodemanager daemons from being killed on OOM condition.
They run on worker nodes where users run their code and can easily consume
all RAM.
-rw-r--r-- | devel/hadoop2/files/datanode.in | 9 | ||||
-rw-r--r-- | devel/hadoop2/files/nodemanager.in | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/devel/hadoop2/files/datanode.in b/devel/hadoop2/files/datanode.in index b825f046a890..8c48752f1f3b 100644 --- a/devel/hadoop2/files/datanode.in +++ b/devel/hadoop2/files/datanode.in @@ -14,6 +14,7 @@ export PATH=${PATH}:%%LOCALBASE%%/bin name=datanode rcvar=datanode_enable +pidfile=%%HADOOP_RUNDIR%%/hadoop-%%HDFS_USER%%-${name}.pid load_rc_config "${name}" @@ -23,8 +24,16 @@ load_rc_config "${name}" command="%%PREFIX%%/sbin/hadoop-daemon.sh" command_args='--config %%ETCDIR%% start datanode' +start_postcmd="start_postcmd" stop_cmd=datanode_stop +start_postcmd () { + rc_pid=$(check_pidfile ${pidfile} %%JAVA_HOME%%/bin/java) + if [ -n "$rc_pid" ]; then + protect -p $rc_pid + fi +} + datanode_stop () { su -m ${datanode_user} -c "${command} --config %%ETCDIR%% stop datanode" } diff --git a/devel/hadoop2/files/nodemanager.in b/devel/hadoop2/files/nodemanager.in index 6a180fe7a105..ee1252ec27ea 100644 --- a/devel/hadoop2/files/nodemanager.in +++ b/devel/hadoop2/files/nodemanager.in @@ -14,6 +14,7 @@ export PATH=${PATH}:%%LOCALBASE%%/bin name=nodemanager rcvar=nodemanager_enable +pidfile=%%HADOOP_RUNDIR%%/yarn-yarn-${name}.pid load_rc_config "${name}" @@ -23,8 +24,16 @@ load_rc_config "${name}" command="%%PREFIX%%/sbin/yarn-daemon.sh" command_args='--config %%ETCDIR%% start nodemanager' +start_postcmd="start_postcmd" stop_cmd=nodemanager_stop +start_postcmd () { + rc_pid=$(check_pidfile ${pidfile} %%JAVA_HOME%%/bin/java) + if [ -n "$rc_pid" ]; then + protect -p $rc_pid + fi +} + nodemanager_stop () { su -m ${nodemanager_user} -c "${command} --config %%ETCDIR%% stop nodemanager" } |