rbbt-util 5.17.76 → 5.17.77
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/annotations.rb +1 -1
- data/lib/rbbt/util/docker.rb +57 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a51122d03732e5546ecf0680b478574b177656c4
|
4
|
+
data.tar.gz: 346fb3e137b00d39ff04ae7b7dfe1fcd3f95b237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea134b8da6d0fd0d6600d992de58ec8763c652dfc557774b2564b49fe32ad3e561201ef1d51db40a26b506431d0a42295feca50f151b3756f3e827d3fc5895b
|
7
|
+
data.tar.gz: 97649ad23c304278d1b64985261c17ab933992c9c93eb9fedd0c4f56334aa534ed33df8a56b4811e64c96ec22f5fbfa6cc58e732aaa887ce42f8b76e6e297d25
|
data/lib/rbbt/annotations.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
module Docker
|
2
|
+
def self.run(image,cmd, options)
|
3
|
+
mounts, job_inputs, directory, pipe = Misc.process_options options, :mounts, :job_inputs, :directory, :pipe
|
4
|
+
|
5
|
+
if mounts
|
6
|
+
mount_cmd = mounts.sort.collect{|t,s| "-v " + ["'" + s + "'", "'" + t + "'"] * ":" } * " "
|
7
|
+
else
|
8
|
+
mount_cmd = ""
|
9
|
+
end
|
10
|
+
|
11
|
+
image_cmd = "-t #{image}"
|
12
|
+
|
13
|
+
if directory
|
14
|
+
Path.setup(directory) unless Path === directory
|
15
|
+
FileUtils.mkdir_p directory unless File.directory? directory
|
16
|
+
mount_cmd += " -v '#{directory}':/job"
|
17
|
+
job_inputs.each do |name,obj|
|
18
|
+
case obj
|
19
|
+
when File
|
20
|
+
FileUtils.cp obj.filename, directory[name]
|
21
|
+
when IO
|
22
|
+
Open.write(tmpfile[name], obj)
|
23
|
+
when String
|
24
|
+
if obj.length < 256 and File.exists?(obj)
|
25
|
+
FileUtils.cp obj, directory[name]
|
26
|
+
else
|
27
|
+
Open.write(directory[name], obj)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
else
|
32
|
+
TmpFile.with_file do |tmpfile|
|
33
|
+
Path.setup(tmpfile)
|
34
|
+
FileUtils.mkdir_p tmpfile
|
35
|
+
mount_cmd += " -v '#{tmpfile}':/job"
|
36
|
+
job_inputs.each do |name,obj|
|
37
|
+
case obj
|
38
|
+
when File
|
39
|
+
FileUtils.cp obj.filename, tmpfile[name]
|
40
|
+
when IO
|
41
|
+
Open.write(tmpfile[name], obj)
|
42
|
+
when String
|
43
|
+
if obj.length < 256 and File.exists?(obj)
|
44
|
+
FileUtils.cp obj, tmpfile[name]
|
45
|
+
else
|
46
|
+
Open.write(tmpfile[name], obj)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
pipe = false
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
cmd = "docker run #{mount_cmd} #{image_cmd} #{cmd}"
|
55
|
+
CMD.cmd(cmd, :log => true, :pipe => pipe)
|
56
|
+
end
|
57
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.17.
|
4
|
+
version: 5.17.77
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/rbbt/util/concurrency/processes/socket_old.rb
|
228
228
|
- lib/rbbt/util/concurrency/processes/worker.rb
|
229
229
|
- lib/rbbt/util/concurrency/threads.rb
|
230
|
+
- lib/rbbt/util/docker.rb
|
230
231
|
- lib/rbbt/util/excel2tsv.rb
|
231
232
|
- lib/rbbt/util/filecache.rb
|
232
233
|
- lib/rbbt/util/log.rb
|