<commit_before># install g++, which is required for building Montage
package "g++" do
  options "--force-yes"
end

# download Montage binaries
remote_file "#{Chef::Config[:file_cache_path]}/#{node[:saasfee][:montage][:targz]}" do
  source node[:saasfee][:montage][:url]
  owner node[:saasfee][:user]
  group node[:hadoop][:group]
  mode "0775"
  action :create_if_missing
end

# install Montage
bash "install_montage" do
  user node[:saasfee][:user]
  group node[:hadoop][:group]
  code <<-EOH
  set -e && set -o pipefail
    tar xvfz #{Chef::Config[:file_cache_path]}/#{node[:saasfee][:montage][:targz]} -C #{node[:saasfee][:software][:dir]}
    make -C #{node[:saasfee][:montage][:home]}
  EOH
  not_if { ::File.exist?("#{node[:saasfee][:montage][:home]}/bin/mDAG") }
end

# add Montage executables to /usr/bin
bash 'update_env_variables' do
  user "root"
  code <<-EOH
  set -e && set -o pipefail
    ln -s #{node[:saasfee][:montage][:home]}/bin/* /usr/bin/
  EOH
  not_if { ::File.exist?("/usr/bin/mDAG") }
end

# create input data directory
directory "#{node[:saasfee][:data]}/montage" do
  owner node[:saasfee][:user]
  group node[:hadoop][:group]
  mode "755"
  action :create
end

# obtain input data
bash "obtain_montage_input_data" do
  user node[:saasfee][:user]
  group node[:hadoop][:group]
  timeout 604800
  code <<-EOH
  set -e && set -o pipefail
    cd #{node[:saasfee][:data]}/montage
    mDAG 2mass j #{node[:saasfee][:montage][:region]} #{node[:saasfee][:montage][:degree]} #{node[:saasfee][:montage][:degree]} 0.000278 #{node[:saasfee][:data]}/montage file:/ | grep -o '[0-9_]*' > #{Chef::Config[:file_cache_path]}/id
    sed -i "s#_`cat #{Chef::Config[:file_cache_path]}/id`##g" #{node[:saasfee][:data]}/montage/*
    for i in 2mass big_region.hdr cache.list cimages dag.xml diffs.tbl images.tbl pimages.tbl region rimages.tbl shrunken.hdr slist.tbl statfile.tbl url.list; do
      sed -i "s#file=\\"$i#file=\\"montage/$i#g" #{node[:saasfee][:data]}/montage/dag.xml
    done
    cp #{node[:saasfee][:data]}/montage/dag.xml #{node[:saasfee][:workflows]}/montage.xml
    mArchiveExec images.tbl
  EOH<commit_msg>id from chef temp folder to data folder<commit_after># install g++, which is required for building Montage
package "g++" do
  options "--force-yes"
end

# download Montage binaries
remote_file "#{Chef::Config[:file_cache_path]}/#{node[:saasfee][:montage][:targz]}" do
  source node[:saasfee][:montage][:url]
  owner node[:saasfee][:user]
  group node[:hadoop][:group]
  mode "0775"
  action :create_if_missing
end

# install Montage
bash "install_montage" do
  user node[:saasfee][:user]
  group node[:hadoop][:group]
  code <<-EOH
  set -e && set -o pipefail
    tar xvfz #{Chef::Config[:file_cache_path]}/#{node[:saasfee][:montage][:targz]} -C #{node[:saasfee][:software][:dir]}
    make -C #{node[:saasfee][:montage][:home]}
  EOH
  not_if { ::File.exist?("#{node[:saasfee][:montage][:home]}/bin/mDAG") }
end

# add Montage executables to /usr/bin
bash 'update_env_variables' do
  user "root"
  code <<-EOH
  set -e && set -o pipefail
    ln -s #{node[:saasfee][:montage][:home]}/bin/* /usr/bin/
  EOH
  not_if { ::File.exist?("/usr/bin/mDAG") }
end

# create input data directory
directory "#{node[:saasfee][:data]}/montage" do
  owner node[:saasfee][:user]
  group node[:hadoop][:group]
  mode "755"
  action :create
end

# obtain input data
bash "obtain_montage_input_data" do
  user node[:saasfee][:user]
  group node[:hadoop][:group]
  timeout 604800
  code <<-EOH
  set -e && set -o pipefail
    cd #{node[:saasfee][:data]}/montage
    mDAG 2mass j #{node[:saasfee][:montage][:region]} #{node[:saasfee][:montage][:degree]} #{node[:saasfee][:montage][:degree]} 0.000278 #{node[:saasfee][:data]}/montage file:/ | grep -o '[0-9_]*' > #{node[:saasfee][:data]}/id
    sed -i "s#_`cat #{node[:saasfee][:data]}/id`##g" #{node[:saasfee][:data]}/montage/*
    for i in 2mass big_region.hdr cache.list cimages dag.xml diffs.tbl images.tbl pimages.tbl region rimages.tbl shrunken.hdr slist.tbl statfile.tbl url.list; do
      sed -i "s#file=\\"$i#file=\\"montage/$i#g" #{node[:saasfee][:data]}/montage/dag.xml
    done
    cp #{node[:saasfee][:data]}/montage/dag.xml #{node[:saasfee][:workflows]}/montage.xml
    mArchiveExec images.tbl
  EOH
{'fraction_non_alphanumeric': 0.1989700374531835, 'fraction_numerical': 0.011235955056179775, 'mean_word_length': 4.934722222222222, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2818799', 'n_tokens_mistral': 1718, 'n_tokens_neox': 1659, 'n_words': 344}