forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig_generator.html
214 lines (184 loc) · 7.34 KB
/
config_generator.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Releaser config generator</title>
<style type="text/css">
html {
background: #cccccc;
}
body {
background: #ffffff;
font-family: sans-serif;
padding: 1em 2em;
max-width: 800px;
margin: 0 auto;
}
textarea {
width: 600px;
height: 200px;
}
form .use {
white-space: nowrap;
padding-right: 1em;
}
form .val {
min-width: 300px;
}
form .val input {
width: 90%;
}
form .desc {
}
</style>
<script type="text/javascript">
var env_vars = [
{
"name": "RAY_TEST_REPO",
"short": "Git repo with test files",
"long": "Repository in which the test files are which you would like to run. Note that this doesn't have to be the same repo from which the wheels are installed.",
"default": "https://github.com/ray-project/ray.git",
"enabled": false,
},
{
"name": "RAY_TEST_BRANCH",
"short": "Git branch for test repo",
"long": "Git branch that is checked out from RAY_TEST_REPO and which contains the test files you would like to run. Note that this doesnt' have to be the same branch you're fetching the Ray wheels from.",
"default": "master",
"enabled": false,
},
{
"name": "RAY_REPO",
"short": "Git repo for the Ray wheels",
"long": "Repository from which to fetch the latest commits to find the Ray wheels",
"default": "https://github.com/ray-project/ray.git",
"enabled": false,
},
{
"name": "RAY_BRANCH",
"short": "Git branch for the Ray wheels",
"long": "Branch that is check out from RAY_REPO from which the latest commits are fetched to find the Ray wheels",
"default": "master",
"enabled": true,
},
{
"name": "RELEASE_TEST_SUITE",
"short": "Release test suite (nightly/weekly/manual)",
"long": "Release test suite as defined in releaser's build_pipeline.py",
"default": "nightly",
"enabled": true,
},
{
"name": "FILTER_FILE",
"short": "Filter test file by this string",
"long": "Only test files (e.g. xgboost_tests.yml) that match this string will be included in the test",
"default": "",
"enabled": false,
},
{
"name": "FILTER_TEST",
"short": "Filter test name by this string",
"long": "Only test names (e.g. tune_4x32) that match this string will be included in the test",
"default": "",
"enabled": false,
},
]
window.addEventListener('load', function () {
var table = document.getElementById("gen_table");
for (var env_var of env_vars) {
var use_td = document.createElement("td");
use_td.setAttribute("class", "use");
var use_input = document.createElement("input");
use_input.setAttribute("type", "checkbox");
use_input.setAttribute("data-activate", env_var["name"] + "_val");
use_input.setAttribute("id", env_var["name"] + "_use");
use_input.setAttribute("class", "input_use");
if (env_var["enabled"]) {
use_input.checked = true;
}
var use_label = document.createElement("label");
use_label.setAttribute("for", env_var["name"] + "_use");
use_label.innerHTML = env_var["name"];
use_td.append(use_input);
use_td.append(use_label);
val_td = document.createElement("td");
val_td.setAttribute("class", "val");
val_input = document.createElement("input");
val_input.setAttribute("type", "text");
if (!env_var["enabled"]) {
val_input.setAttribute("disabled", "disabled");
}
val_input.setAttribute("id", env_var["name"] + "_val");
val_input.setAttribute("name", env_var["name"]);
val_input.setAttribute("value", env_var["default"]);
val_input.setAttribute("class", "input_val");
val_td.append(val_input);
use_input.addEventListener("click", function(e) {
var toggle_val = document.getElementById(e.target.getAttribute("data-activate"))
if (toggle_val.disabled) {
toggle_val.removeAttribute("disabled");
} else {
toggle_val.setAttribute("disabled", "disabled");
}
generate_snippet();
});
val_input.addEventListener("change", function() { generate_snippet(); });
val_input.addEventListener("keydown", function() { generate_snippet(); });
val_input.addEventListener("keyup", function() { generate_snippet(); });
var desc_td = document.createElement("td");
desc_td.setAttribute("class", "desc");
var desc_a = document.createElement("a");
desc_a.setAttribute("title", env_var["long"]);
desc_a.innerHTML = env_var["short"];
desc_td.append(desc_a);
var tr = document.createElement("tr");
tr.append(use_td);
tr.append(val_td);
tr.append(desc_td);
table.append(tr);
}
var button = document.getElementById("generate");
button.addEventListener("click", function() {
generate_snippet();
})
generate_snippet()
})
function generate_snippet() {
full_snippet = ""
for (env_var of env_vars) {
var val_input = document.getElementById(env_var["name"] + "_val")
if (!val_input.disabled) {
full_snippet += env_var["name"] + "=\"" + val_input.value + "\"\n"
}
}
document.getElementById("snippet").innerHTML = full_snippet;
}
</script>
</head>
<body>
<header class="header">
<h1>Releaser config generator</h1>
<p>Use this form to generate a list of environment variables.</p>
<p>These variables can be passed to Buildkite to run a subset of release tests
and choose the correct wheels/release test branch</p>
</header>
<section class="main">
<form id="gen">
<table id="gen_table">
<tr>
<th>Set</th>
<th>Value</th>
<th>Description</th>
</tr>
</table>
</form>
<div>
<button id="generate">Generate snippet</button>
</div>
<div>
<textarea id="snippet">
</textarea>
</div>
</section>
</body>
</html>