openstudio-aws 0.7.0.alpha0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,42 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
1
36
  require 'spec_helper'
2
37
 
3
38
  describe OpenStudioAwsInstance do
4
- context 'processors' do
39
+ context 'worker processors' do
5
40
  before :all do
6
41
  @aws_instance = OpenStudioAwsInstance.new(nil, nil, nil, nil, nil, nil, nil, nil)
7
42
  end
@@ -16,4 +51,20 @@ describe OpenStudioAwsInstance do
16
51
  expect(r).to eq(32)
17
52
  end
18
53
  end
54
+
55
+ context 'server processors' do
56
+ before :all do
57
+ @aws_instance = OpenStudioAwsInstance.new(nil, :server, nil, nil, nil, nil, nil, nil)
58
+ end
59
+
60
+ it 'should default to 1 with a warning' do
61
+ r = @aws_instance.find_processors('unknowninstance')
62
+ expect(r).to eq(1)
63
+ end
64
+
65
+ it 'should return known values for various instances' do
66
+ r = @aws_instance.find_processors('c3.8xlarge')
67
+ expect(r).to eq(27)
68
+ end
69
+ end
19
70
  end
@@ -1,3 +1,38 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
1
36
  require 'spec_helper'
2
37
 
3
38
  describe OpenStudio::Aws::Aws do
@@ -53,7 +88,7 @@ describe OpenStudio::Aws::Aws do
53
88
  it 'should error on key not found' do
54
89
  options = {
55
90
  aws_key_pair_name: 'a_random_key_pair',
56
- private_key_file_name: '/file/should/not/exist', # required if using an existing "aws_key_pair_name"
91
+ private_key_file_name: '/file/should/not/exist' # required if using an existing "aws_key_pair_name"
57
92
  }
58
93
  aws = OpenStudio::Aws::Aws.new
59
94
 
@@ -63,7 +98,7 @@ describe OpenStudio::Aws::Aws do
63
98
  it 'should require a private key' do
64
99
  options = {
65
100
  aws_key_pair_name: 'a_random_key_pair',
66
- private_key_file_name: nil, # required if using an existing "aws_key_pair_name"
101
+ private_key_file_name: nil # required if using an existing "aws_key_pair_name"
67
102
  }
68
103
  aws = OpenStudio::Aws::Aws.new
69
104
 
@@ -1,3 +1,38 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
1
36
  # This spec file contains the testing of OpenStudio specific tests (for AMI listing) which require an AWS account and authentication
2
37
  require 'spec_helper'
3
38
 
@@ -5,6 +40,7 @@ describe OpenStudioAwsWrapper do
5
40
  context 'unauthenticated session' do
6
41
  it 'should fail to authenticate' do
