workflow_manager 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/wfm_attack +169 -0
- data/lib/workflow_manager/cluster.rb +1 -1
- data/lib/workflow_manager/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bfc8ab86725ea91ec1127b3747cd0a88dfdf88d
|
4
|
+
data.tar.gz: d2949c18e76ee79369cf21b6448071724812508f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a58dd55438cc92db970374c99796dcb9604fb52104f27ff5a7bae2f70eb1b008fb0758a1afa0d5f04b05ff91ca47d2ad5318aeca601806df0f0a4153077dc4
|
7
|
+
data.tar.gz: 2cf236c75abfd814fbf42ba54605ec8240ed89bfebc3690dbf4aeaa7406d985242cf048d1ed423997ce5d1309f1a40cbfd34a634a0605d13f35072d3df47eab7
|
data/bin/wfm_attack
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
Version = '20180308-150906'
|
4
|
+
|
5
|
+
require 'drb/drb'
|
6
|
+
require 'ruby-progressbar'
|
7
|
+
require 'parallel'
|
8
|
+
require 'tempfile'
|
9
|
+
|
10
|
+
def help
|
11
|
+
puts "Usage:"
|
12
|
+
puts " #{File.basename(__FILE__)} druby://host_name:port_number (options)"
|
13
|
+
puts
|
14
|
+
puts "Example:"
|
15
|
+
puts " #{File.basename(__FILE__)} druby://local_host:4000 -d 10 -r 100 > report.html"
|
16
|
+
puts " #{File.basename(__FILE__)} druby://local_host:4000 -d 10 -r 10 -m monitoring -n node-01 > report.html"
|
17
|
+
puts
|
18
|
+
puts "Options:"
|
19
|
+
puts " -d duration (default: 10 (s))"
|
20
|
+
puts " -r rate: (default: 10 (times))"
|
21
|
+
puts " -m call_method: [hello, monitoring] (default: hello)"
|
22
|
+
puts " -n sge_option: job submit node, required with -m option"
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
unless uri = ARGV[0]
|
26
|
+
help
|
27
|
+
end
|
28
|
+
duration = if idx = ARGV.index("-d")
|
29
|
+
ARGV[idx+1].to_i
|
30
|
+
else
|
31
|
+
10
|
32
|
+
end
|
33
|
+
rate = if idx = ARGV.index("-r")
|
34
|
+
ARGV[idx+1].to_i
|
35
|
+
else
|
36
|
+
10
|
37
|
+
end
|
38
|
+
|
39
|
+
call_method = if idx = ARGV.index("-m")
|
40
|
+
ARGV[idx+1].to_sym
|
41
|
+
else
|
42
|
+
:hello
|
43
|
+
end
|
44
|
+
sge_option = if idx = ARGV.index("-n")
|
45
|
+
ARGV[idx+1]
|
46
|
+
elsif call_method == :monitoring
|
47
|
+
puts
|
48
|
+
puts "WARNING: You need -n option with -m monitoring"
|
49
|
+
puts
|
50
|
+
help
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
template =<<-EOS
|
55
|
+
<head>
|
56
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.min.js"></script>
|
57
|
+
</head>
|
58
|
+
|
59
|
+
<body>
|
60
|
+
<canvas id="stage"></canvas>
|
61
|
+
<script>
|
62
|
+
var mydata = {
|
63
|
+
labels: LABELS_ARRAY,
|
64
|
+
datasets: [
|
65
|
+
{
|
66
|
+
label: 'wfm_attack',
|
67
|
+
fill: false,
|
68
|
+
data: DATA_ARRAY,
|
69
|
+
}
|
70
|
+
]
|
71
|
+
};
|
72
|
+
|
73
|
+
var options = {
|
74
|
+
title: {
|
75
|
+
display: true,
|
76
|
+
text: 'Latency'
|
77
|
+
},
|
78
|
+
|
79
|
+
scales: {
|
80
|
+
xAxes: [{
|
81
|
+
position: 'bottom',
|
82
|
+
scaleLabel: {
|
83
|
+
display: true,
|
84
|
+
labelString: 'Elapsed time [s]'
|
85
|
+
},
|
86
|
+
ticks: {
|
87
|
+
callback: function(value) {return (Math.pow(value - Math.round(value), 2) < 0.2/RATE ? Math.round(value) : '')},
|
88
|
+
min: 0,
|
89
|
+
max: DURATION,
|
90
|
+
stepSize: 1
|
91
|
+
}
|
92
|
+
}],
|
93
|
+
|
94
|
+
yAxes: [{
|
95
|
+
scaleLabel: {
|
96
|
+
display: true,
|
97
|
+
labelString: 'Latency [s]'
|
98
|
+
},
|
99
|
+
}]
|
100
|
+
}
|
101
|
+
};
|
102
|
+
|
103
|
+
var canvas = document.getElementById('stage');
|
104
|
+
var chart = new Chart(canvas, {
|
105
|
+
type: 'line',
|
106
|
+
data: mydata,
|
107
|
+
options: options
|
108
|
+
});
|
109
|
+
</script>
|
110
|
+
</body>
|
111
|
+
EOS
|
112
|
+
|
113
|
+
labels = data = nil
|
114
|
+
make_html =->(labels, data){
|
115
|
+
template.gsub(/LABELS_ARRAY/, labels).gsub(/DATA_ARRAY/, data).gsub(/DURATION/, duration.to_s).gsub(/RATE/, rate.to_s)
|
116
|
+
}
|
117
|
+
|
118
|
+
workflow_manager = DRbObject.new_with_uri(uri)
|
119
|
+
threads = rate
|
120
|
+
wait_time = duration.to_f/rate
|
121
|
+
commands = []
|
122
|
+
threads.times do |i|
|
123
|
+
commands << wait_time*i
|
124
|
+
end
|
125
|
+
|
126
|
+
call_wfm_func =->(method=:hello){
|
127
|
+
if method == :hello
|
128
|
+
workflow_manager.send(method)
|
129
|
+
elsif method == :monitoring
|
130
|
+
tf = Tempfile.open("test.sh"){|out|
|
131
|
+
out.puts "#!/bin/bash"
|
132
|
+
out.puts
|
133
|
+
out.puts "START"
|
134
|
+
out.puts "sleep 5"
|
135
|
+
out.puts "END"
|
136
|
+
out
|
137
|
+
}
|
138
|
+
job_script = tf.path
|
139
|
+
script_content = File.read(tf.path)
|
140
|
+
user = "sushi_lover"
|
141
|
+
project_number = 1001
|
142
|
+
gsub_options = ["-n", sge_option]
|
143
|
+
gstore_script_dir = "/srv/gstore/projects/p1001/test_wfm_attack/scripts"
|
144
|
+
job_id = workflow_manager.start_monitoring(job_script, user, 0, script_content, project_number, gsub_options.join(' '), gstore_script_dir)
|
145
|
+
end
|
146
|
+
}
|
147
|
+
progress = ProgressBar.create(title: "Progress", total: commands.length, format: '%a %B %p%% %t', output: $stderr)
|
148
|
+
result = Parallel.map(commands, in_processes: threads, finish: -> (item, i, res){ progress.increment }) do |wait_time|
|
149
|
+
start_time = Time.now
|
150
|
+
sleep wait_time
|
151
|
+
st = Time.now
|
152
|
+
|
153
|
+
call_wfm_func.(call_method.to_sym)
|
154
|
+
|
155
|
+
et = Time.now
|
156
|
+
response_time = et - st
|
157
|
+
elapsed_time = Time.now - start_time
|
158
|
+
[elapsed_time, response_time]
|
159
|
+
end
|
160
|
+
|
161
|
+
#puts ["Elapsed", "Latency"].join("\t")
|
162
|
+
#result.each.with_index do |ela_res|
|
163
|
+
# elapsed_time, response_time = ela_res
|
164
|
+
# puts [elapsed_time, response_time].join("\t")
|
165
|
+
#end
|
166
|
+
|
167
|
+
labels = "[#{result.map{|x| "'#{x.first}'"}.join(",")}]"
|
168
|
+
data = "[#{result.map{|x| "'#{x.last}'"}.join(",")}]"
|
169
|
+
puts make_html.(labels, data)
|
@@ -191,7 +191,7 @@ module WorkflowManager
|
|
191
191
|
|
192
192
|
class FGCZCourseCluster < FGCZCluster
|
193
193
|
def copy_commands(org_dir, dest_parent_dir, now=nil)
|
194
|
-
commands = ["cp -r #{org_dir} #{dest_parent_dir}"]
|
194
|
+
commands = ["umask 0002; cp -r #{org_dir} #{dest_parent_dir}"]
|
195
195
|
end
|
196
196
|
def delete_command(target)
|
197
197
|
command = "rm -rf #{target}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workflow_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Functional Genomics Center Zurich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03
|
11
|
+
date: 2018-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,6 +42,7 @@ description: Workflow Manager manages job submissions using dRuby.
|
|
42
42
|
email:
|
43
43
|
- masaomi.hatakeyama@fgcz.uzh.ch
|
44
44
|
executables:
|
45
|
+
- wfm_attack
|
45
46
|
- wfm_delete_command
|
46
47
|
- wfm_get_log
|
47
48
|
- wfm_get_script
|
@@ -61,6 +62,7 @@ files:
|
|
61
62
|
- LICENSE.txt
|
62
63
|
- README.md
|
63
64
|
- Rakefile
|
65
|
+
- bin/wfm_attack
|
64
66
|
- bin/wfm_delete_command
|
65
67
|
- bin/wfm_get_log
|
66
68
|
- bin/wfm_get_script
|