stapel 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/stapel +34 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c283b1bd330e3fed0304184c0c5bbb777177d8b
|
4
|
+
data.tar.gz: 81d58d3228c07a60af9b4770b1dea4aa70d8518b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff09f39e1c62d3b3869af56bb47e624dd482311f61bed0a44f16ee2f2ea661f84c343889d3e74d263f4749750c3beeb51b25809a6934c281c7f4ff6b52c7efd1
|
7
|
+
data.tar.gz: f1094f00d4aecd11b5632662035695ae649f51804902e9a3c46435e1c269b938085d622f9cfa662e70e9d007144552556a05fca835c6b29ebb0c7ca31e15e418
|
data/bin/stapel
CHANGED
@@ -18,9 +18,30 @@ require_relative '../lib/worker.rb'
|
|
18
18
|
# cleanup #the script that is executed on the worker after a worker is finished
|
19
19
|
# aggregate #the script that will be executed on the master to aggregate all results after all jobs finished
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
|
22
|
+
def main
|
23
|
+
Thread.abort_on_exception = true
|
24
|
+
|
25
|
+
$base_path = File.expand_path(File.dirname(__FILE__))
|
26
|
+
$projects_path =File.expand_path(File.join($base_path, "../projects"))
|
27
|
+
|
28
|
+
if ARGV.length == 2 && ARGV[0] == "init"
|
29
|
+
path_to_copy = File.join($projects_path, ARGV[1])
|
30
|
+
help unless File.exist?(path_to_copy)
|
31
|
+
copy(path_to_copy)
|
32
|
+
exit
|
33
|
+
elsif ARGV.length == 1 && File.exists?(ARGV[0])
|
34
|
+
run(File.expand_path(ARGV[0]))
|
35
|
+
end
|
36
|
+
help
|
37
|
+
end
|
38
|
+
|
39
|
+
def help
|
40
|
+
puts "to run a project use: staple path/to/project"
|
41
|
+
puts "to create a new project use: stapel init $template"
|
42
|
+
puts "known templates:"
|
43
|
+
Dir.glob( File.join($projects_path, "*") ).each{|path| puts "\t#{File.basename(path)}"}
|
44
|
+
exit
|
24
45
|
end
|
25
46
|
|
26
47
|
def run(path_to_env)
|
@@ -34,6 +55,12 @@ def run(path_to_env)
|
|
34
55
|
aggregate(path_to_env, pool.output)
|
35
56
|
end
|
36
57
|
|
58
|
+
def aggregate(path_to_env,output)
|
59
|
+
aggregate_path = File.join(path_to_env, "aggregate")
|
60
|
+
system(aggregate_path, output) if File.exists?(aggregate_path)
|
61
|
+
end
|
62
|
+
|
63
|
+
|
37
64
|
def run_worker_on_machine(path_to_env, machine, pool)
|
38
65
|
worker = Worker.new(path_to_env, machine, pool)
|
39
66
|
worker.upload_environment
|
@@ -45,7 +72,7 @@ ensure
|
|
45
72
|
worker.cleanup if worker
|
46
73
|
end
|
47
74
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
75
|
+
def copy(path_to_copy)
|
76
|
+
FileUtils.cp_r(path_to_copy,".")
|
77
|
+
end
|
78
|
+
main
|