openstudio-analysis 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -34
- data/lib/openstudio-analysis.rb +2 -1
- data/lib/openstudio/analysis/server_api.rb +239 -35
- data/lib/openstudio/analysis/translator/excel.rb +28 -4
- data/lib/openstudio/analysis/version.rb +1 -1
- data/lib/openstudio/helpers/hash.rb +5 -0
- data/lib/openstudio/helpers/string.rb +31 -4
- data/spec/files/analysis/medium_office.json +240 -240
- data/spec/files/analysis/medium_office.zip +0 -0
- data/spec/files/export/analysis/0_3_0_outputs.json +10 -10
- data/spec/files/export/analysis/0_3_0_outputs.zip +0 -0
- data/spec/files/export/analysis/discrete_dynamic_seed.json +16 -16
- data/spec/files/export/analysis/discrete_dynamic_seed.zip +0 -0
- data/spec/files/export/analysis/discrete_seed.json +106 -106
- data/spec/files/export/analysis/discrete_seed.zip +0 -0
- data/spec/files/export/analysis/kats_model_v2.json +22 -22
- data/spec/files/export/analysis/kats_model_v2.zip +0 -0
- data/spec/files/export/analysis/output_vars.json +104 -104
- data/spec/files/export/analysis/output_vars.zip +0 -0
- data/spec/files/export/analysis/small_seed.json +104 -104
- data/spec/files/export/analysis/small_seed.zip +0 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.26.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.27.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.28.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.29.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.30.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.31.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.32.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.33.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.26.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.27.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.28.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.29.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.30.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.31.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.32.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.33.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.26.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.27.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.28.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.29.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.30.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.31.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.32.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.33.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.13.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.14.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.15.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.16.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.17.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.18.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.13.xml +17 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.14.xml +17 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.15.xml +17 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.16.xml +17 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.17.xml +17 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.18.xml +17 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.16.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.17.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.18.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.19.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.20.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.21.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.22.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.13.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.14.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.15.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.16.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.17.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.18.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.14.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.15.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.16.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.17.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.18.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.19.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.13.xml +36 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.14.xml +36 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.15.xml +36 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.16.xml +36 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.17.xml +36 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.18.xml +36 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.15.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.16.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.17.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.18.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.19.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.20.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.16.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.17.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.18.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.19.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.20.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.21.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.22.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.15.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.16.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.17.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.18.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.19.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.20.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.21.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.15.xml +23 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.16.xml +23 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.17.xml +23 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.18.xml +23 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.19.xml +23 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.20.xml +23 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.15.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.16.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.17.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.18.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.19.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.20.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.21.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.13.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.14.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.15.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.16.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.17.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.18.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.13.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.14.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.15.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.16.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.17.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.18.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.13.xml +32 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.14.xml +32 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.15.xml +32 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.16.xml +32 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.17.xml +32 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.18.xml +32 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-3-0-objective-functions.16.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-3-0-objective-functions.17.xml +42 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-3-0-objective-functions.18.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-3-0-objective-functions.19.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-3-0-objective-functions.20.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-3-0-objective-functions.21.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-3-0-objective-functions.22.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.26.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.27.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.28.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.29.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.30.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.31.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.32.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.33.xml +7 -0
- metadata +259 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36db3ffaec389ad563fbd3f673d03296e34aa188
|
4
|
+
data.tar.gz: 84cf2c11acae410f719d1521593a33330e38e8cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40d30b45fb9325c5a54f23cc99907ba2834e45faf4eba8d9191218de7a145d0bb441aef2be294f50c300ece8347f1e71bad8f42acddd915e585f9058547b9291
|
7
|
+
data.tar.gz: 5ae5179d6d2ccacffa3eb5d5a6e9f28d05748d7454a87b411db03539438f281af73eec38037f2b796097c94ec921ab8fd864fc3097c2b605ac1f1055b022a7bc
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,18 @@ OpenStudio Analysis Gem Change Log
|
|
4
4
|
Unreleased
|
5
5
|
--------------
|
6
6
|
|
7
|
-
Version 0.3.
|
7
|
+
Version 0.3.2
|
8
|
+
--------------
|
9
|
+
* Support both relative and absolute paths in the spreadsheet
|
10
|
+
* Helper methods for submitting analyses
|
11
|
+
* Add get_analysis method to Server API to get the status of an analysis
|
12
|
+
|
13
|
+
Version 0.3.1
|
14
|
+
--------------
|
15
|
+
* Grab the first EPW file, not the first file
|
16
|
+
* Download various formats via server API
|
17
|
+
|
18
|
+
Version 0.3.0
|
8
19
|
--------------
|
9
20
|
* Remove the column for Sampling Method. That is now part of the analysis config.
|
10
21
|
* All variables need static values now
|
@@ -13,90 +24,59 @@ Version 0.3.0 (not yet on RubyGems)
|
|
13
24
|
|
14
25
|
Version 0.2.3
|
15
26
|
--------------
|
16
|
-
|
17
27
|
* Support for optional variables
|
18
28
|
* Display names and Machine names in the models now
|
19
29
|
* More error checking
|
20
30
|
|
21
31
|
Version 0.1.14
|
22
32
|
--------------
|
23
|
-
|
24
33
|
* Symbolize headers parsed from excel file.
|
25
34
|
|
26
35
|
|
27
36
|
Version 0.1.12/13
|
28
37
|
-------------
|
29
|
-
|
30
38
|
* Add machine name to pivot variables
|
31
|
-
|
32
39
|
* Force generation of unique UUIDs
|
33
|
-
|
34
40
|
* Add data types to arguments and variables for XML based measures
|
35
|
-
|
36
41
|
* Move Pivot variable type to Type (not sample method)
|
37
42
|
|
38
43
|
Version 0.1.11
|
39
44
|
-------------
|
40
|
-
|
41
45
|
* Add cluster name and openstudio server version
|
42
|
-
|
43
46
|
* Make the booleans in run_options actual booleans
|
44
47
|
|
45
|
-
|
46
48
|
Version 0.1.10
|
47
49
|
-------------
|
48
|
-
|
49
50
|
* Add output variables to the spreadsheet as a separate tab
|
50
51
|
|
51
52
|
Version 0.1.9
|
52
53
|
-------------
|
53
|
-
|
54
54
|
* Downcase checking of variable data types
|
55
55
|
|
56
56
|
Version 0.1.9
|
57
57
|
-------------
|
58
|
-
|
59
58
|
* Clean up the "delete_mes" in the JSONs
|
60
|
-
|
61
59
|
* Added discrete variables to the spreadsheet and bumped version
|
62
60
|
|
63
61
|
Version 0.1.8
|
64
62
|
-------------
|
65
|
-
|
66
63
|
* Parsing of Proxy parameters
|
67
64
|
|
68
65
|
Version 0.1.7
|
69
66
|
-------------
|
70
|
-
|
71
67
|
* Add setting section
|
72
|
-
|
73
68
|
* Add problem and algorithm arguments
|
74
69
|
|
75
70
|
Version 0.1.6
|
76
71
|
-------------
|
77
|
-
|
78
72
|
* Small fixes
|
79
73
|
|
80
74
|
Version 0.1.5
|
81
75
|
-------------
|
82
|
-
|
83
|
-
### Major Changes (may be backwards incompatible)
|
84
|
-
|
85
|
-
### New Features
|
86
|
-
|
87
|
-
### Resolved Issues
|
88
|
-
|
89
76
|
* Now depends on json_pure for window users
|
90
77
|
|
91
78
|
Version 0.1.3
|
92
79
|
-------------
|
93
|
-
|
94
|
-
### Major Changes (may be backwards incompatible)
|
95
|
-
|
96
|
-
### New Features
|
97
|
-
|
98
|
-
### Resolved Issues
|
99
|
-
|
100
80
|
* Removed spaced in measure type
|
101
81
|
|
102
82
|
Version 0.1.1
|
@@ -106,8 +86,6 @@ Version 0.1.1
|
|
106
86
|
|
107
87
|
* Change XLSX translator to read from a "Variables" spreadsheet instead of "Sensitivity"
|
108
88
|
|
109
|
-
### New Features
|
110
|
-
|
111
89
|
### Resolved Issues
|
112
90
|
|
113
91
|
* Added check for when weather file is a zip or an epw
|
data/lib/openstudio-analysis.rb
CHANGED
@@ -6,7 +6,7 @@ module OpenStudio
|
|
6
6
|
attr_reader :hostname
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
|
-
defaults = {
|
9
|
+
defaults = {hostname: 'http://localhost:8080'}
|
10
10
|
options = defaults.merge(options)
|
11
11
|
@logger = Logger.new('faraday.log')
|
12
12
|
|
@@ -66,12 +66,12 @@ module OpenStudio
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def new_project(options = {})
|
69
|
-
defaults = {
|
69
|
+
defaults = {project_name: "Project #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}"}
|
70
70
|
options = defaults.merge(options)
|
71
71
|
project_id = nil
|
72
72
|
|
73
73
|
# TODO: make this a display name and a machine name
|
74
|
-
project_hash = {
|
74
|
+
project_hash = {project: {name: "#{options[:project_name]}"}}
|
75
75
|
|
76
76
|
response = @conn.post do |req|
|
77
77
|
req.url '/projects.json'
|
@@ -109,12 +109,71 @@ module OpenStudio
|
|
109
109
|
analysis_ids
|
110
110
|
end
|
111
111
|
|
112
|
+
# return the entire analysis JSON
|
113
|
+
def get_analysis(analysis_id)
|
114
|
+
result = nil
|
115
|
+
response = @conn.get "/analyses/#{analysis_id}.json"
|
116
|
+
if response.status == 200
|
117
|
+
result = JSON.parse(response.body, symbolize_names: true, max_nesting: false)[:analysis]
|
118
|
+
end
|
119
|
+
|
120
|
+
result
|
121
|
+
end
|
122
|
+
|
123
|
+
# Check the status of the simulation. Format should be:
|
124
|
+
# {
|
125
|
+
# analysis: {
|
126
|
+
# status: "completed",
|
127
|
+
# analysis_type: "batch_run"
|
128
|
+
# },
|
129
|
+
# data_points: [
|
130
|
+
# {
|
131
|
+
# _id: "bbd57e90-ce59-0131-35de-080027880ca6",
|
132
|
+
# status: "completed"
|
133
|
+
# }
|
134
|
+
# ]
|
135
|
+
# }
|
136
|
+
def get_analysis_status(analysis_id, analysis_type)
|
137
|
+
status = nil
|
138
|
+
|
139
|
+
#sleep 2 # super cheesy---need to update how this works. Right now there is a good chance to get a
|
140
|
+
# race condition when the analysis state changes.
|
141
|
+
unless analysis_id.nil?
|
142
|
+
resp = @conn.get "analyses/#{analysis_id}/status.json"
|
143
|
+
if resp.status == 200
|
144
|
+
j = JSON.parse resp.body, symbolize_names: true
|
145
|
+
if j && j[:analysis] && j[:analysis][:analysis_type] == analysis_type
|
146
|
+
status = j[:analysis][:status]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
status
|
152
|
+
end
|
153
|
+
|
154
|
+
# return the data point results in JSON format
|
155
|
+
def get_analysis_results(analysis_id)
|
156
|
+
analysis = nil
|
157
|
+
|
158
|
+
response = @conn.get "/analyses/#{analysis_id}/analysis_data.json"
|
159
|
+
if response.status == 200
|
160
|
+
analysis = JSON.parse(response.body, symbolize_names: true, max_nesting: false)
|
161
|
+
end
|
162
|
+
|
163
|
+
analysis
|
164
|
+
end
|
165
|
+
|
112
166
|
def download_dataframe(analysis_id, format='rdata', save_directory=".")
|
113
|
-
|
167
|
+
# Set the export = true flag to retrieve all the variables for the export (not just the visualize variables)
|
168
|
+
response = @conn.get "/analyses/#{analysis_id}/download_data.#{format}?export=true"
|
114
169
|
if response.status == 200
|
115
170
|
filename = response['content-disposition'].match(/filename=(\"?)(.+)\1/)[2]
|
116
171
|
puts "File #{filename} already exists, overwriting" if File.exist?("#{save_directory}/#{filename}")
|
117
|
-
|
172
|
+
if format == 'rdata'
|
173
|
+
File.open("#{save_directory}/#{filename}", 'wb') { |f| f << response.body }
|
174
|
+
else
|
175
|
+
File.open("#{save_directory}/#{filename}", 'w') { |f| f << response.body }
|
176
|
+
end
|
118
177
|
end
|
119
178
|
end
|
120
179
|
|
@@ -123,7 +182,20 @@ module OpenStudio
|
|
123
182
|
if response.status == 200
|
124
183
|
filename = response['content-disposition'].match(/filename=(\"?)(.+)\1/)[2]
|
125
184
|
puts "File #{filename} already exists, overwriting" if File.exist?("#{save_directory}/#{filename}")
|
126
|
-
|
185
|
+
if format == 'rdata'
|
186
|
+
File.open("#{save_directory}/#{filename}", 'wb') { |f| f << response.body }
|
187
|
+
else
|
188
|
+
File.open("#{save_directory}/#{filename}", 'w') { |f| f << response.body }
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def download_datapoint(datapoint_id, save_directory=".")
|
194
|
+
response = @conn.get "/data_points/#{datapoint_id}/download"
|
195
|
+
if response.status == 200
|
196
|
+
filename = response['content-disposition'].match(/filename=(\"?)(.+)\1/)[2]
|
197
|
+
puts "File #{filename} already exists, overwriting" if File.exist?("#{save_directory}/#{filename}")
|
198
|
+
File.open("#{save_directory}/#{filename}", 'wb') { |f| f << response.body }
|
127
199
|
end
|
128
200
|
end
|
129
201
|
|
@@ -132,48 +204,59 @@ module OpenStudio
|
|
132
204
|
if response.status == 200
|
133
205
|
filename = response['content-disposition'].match(/filename=(\"?)(.+)\1/)[2]
|
134
206
|
puts "File #{filename} already exists, overwriting" if File.exist?("#{save_directory}/#{filename}")
|
135
|
-
File.open("#{save_directory}/#{filename}",'
|
207
|
+
File.open("#{save_directory}/#{filename}", 'wb') { |f| f << response.body }
|
136
208
|
end
|
137
209
|
end
|
138
210
|
|
139
211
|
def new_analysis(project_id, options)
|
140
|
-
defaults = {
|
212
|
+
defaults = {analysis_name: nil, reset_uuids: false}
|
141
213
|
options = defaults.merge(options)
|
142
214
|
|
143
215
|
fail 'No project id passed' if project_id.nil?
|
144
|
-
fail 'no formulation passed to new_analysis' unless options[:formulation_file]
|
145
|
-
fail "No formulation exists #{options[:formulation_file]}" unless File.exist?(options[:formulation_file])
|
146
216
|
|
147
|
-
formulation_json =
|
217
|
+
formulation_json = nil
|
218
|
+
if options[:formulation_file]
|
219
|
+
fail "No formulation exists #{options[:formulation_file]}" unless File.exist?(options[:formulation_file])
|
220
|
+
formulation_json = JSON.parse(File.read(options[:formulation_file]), symbolize_names: true)
|
221
|
+
end
|
148
222
|
|
149
223
|
# read in the analysis id from the analysis.json file
|
150
224
|
analysis_id = nil
|
151
|
-
if
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
wf[:arguments]
|
159
|
-
|
225
|
+
if formulation_json
|
226
|
+
if options[:reset_uuids]
|
227
|
+
analysis_id = UUID.new.generate
|
228
|
+
formulation_json[:analysis][:uuid] = analysis_id
|
229
|
+
|
230
|
+
formulation_json[:analysis][:problem][:workflow].each do |wf|
|
231
|
+
wf[:uuid] = UUID.new.generate
|
232
|
+
if wf[:arguments]
|
233
|
+
wf[:arguments].each do |arg|
|
234
|
+
arg[:uuid] = UUID.new.generate
|
235
|
+
end
|
160
236
|
end
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
237
|
+
if wf[:variables]
|
238
|
+
wf[:variables].each do |var|
|
239
|
+
var[:uuid] = UUID.new.generate
|
240
|
+
var[:argument][:uuid] = UUID.new.generate if var[:argument]
|
241
|
+
end
|
166
242
|
end
|
167
243
|
end
|
244
|
+
else
|
245
|
+
analysis_id = formulation_json[:analysis][:uuid]
|
168
246
|
end
|
247
|
+
|
248
|
+
# set the analysis name
|
249
|
+
formulation_json[:analysis][:name] = "#{options[:analysis_name]}" unless options[:analysis_name].nil?
|
169
250
|
else
|
170
|
-
|
251
|
+
formulation_json = {
|
252
|
+
analysis: options
|
253
|
+
}
|
254
|
+
puts formulation_json
|
255
|
+
analysis_id = UUID.new.generate
|
256
|
+
formulation_json[:analysis][:uuid] = analysis_id
|
171
257
|
end
|
172
258
|
fail "No analysis id defined in analyis.json #{options[:formulation_file]}" if analysis_id.nil?
|
173
259
|
|
174
|
-
# set the analysis name
|
175
|
-
formulation_json[:analysis][:name] = "#{options[:analysis_name]}" unless options[:analysis_name].nil?
|
176
|
-
|
177
260
|
# save out this file to compare
|
178
261
|
# File.open('formulation_merge.json', 'w') { |f| f << JSON.pretty_generate(formulation_json) }
|
179
262
|
|
@@ -197,7 +280,7 @@ module OpenStudio
|
|
197
280
|
if options[:upload_file]
|
198
281
|
fail "upload file does not exist #{options[:upload_file]}" unless File.exist?(options[:upload_file])
|
199
282
|
|
200
|
-
payload = {
|
283
|
+
payload = {file: Faraday::UploadIO.new(options[:upload_file], 'application/zip')}
|
201
284
|
response = @conn_multipart.post "analyses/#{analysis_id}/upload.json", payload
|
202
285
|
|
203
286
|
if response.status == 201
|
@@ -211,7 +294,7 @@ module OpenStudio
|
|
211
294
|
end
|
212
295
|
|
213
296
|
def upload_datapoint(analysis_id, options)
|
214
|
-
defaults = {
|
297
|
+
defaults = {reset_uuids: false}
|
215
298
|
options = defaults.merge(options)
|
216
299
|
|
217
300
|
fail 'No analysis id passed' if analysis_id.nil?
|
@@ -264,7 +347,7 @@ module OpenStudio
|
|
264
347
|
end
|
265
348
|
|
266
349
|
def run_analysis(analysis_id, options)
|
267
|
-
defaults = {
|
350
|
+
defaults = {analysis_action: 'start', without_delay: false}
|
268
351
|
options = defaults.merge(options)
|
269
352
|
|
270
353
|
puts "Run analysis is configured with #{options.to_json}"
|
@@ -283,7 +366,7 @@ module OpenStudio
|
|
283
366
|
end
|
284
367
|
|
285
368
|
def kill_analysis(analysis_id)
|
286
|
-
analysis_action = {
|
369
|
+
analysis_action = {analysis_action: 'stop'}
|
287
370
|
|
288
371
|
response = @conn.post do |req|
|
289
372
|
req.url "analyses/#{analysis_id}/action.json"
|
@@ -313,16 +396,137 @@ module OpenStudio
|
|
313
396
|
end
|
314
397
|
|
315
398
|
def get_datapoint_status(analysis_id, filter = nil)
|
399
|
+
data_points = nil
|
316
400
|
# get the status of all the entire analysis
|
317
401
|
unless analysis_id.nil?
|
318
402
|
if filter.nil? || filter == ''
|
319
403
|
resp = @conn.get "analyses/#{analysis_id}/status.json"
|
320
|
-
|
404
|
+
if resp.status == 200
|
405
|
+
data_points = JSON.parse(resp.body, symbolize_names: true)[:data_points]
|
406
|
+
end
|
321
407
|
else
|
322
408
|
resp = @conn.get "#{@hostname}/analyses/#{analysis_id}/status.json", jobs: filter
|
323
|
-
|
409
|
+
if resp.status == 200
|
410
|
+
data_points = JSON.parse(resp.body, symbolize_names: true)[:data_points]
|
411
|
+
end
|
324
412
|
end
|
325
413
|
end
|
414
|
+
|
415
|
+
data_points
|
416
|
+
end
|
417
|
+
|
418
|
+
# Return the JSON (Full) of the datapoint
|
419
|
+
def get_datapoint(data_point_id)
|
420
|
+
data_point = nil
|
421
|
+
|
422
|
+
resp = @conn.get "/data_points/#{data_point_id}/show_full.json"
|
423
|
+
if resp.status == 200
|
424
|
+
data_point = JSON.parse resp.body, symbolize_names: true
|
425
|
+
end
|
426
|
+
|
427
|
+
data_point
|
428
|
+
end
|
429
|
+
|
430
|
+
## here are a bunch of runs that really don't belong here.
|
431
|
+
|
432
|
+
# create a new analysis and run a single model
|
433
|
+
def run_single_model(formulation_filename, analysis_zip_filename)
|
434
|
+
project_options = {}
|
435
|
+
project_id = new_project(project_options)
|
436
|
+
|
437
|
+
analysis_options = {
|
438
|
+
formulation_file: formulation_filename,
|
439
|
+
upload_file: analysis_zip_filename,
|
440
|
+
reset_uuids: true
|
441
|
+
}
|
442
|
+
analysis_id = new_analysis(project_id, analysis_options)
|
443
|
+
|
444
|
+
# Force this to run in the foreground for now until we can deal with checing the 'analysis state of various anlaysis'
|
445
|
+
run_options = {
|
446
|
+
analysis_action: "start",
|
447
|
+
without_delay: true, # run this in the foreground
|
448
|
+
analysis_type: 'single_run',
|
449
|
+
allow_multiple_jobs: true,
|
450
|
+
use_server_as_worker: true,
|
451
|
+
simulate_data_point_filename: 'simulate_data_point.rb',
|
452
|
+
run_data_point_filename: 'run_openstudio_workflow_monthly.rb'
|
453
|
+
}
|
454
|
+
run_analysis(analysis_id, run_options)
|
455
|
+
|
456
|
+
run_options = {
|
457
|
+
analysis_action: "start",
|
458
|
+
without_delay: false, # run in background
|
459
|
+
analysis_type: 'batch_run',
|
460
|
+
allow_multiple_jobs: true,
|
461
|
+
use_server_as_worker: true,
|
462
|
+
simulate_data_point_filename: 'simulate_data_point.rb',
|
463
|
+
run_data_point_filename: 'run_openstudio_workflow_monthly.rb'
|
464
|
+
}
|
465
|
+
run_analysis(analysis_id, run_options)
|
466
|
+
|
467
|
+
analysis_id
|
468
|
+
end
|
469
|
+
|
470
|
+
# creates a new analysis and runs rgenoud optimization - number of generations isn't used right now
|
471
|
+
def run_rgenoud(formulation_filename, analysis_zip_filename, number_of_generations)
|
472
|
+
project_options = {}
|
473
|
+
project_id = new_project(project_options)
|
474
|
+
|
475
|
+
analysis_options = {
|
476
|
+
formulation_file: formulation_filename,
|
477
|
+
upload_file: analysis_zip_filename,
|
478
|
+
reset_uuids: true
|
479
|
+
}
|
480
|
+
analysis_id = new_analysis(project_id, analysis_options)
|
481
|
+
|
482
|
+
run_options = {
|
483
|
+
analysis_action: "start",
|
484
|
+
without_delay: false,
|
485
|
+
analysis_type: 'rgenoud',
|
486
|
+
allow_multiple_jobs: true,
|
487
|
+
use_server_as_worker: true,
|
488
|
+
simulate_data_point_filename: 'simulate_data_point.rb',
|
489
|
+
run_data_point_filename: 'run_openstudio_workflow_monthly.rb'
|
490
|
+
}
|
491
|
+
run_analysis(analysis_id, run_options)
|
492
|
+
|
493
|
+
analysis_id
|
494
|
+
end
|
495
|
+
|
496
|
+
def run_lhs(formulation_filename, analysis_zip_filename)
|
497
|
+
project_options = {}
|
498
|
+
project_id = new_project(project_options)
|
499
|
+
|
500
|
+
analysis_options = {
|
501
|
+
formulation_file: formulation_filename,
|
502
|
+
upload_file: analysis_zip_filename,
|
503
|
+
reset_uuids: true
|
504
|
+
}
|
505
|
+
analysis_id = new_analysis(project_id, analysis_options)
|
506
|
+
|
507
|
+
run_options = {
|
508
|
+
analysis_action: "start",
|
509
|
+
without_delay: false,
|
510
|
+
analysis_type: 'lhs',
|
511
|
+
allow_multiple_jobs: true,
|
512
|
+
use_server_as_worker: true,
|
513
|
+
simulate_data_point_filename: 'simulate_data_point.rb',
|
514
|
+
run_data_point_filename: 'run_openstudio_workflow_monthly.rb'
|
515
|
+
}
|
516
|
+
run_analysis(analysis_id, run_options)
|
517
|
+
|
518
|
+
run_options = {
|
519
|
+
analysis_action: "start",
|
520
|
+
without_delay: false, # run in background
|
521
|
+
analysis_type: 'batch_run',
|
522
|
+
allow_multiple_jobs: true,
|
523
|
+
use_server_as_worker: true,
|
524
|
+
simulate_data_point_filename: 'simulate_data_point.rb',
|
525
|
+
run_data_point_filename: 'run_openstudio_workflow_monthly.rb'
|
526
|
+
}
|
527
|
+
run_analysis(analysis_id, run_options)
|
528
|
+
|
529
|
+
analysis_id
|
326
530
|
end
|
327
531
|
end
|
328
532
|
end
|