zooniverse_data 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zooniverse_data/helpers/transport.rb +15 -3
- data/lib/zooniverse_data/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c177a4164665bc2d3b784b192f4cc2101139a83d
|
4
|
+
data.tar.gz: b7de110057268047631c9dcaeb9e3f355a3d63b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23680cf0621e8335a9ae7bf39fb66ee360024e27fb713520b2188f81ae4d76cea441a1dcf714cb678dd03387bb57ab5ff46eb8c8db39bb0ac6a0f7ce7c1011a0
|
7
|
+
data.tar.gz: 4427696fd4eccccedbd78403a4d9cb442d2ce676b546f4652b567c1cea62d15cca0df05d3a16328e26a309c772f98cff34ddae2e31da3b31ffb7cfca6695fa8f
|
@@ -15,9 +15,7 @@ module ZooniverseData
|
|
15
15
|
def download(from: nil, to: nil, timeout: 60)
|
16
16
|
_with_retries(20) do
|
17
17
|
`rm -f '#{ to }'`
|
18
|
-
|
19
|
-
`wget '#{ from }' -t 50 -c -q -O '#{ to }'`
|
20
|
-
end
|
18
|
+
spawn_with_timeout command: "wget '#{ from }' -t 50 -c -q -O '#{ to }'", timeout: timeout
|
21
19
|
|
22
20
|
raise 'File not downloaded' unless File.exists?(to)
|
23
21
|
raise 'File is empty' unless File.new(to).size > 0
|
@@ -49,6 +47,20 @@ module ZooniverseData
|
|
49
47
|
@bucket_path ||= manifest.project.bucket_path
|
50
48
|
end
|
51
49
|
|
50
|
+
def spawn_with_timeout(command: command, timeout: timeout)
|
51
|
+
pid = Process.spawn command, close_others: true
|
52
|
+
|
53
|
+
begin
|
54
|
+
Timeout::timeout(timeout) do
|
55
|
+
Process.wait pid
|
56
|
+
end
|
57
|
+
rescue => e
|
58
|
+
Process.kill 'TERM', pid
|
59
|
+
Process.detach pid
|
60
|
+
raise e
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
52
64
|
def _with_retries(retries)
|
53
65
|
tries = 0
|
54
66
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zooniverse_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Parrish
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|