Module: Pwrake::GfarmFileSystemOption

Included in:
Option
Defined in:
lib/pwrake/option/option_gfarm2fs.rb

Instance Method Summary collapse

Instance Method Details

#clear_gfarm2fsObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/pwrake/option/option_gfarm2fs.rb', line 67

def clear_gfarm2fs
  setup_hosts
  d = File.join(self['GFARM_BASEDIR'],self['GFARM_PREFIX'])
  rcmd = "
for i in #{d}*; do
  if [ -d \"$i\" ]; then
case \"$i\" in
  *_000) ;;
  *) fusermount -u $i; rmdir $i ;;
esac
  fi
done
sleep 1
for i in #{d}*_000; do
  if [ -d \"$i\" ]; then
fusermount -u $i; rmdir $i
  fi
done
"
  threads = []
  @host_map.each do |k,hosts|
    hosts.each do |info|
      threads << Thread.new do
        system "ssh #{info.name} '#{rcmd}'"
      end
    end
  end
  threads.each{|t| t.join}
end

#max_postprocess_poolObject



59
60
61
# File 'lib/pwrake/option/option_gfarm2fs.rb', line 59

def max_postprocess_pool
  self['MAX_GFWHERE_WORKER']
end

#option_data_filesystemObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pwrake/option/option_gfarm2fs.rb', line 9

def option_data_filesystem
  [
    'GFARM2FS_OPTION',
    'GFARM2FS_DEBUG',
    ['GFARM2FS_DEBUG_WAIT', proc{|v| v ? v.to_i : 1}],
    ['DISABLE_AFFINITY', proc{|v| v || ENV['AFFINITY']=='off'}],
    ['DISABLE_STEAL', proc{|v| v || ENV['STEAL']=='off'}],
    ['GFARM_BASEDIR', proc{|v| v || '/tmp'}],
    ['GFARM_PREFIX', proc{|v| v || "pwrake_#{ENV['USER']}"}],
    ['GFARM_SUBDIR', proc{|v| v || '/'}],
    ['MAX_GFWHERE_WORKER', proc{|v| (v || 8).to_i}],
  ]
end

#postprocess(runner) ⇒ Object



63
64
65
# File 'lib/pwrake/option/option_gfarm2fs.rb', line 63

def postprocess(runner)
  GfarmPostprocess.new(runner)
end

#set_filesystem_optionObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/pwrake/option/option_gfarm2fs.rb', line 23

def set_filesystem_option
  @filesystem  = 'gfarm'
  GfarmPath.subdir = self['GFARM_SUBDIR']
  @worker_option = {
    :log_dir   => self['LOG_DIR'],
    :pass_env  => self['PASS_ENV'],
    :ssh_option => self['SSH_OPTION'],
    :heartbeat => self['HEARTBEAT'],
    #
    :shared_directory => "GfarmDirectory",
    :base_dir => self['GFARM_BASEDIR']+"/"+self['GFARM_PREFIX'],
    :work_dir => GfarmPath.pwd.to_s,
    :gfarm2fs_option => self['GFARM2FS_OPTION'],
    :gfarm2fs_debug => self['GFARM2FS_DEBUG'],
    :gfarm2fs_debug_wait => self['GFARM2FS_DEBUG_WAIT'],
    :single_mp => self['GFARM_SINGLE_MP']
  }
  @worker_progs = %w[
    parallel/processor_count.rb
    pwrake/nbio
    pwrake/branch/fiber_queue
    pwrake/worker/writer
    pwrake/worker/log_executor
    pwrake/worker/executor
    pwrake/worker/invoker
    pwrake/worker/shared_directory
    pwrake/worker/gfarm_directory
    pwrake/worker/worker_main
  ]
  if self['DISABLE_AFFINITY']
    @queue_class = "TaskQueue"
  else
    @queue_class = "LocalityAwareQueue"
  end
end