7
42
  options = {
43
+ save_directory: 'spec/test_run',
8
44
  credentials: {
9
45
  access_key_id: 'some_random_access_key_id',
10
46
  secret_access_key: 'some_super_secret_access_key',
@@ -33,9 +69,9 @@ describe OpenStudioAwsWrapper do
33
69
  it 'should describe the zones' do
34
70
  resp = @aws.os_aws.describe_availability_zones
35
71
  expect(resp).not_to be_nil
36
- expect(resp[:availability_zone_info].length).to eq(5)
72
+ expect(resp[:availability_zone_info].length).to eq(6)
37
73
 
38
- expect(resp[:availability_zone_info].inspect).to eq("[{:zone_name=>\"us-east-1a\", :state=>\"available\", :region_name=>\"us-east-1\", :messages=>[]}, {:zone_name=>\"us-east-1b\", :state=>\"available\", :region_name=>\"us-east-1\", :messages=>[]}, {:zone_name=>\"us-east-1c\", :state=>\"available\", :region_name=>\"us-east-1\", :messages=>[]}, {:zone_name=>\"us-east-1d\", :state=>\"available\", :region_name=>\"us-east-1\", :messages=>[]}, {:zone_name=>\"us-east-1e\", :state=>\"available\", :region_name=>\"us-east-1\", :messages=>[]}]")
74
+ expect(resp[:availability_zone_info].inspect).to eq('[{:zone_name=>"us-east-1a", :state=>"available", :region_name=>"us-east-1", :messages=>[]}, {:zone_name=>"us-east-1b", :state=>"available", :region_name=>"us-east-1", :messages=>[]}, {:zone_name=>"us-east-1c", :state=>"available", :region_name=>"us-east-1", :messages=>[]}, {:zone_name=>"us-east-1d", :state=>"available", :region_name=>"us-east-1", :messages=>[]}, {:zone_name=>"us-east-1e", :state=>"available", :region_name=>"us-east-1", :messages=>[]}, {:zone_name=>"us-east-1f", :state=>"available", :region_name=>"us-east-1", :messages=>[]}]')
39
75
 
40
76
  resp = @aws.os_aws.describe_availability_zones_json
41
77
  expect(resp).not_to be_nil
@@ -54,47 +90,49 @@ describe OpenStudioAwsWrapper do
54
90
  end
55
91
 
56
92
  it 'should describe a specific image' do
57
- resp = @aws.os_aws.describe_amis(['ami-39bb8750'], false)
58
- expect(resp[:images].first[:image_id]).to eq('ami-39bb8750')
59
- expect(resp[:images].first[:tags_hash][:user_uuid]).to eq('jenkins-139LADFJ178')
60
- expect(resp[:images].first[:tags_hash][:openstudio_server_version]).to eq('1.3.1')
61
- end
62
- end
63
-
64
- context 'version 1' do
65
- it 'should create a new json and return the right server versions' do
66
- resp = @aws.os_aws.create_new_ami_json(1)
67
- expect(resp['1.2.1'.to_sym][:server]).to eq('ami-89744be0')
68
- expect(resp['1.9.0'.to_sym][:server]).to eq('ami-f3611996')
69
- expect(resp['default'.to_sym][:server]).to_not eq('ami-89744be0')
93
+ resp = @aws.os_aws.describe_amis(['ami-04aad6cdd42bfa018'], false)
94
+ expect(resp[:images].first[:image_id]).to eq('ami-04aad6cdd42bfa018')
95
+ expect(resp[:images].first[:tags_hash][:generated_by]).to eq('NREL-CI')
96
+ expect(resp[:images].first[:tags_hash][:docker_version]).to eq('17.09.1')
70
97
  end
71
98
  end
72
99
 
73
- context 'version 2' do
74
- it 'should create a new json' do
75
- resp = @aws.os_aws.create_new_ami_json(2)
76
- expect(resp[:openstudio_server]['1.21.4'.to_sym][:amis][:server]).to eq('ami-e7a1bbf0')
77
- expect(resp[:openstudio_server]['1.21.4'.to_sym][:openstudio_version_sha]).to eq('6103d54380')
78
- expect(resp[:openstudio_server]['1.21.4'.to_sym][:tested]).to eq(false)
79
- end
80
- end
100
+ # TODO: Remove support for the older AMI versions
101
+ # context 'version 1' do
102
+ # it 'should create a new json and return the right server versions' do
103
+ # resp = @aws.os_aws.create_new_ami_json(1)
104
+ # expect(resp['1.2.1'.to_sym][:server]).to eq('ami-89744be0')
105
+ # expect(resp['1.9.0'.to_sym][:server]).to eq('ami-f3611996')
106
+ # expect(resp['default'.to_sym][:server]).to_not eq('ami-89744be0')
107
+ # end
108
+ # end
109
+
110
+ # context 'version 2' do
111
+ # it 'should create a new json' do
112
+ # resp = @aws.os_aws.create_new_ami_json(2)
113
+ # expect(resp[:openstudio_server]['1.21.4'.to_sym][:amis][:server]).to eq('ami-e7a1bbf0')
114
+ # expect(resp[:openstudio_server]['1.21.4'.to_sym][:openstudio_version_sha]).to eq('6103d54380')
115
+ # expect(resp[:openstudio_server]['1.21.4'.to_sym][:tested]).to eq(false)
116
+ # end
117
+ # end
81
118
  end
82
119
 
83
- context 'ami list' do
84
- before :all do
85
- @aws = OpenStudio::Aws::Aws.new
86
- end
87
-
88
- it 'should get the next version' do
89
- expect(@aws.os_aws.get_next_version('0.1.1', [])).to eq('0.1.1')
90
- expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1'])).to eq('0.1.2')
91
- expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.3'])).to eq('0.1.4')
92
- expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.2', '0.1.3'])).to eq('0.1.4')
93
- expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.2', '0.1.3', '0.1.15'])).to eq('0.1.16')
94
- expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.2', '0.1.3', '0.1.15', '3.1.0'])).to eq('0.1.16')
95
- expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.2', '0.1.3', '0.1.15', '3.1.27'])).to eq('0.1.16')
96
- end
97
- end
120
+ # This method is to be deprecated since next versions are no longer part of AWS gem
121
+ # context 'ami list' do
122
+ # before :all do
123
+ # @aws = OpenStudio::Aws::Aws.new
124
+ # end
125
+
126
+ # it 'should get the next version' do
127
+ # expect(@aws.os_aws.get_next_version('0.1.1', [])).to eq('0.1.1')
128
+ # expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1'])).to eq('0.1.2')
129
+ # expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.3'])).to eq('0.1.4')
130
+ # expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.2', '0.1.3'])).to eq('0.1.4')
131
+ # expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.2', '0.1.3', '0.1.15'])).to eq('0.1.16')
132
+ # expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.2', '0.1.3', '0.1.15', '3.1.0'])).to eq('0.1.16')
133
+ # expect(@aws.os_aws.get_next_version('0.1.1', ['0.1.1', '0.1.2', '0.1.3', '0.1.15', '3.1.27'])).to eq('0.1.16')
134
+ # end
135
+ # end
98
136
 
99
137
  context 'security groups' do
100
138
  before :all do
@@ -1,3 +1,38 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
1
36
  require 'spec_helper'
2
37
 
3
38
  describe OpenStudio::Aws::Config do
@@ -21,11 +56,11 @@ describe OpenStudio::Aws::Config do
21
56
  end
22
57
 
23
58
  it 'should read old format' do
24
- # make sure that we can read the old format which has non-symoblized keys
59
+ # make sure that we can read the old format which has non-symbolized keys
25
60
  local_file = 'test_custom_old.config'
26
61
 
27
62
  data = {
28
- 'access_key_id' => 'abcd',
63
+ 'access_key_id' => 'abcd',
29
64
  'secret_access_key' => 'efgh'
30
65
  }
31
66
 
@@ -0,0 +1,52 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ require 'spec_helper'
37
+
38
+ describe OpenStudioAwsWrapper do
39
+ context 'number of cores' do
40
+ it 'should calculate number of cores' do
41
+ data = {
42
+ save_directory: 'spec/test_data',
43
+ credentials: { access_key_id: 'abcd', secret_access_key: 'efgh', region: 'us-east-1' }
44
+ }
45
+ @os_aws_wrapper = OpenStudioAwsWrapper.new(data)
46
+
47
+ proc_arr = @os_aws_wrapper.calculate_processors(356)
48
+ # total_procs
49
+ expect(proc_arr[0]).to eq 340
50
+ end
51
+ end
52
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,38 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
1
36
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
37
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
38
 
data/update_license.rb ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ruby_regex = /^#.\*{79}.*#.\*{79}$/m
4
+
5
+ ruby_header_text = <<EOT
6
+ # *******************************************************************************
7
+ # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
8
+ # All rights reserved.
9
+ # Redistribution and use in source and binary forms, with or without
10
+ # modification, are permitted provided that the following conditions are met:
11
+ #
12
+ # (1) Redistributions of source code must retain the above copyright notice,
13
+ # this list of conditions and the following disclaimer.
14
+ #
15
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
16
+ # this list of conditions and the following disclaimer in the documentation
17
+ # and/or other materials provided with the distribution.
18
+ #
19
+ # (3) Neither the name of the copyright holder nor the names of any contributors
20
+ # may be used to endorse or promote products derived from this software without
21
+ # specific prior written permission from the respective party.
22
+ #
23
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
24
+ # of modifications or other derivative works may not use the "OpenStudio"
25
+ # trademark, "OS", "os", or any other confusingly similar designation without
26
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
27
+ #
28
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
32
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
35
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
38
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ # *******************************************************************************
40
+ EOT
41
+ ruby_header_text.strip!
42
+
43
+ paths = [
44
+ { glob: 'lib/**/*.rb', license: ruby_header_text, regex: ruby_regex },
45
+ { glob: 'spec/**/*.rb', license: ruby_header_text, regex: ruby_regex },
46
+
47
+ # single files
48
+ { glob: 'Rakefile', license: ruby_header_text, regex: ruby_regex }
49
+ ]
50
+
51
+ paths.each do |path|
52
+ Dir[path[:glob]].each do |file|
53
+ puts "Updating license in file #{file}"
54
+
55
+ f = File.read(file)
56
+ if f =~ path[:regex]
57
+ puts ' License found -- updating'
58
+ File.open(file, 'w') { |write| write << f.gsub(path[:regex], path[:license]) }
59
+ else
60
+ puts ' No license found -- adding'
61
+ if f =~ /#!/
62
+ puts ' CANNOT add license to file automatically, add it manually and it will update automatically in the future'
63
+ next
64
+ end
65
+ File.open(file, 'w') { |write| write << f.insert(0, path[:license] + "\n\n") }
66
+ end
67
+ end
68
+ end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.alpha0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Long
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-28 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: net-scp
14
+ name: aws-sdk-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: 2.2.37
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '1.1'
26
+ version: 2.2.37
27
27
  - !ruby/object:Gem::Dependency
28
- name: net-ssh
28
+ name: net-scp
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.2.0
33
+ version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.2.0
40
+ version: 2.0.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: aws-sdk-core
42
+ name: net-ssh
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 2.2.26
47
+ version: 4.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 2.2.26
54
+ version: 4.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: semantic
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.7'
75
+ version: '2.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.7'
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '10.4'
89
+ version: '12.3'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '10.4'
96
+ version: '12.3'
97
97
  description: Custom classes for configuring clusters for OpenStudio & EnergyPlus analyses
98
98
  email:
99
99
  - Nicholas.Long@nrel.gov
@@ -134,8 +134,10 @@ files:
134
134
  - spec/openstudio-aws/aws_spec.rb
135
135
  - spec/openstudio-aws/aws_wrapper_spec.rb
136
136
  - spec/openstudio-aws/config_spec.rb
137
+ - spec/openstudio-aws/openstudio_analysis_wrapper_spec.rb
137
138
  - spec/resources/upload_me.sh
138
139
  - spec/spec_helper.rb
140
+ - update_license.rb
139
141
  homepage: http://openstudio.nrel.gov
140
142
  licenses:
141
143
  - LGPL
@@ -156,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
158
  version: 1.3.6
157
159
  requirements: []
158
160
  rubyforge_project:
159
- rubygems_version: 2.6.10
161
+ rubygems_version: 2.4.5.1
160
162
  signing_key:
161
163
  specification_version: 4
162
164
  summary: Start AWS EC2 instances for running distributed OpenStudio-based analyses
@@ -167,5 +169,6 @@ test_files:
167
169
  - spec/openstudio-aws/aws_spec.rb
168
170
  - spec/openstudio-aws/aws_wrapper_spec.rb
169
171
  - spec/openstudio-aws/config_spec.rb
172
+ - spec/openstudio-aws/openstudio_analysis_wrapper_spec.rb
170
173
  - spec/resources/upload_me.sh
171
174
  - spec/spec_helper.rb