<commit_before>
url = require 'url'

###
http://hadoop.apache.org/docs/r2.1.0-beta/hadoop-project-dist/hadoop-common/ClusterSetup.html
###
lifecyle = module.exports =
  # jn_status: (ctx, callback) ->
  #   ctx.execute
  #     cmd: "service hadoop-hdfs-journalnode status"
  #     code_skipped: [1, 3]
  #   , callback
  # jn_start: (ctx, callback) ->
  #   {hdfs, hadoop_conf_dir} = ctx.config.ryba
  #   lifecyle.jn_status ctx, (err, running) ->
  #     return callback err, false if err or running
  #     ctx.log "JournalNode start"
  #     ctx.execute
  #       # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf --script hdfs start journalnode"
  #       # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh --config #{hadoop_conf_dir} --script hdfs start journalnode\""
  #       cmd: 'service hadoop-hdfs-journalnode start'
  #       # code_skipped: 1
  #     , (err, started) ->
  #       return callback err if err
  #       ctx.waitIsOpen ctx.config.host, 8485, timeout: 20000, (err) ->
  #         callback err, started
  # jn_stop: (ctx, callback) ->
  #   {hdfs, hadoop_conf_dir} = ctx.config.ryba
  #   lifecyle.jn_status ctx, (err, running) ->
  #     return callback err, false if err or not running
  #     ctx.log "JournalNode stop"
  #     ctx.execute
  #       # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf --script hdfs stop journalnode"
  #       # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh --config #{hadoop_conf_dir} --script hdfs stop journalnode\""
  #       cmd: 'service hadoop-hdfs-journalnode stop'
  #       # code_skipped: 1
  #     , callback
  nn_status: (ctx, callback) ->
    ctx.execute
      cmd: "service hadoop-hdfs-namenode status"
      code_skipped: [1, 3]
    , callback
  nn_start: (ctx, callback) ->
    lifecyle.nn_status ctx, (err, running) ->
      return callback err, false if err or running
      ctx.log "NameNode start"
      ctx.execute
        # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf --script hdfs start namenode"
        # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh --config #{hadoop_conf_dir} --script hdfs start namenode\""
        cmd: "service hadoop-hdfs-namenode start"
        code_skipped: [1, 3]
      , callback
  nn_stop: (ctx, callback) ->
    {hdfs, hadoop_conf_dir} = ctx.config.ryba
    lifecyle.nn_status ctx, (err, running) ->
      return callback err, false if err or not running
      ctx.log "NameNode stop"
      ctx.execute
        # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf --script hdfs stop namenode"
        # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh --config #{hadoop_conf_dir} --script hdfs stop namenode\""
        cmd: 'service hadoop-hdfs-namenode stop'
        # code_skipped: 1
      , callback
  nn_restart: (ctx, callback) ->
    ctx.log "NameNode restart"
    lifecyle.nn_stop ctx, (err) ->
      return callback err if err
      lifecyle.nn_start ctx, callback
  zkfc_status: (ctx, callback) ->
    ctx.execute
      cmd: "service hadoop-hdfs-zkfc status"
      code_skipped: [1, 3]
    , callback
  zkfc_start: (ctx, callback) ->
    {hdfs} = ctx.config.ryba
    lifecyle.zkfc_status ctx, (err, running) ->
      return callback err, false if err or running
      ctx.log "ZKFC start"
      ctx.execute
        # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh start zkfc"
        # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh start zkfc\""
        cmd: 'service hadoop-hdfs-zkfc start'
        # code_skipped: 1<commit_msg>lifecycle: comment nn<commit_after>
url = require 'url'

###
http://hadoop.apache.org/docs/r2.1.0-beta/hadoop-project-dist/hadoop-common/ClusterSetup.html
###
lifecyle = module.exports =
  # jn_status: (ctx, callback) ->
  #   ctx.execute
  #     cmd: "service hadoop-hdfs-journalnode status"
  #     code_skipped: [1, 3]
  #   , callback
  # jn_start: (ctx, callback) ->
  #   {hdfs, hadoop_conf_dir} = ctx.config.ryba
  #   lifecyle.jn_status ctx, (err, running) ->
  #     return callback err, false if err or running
  #     ctx.log "JournalNode start"
  #     ctx.execute
  #       # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf --script hdfs start journalnode"
  #       # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh --config #{hadoop_conf_dir} --script hdfs start journalnode\""
  #       cmd: 'service hadoop-hdfs-journalnode start'
  #       # code_skipped: 1
  #     , (err, started) ->
  #       return callback err if err
  #       ctx.waitIsOpen ctx.config.host, 8485, timeout: 20000, (err) ->
  #         callback err, started
  # jn_stop: (ctx, callback) ->
  #   {hdfs, hadoop_conf_dir} = ctx.config.ryba
  #   lifecyle.jn_status ctx, (err, running) ->
  #     return callback err, false if err or not running
  #     ctx.log "JournalNode stop"
  #     ctx.execute
  #       # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf --script hdfs stop journalnode"
  #       # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh --config #{hadoop_conf_dir} --script hdfs stop journalnode\""
  #       cmd: 'service hadoop-hdfs-journalnode stop'
  #       # code_skipped: 1
  #     , callback
  # nn_status: (ctx, callback) ->
  #   ctx.execute
  #     cmd: "service hadoop-hdfs-namenode status"
  #     code_skipped: [1, 3]
  #   , callback
  # nn_start: (ctx, callback) ->
  #   lifecyle.nn_status ctx, (err, running) ->
  #     return callback err, false if err or running
  #     ctx.log "NameNode start"
  #     ctx.execute
  #       # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf --script hdfs start namenode"
  #       # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh --config #{hadoop_conf_dir} --script hdfs start namenode\""
  #       cmd: "service hadoop-hdfs-namenode start"
  #       code_skipped: [1, 3]
  #     , callback
  # nn_stop: (ctx, callback) ->
  #   {hdfs, hadoop_conf_dir} = ctx.config.ryba
  #   lifecyle.nn_status ctx, (err, running) ->
  #     return callback err, false if err or not running
  #     ctx.log "NameNode stop"
  #     ctx.execute
  #       # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf --script hdfs stop namenode"
  #       # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh --config #{hadoop_conf_dir} --script hdfs stop namenode\""
  #       cmd: 'service hadoop-hdfs-namenode stop'
  #       # code_skipped: 1
  #     , callback
  # nn_restart: (ctx, callback) ->
  #   ctx.log "NameNode restart"
  #   lifecyle.nn_stop ctx, (err) ->
  #     return callback err if err
  #     lifecyle.nn_start ctx, callback
  zkfc_status: (ctx, callback) ->
    ctx.execute
      cmd: "service hadoop-hdfs-zkfc status"
      code_skipped: [1, 3]
    , callback
  zkfc_start: (ctx, callback) ->
    {hdfs} = ctx.config.ryba
    lifecyle.zkfc_status ctx, (err, running) ->
      return callback err, false if err or running
      ctx.log "ZKFC start"
      ctx.execute
        # su -l hdfs -c "/usr/lib/hadoop/sbin/hadoop-daemon.sh start zkfc"
        # cmd: "su -l #{hdfs.user.name} -c \"/usr/lib/hadoop/sbin/hadoop-daemon.sh start zkfc\""
        cmd: 'service hadoop-hdfs-zkfc start'
        # code_skipped: 1
{'fraction_non_alphanumeric': 0.1448386236329688, 'fraction_numerical': 0.0064017071218991735, 'mean_word_length': 2.4430670339761247, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6846407', 'n_tokens_mistral': 2791, 'n_tokens_neox': 2752, 'n_words': 651}