<commit_before>#
# Cookbook Name:: hadoop_cluster
# Recipe::        make_standard_hdfs_dirs
#
# Copyright 2010, Infochimps, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# Make the standard HDFS directories:
#
#   /tmp
#   /user
#   /user/hive/warehouse
#
# and
#
#   /user/USERNAME
#
# for each user in the 'supergroup' group.
#
# I'd love feedback on whether this can be made less kludgey,
# and whether the logic for creating the user dirs makes sense.

# This is a bit kludgey, but it minimizes hits to the HDFS
# Also, quoting Tom White:
#   "The [chmod +w] is questionable, as it allows a user to delete another
#    user. It's needed to allow users to create their own user directories"
execute 'create user dirs on HDFS' do
  only_if "service hadoop-0.20-namenode status"
  not_if do File.exists?("/mnt/hadoop/logs/made_initial_dirs.log") end
  user 'hdfs'
  command %Q{
    hadoop_users=/user/"`grep supergroup /etc/group | cut -d: -f4 | sed -e 's|,| /user/|g'`" ;
    hadoop fs -mkdir    /tmp /user /user/hive/warehouse $hadoop_users;
    hadoop fs -chmod +w /tmp /user /user/hive/warehouse;
    hadoop fs -mkdir           /hadoop/system
    hadoop fs -chown -R mapred /hadoop/system
    hadoop fs -mkdir           /hadoop/hbase<commit_msg>std hdfs dirs -- chmod a+w since permissions matter now<commit_after>#
# Cookbook Name:: hadoop_cluster
# Recipe::        make_standard_hdfs_dirs
#
# Copyright 2010, Infochimps, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# Make the standard HDFS directories:
#
#   /tmp
#   /user
#   /user/hive/warehouse
#
# and
#
#   /user/USERNAME
#
# for each user in the 'supergroup' group.
#
# I'd love feedback on whether this can be made less kludgey,
# and whether the logic for creating the user dirs makes sense.

# This is a bit kludgey, but it minimizes hits to the HDFS
# Also, quoting Tom White:
#   "The [chmod +w] is questionable, as it allows a user to delete another
#    user. It's needed to allow users to create their own user directories"
execute 'create user dirs on HDFS' do
  only_if "service hadoop-0.20-namenode status"
  not_if do File.exists?("/mnt/hadoop/logs/made_initial_dirs.log") end
  user 'hdfs'
  command %Q{
    hadoop_users=/user/"`grep supergroup /etc/group | cut -d: -f4 | sed -e 's|,| /user/|g'`" ;
    hadoop fs -mkdir    /tmp /user /user/hive/warehouse $hadoop_users;
    hadoop fs -chmod a+w /tmp /user /user/hive/warehouse;
    hadoop fs -mkdir           /hadoop/system
    hadoop fs -chown -R mapred /hadoop/system
    hadoop fs -mkdir           /hadoop/hbase
{'fraction_non_alphanumeric': 0.0951445411170362, 'fraction_numerical': 0.006735896716250351, 'mean_word_length': 3.314769975786925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4906177', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1106, 'n_words': 457}