cf_light_api 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cf_light_api +1 -0
- data/lib/cf_light_api/worker.rb +15 -7
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a2339a3ba1a090cc92e750dbf9c7989b65e6f2
|
4
|
+
data.tar.gz: 4aeafe0baf9434fbb864d0935ddb2c229bd13fc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5938dc292f80b5e0c498bf1dbd7f031a3c413552cee9b860b54528a974edb85da0031c889213a5938e3eabfaba947f3adf8e463ce43af22050bd4829a23c8ee6
|
7
|
+
data.tar.gz: da3062575af4938552a00d1003f94c03d7e9f6c1c65c8c235ce4b788a3001d838ad4a56251c5d9021779a6eaffe8de74d3965f8f05842885b6a6cd619aa30897
|
data/bin/cf_light_api
CHANGED
data/lib/cf_light_api/worker.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'cfoundry'
|
2
2
|
require 'json'
|
3
3
|
require 'rufus-scheduler'
|
4
|
+
require 'parallel'
|
4
5
|
|
5
6
|
['CF_API', 'CF_USER', 'CF_PASSWORD'].each do |env|
|
6
7
|
puts "[cf_light_api:worker] Error: please set the '#{env}' environment variable." unless ENV[env]
|
@@ -24,22 +25,29 @@ scheduler.every '5m', :first_in => '5s', :overlap => false, :timeout => '15m' do
|
|
24
25
|
|
25
26
|
org_data = []
|
26
27
|
app_data = []
|
27
|
-
cf_client.organizations
|
28
|
+
org_data = Parallel.map( cf_client.organizations, :in_processes => 4) do |org|
|
28
29
|
# The CFoundry client returns memory_limit in MB, so we need to normalise to Bytes to match the Apps.
|
29
|
-
|
30
|
+
{
|
30
31
|
:name => org.name,
|
31
32
|
:quota => {
|
32
33
|
:total_services => org.quota_definition.total_services,
|
33
34
|
:memory_limit => org.quota_definition.memory_limit * 1024 * 1024
|
34
35
|
}
|
35
36
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
end.flatten
|
38
|
+
|
39
|
+
app_data = Parallel.map( cf_client.organizations, :in_processes => 4) do |org|
|
40
|
+
Parallel.map( org.spaces, :in_processes => 4) do |space|
|
41
|
+
Parallel.map( space.apps, :in_processes => 4) do |app|
|
42
|
+
begin
|
43
|
+
# It's possible for an app to have been terminated before this stage is reached.
|
44
|
+
format_app_data(app, org.name, space.name)
|
45
|
+
rescue CFoundry::AppNotFound
|
46
|
+
next
|
47
|
+
end
|
40
48
|
end
|
41
49
|
end
|
42
|
-
end
|
50
|
+
end.flatten
|
43
51
|
|
44
52
|
unlock
|
45
53
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf_light_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Springer Platform Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cfoundry
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.2.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: parallel
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.4.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.4.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rufus-scheduler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|