Skip to content

Commit 5b50245

Browse files
authored
Merge pull request #359 from roscisz/develop
R1.1.0
2 parents 22b15fc + 126ab6f commit 5b50245

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+604
-296
lines changed

README.md

Lines changed: 87 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
TensorHive
22
===
3-
![](https://img.shields.io/badge/release-v1.0.0-brightgreen.svg?style=popout-square)
4-
![](https://img.shields.io/badge/pypi-v1.0.0-brightgreen.svg?style=popout-square)
3+
![](https://img.shields.io/badge/release-v1.1.0-brightgreen.svg?style=popout-square)
4+
![](https://img.shields.io/badge/pypi-v1.1.0-brightgreen.svg?style=popout-square)
55
![](https://img.shields.io/badge/Issues%20and%20PRs-welcome-yellow.svg?style=popout-square)
6-
![](https://img.shields.io/badge/platform-Linux-blue.svg?style=popout-square)
7-
![](https://img.shields.io/badge/hardware-Nvidia-green.svg?style=popout-square)
6+
![](https://img.shields.io/badge/platform-GNU/Linux-blue.svg?style=popout-square)
87
![](https://img.shields.io/badge/python-3.5%20|%203.6%20|%203.7%20|%203.8-blue.svg?style=popout-square)
98
![](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=popout-square)
109

@@ -158,14 +157,96 @@ Web application and API Documentation can be accessed via URLs highlighted in gr
158157
##### Advanced configuration
159158
You can fully customize TensorHive behaviours via INI configuration files (which will be created automatically after `tensorhive init`):
160159
```
160+
~/.config/TensorHive/hosts_config.ini
161161
~/.config/TensorHive/main_config.ini
162162
~/.config/TensorHive/mailbot_config.ini
163-
~/.config/TensorHive/hosts_config.ini
164163
```
165-
[(see example)](https://github.com/roscisz/TensorHive/blob/master/tensorhive/main_config.ini)
164+
<details>
165+
<summary>(see example)</summary>
166+
<p>
167+
168+
[hosts_config.ini](https://github.com/roscisz/TensorHive/blob/master/tensorhive/hosts_config.ini)
169+
[main_config.ini](https://github.com/roscisz/TensorHive/blob/master/tensorhive/main_config.ini)
170+
[mailbot_config.ini](https://github.com/roscisz/TensorHive/blob/master/tensorhive/mailbot_config.ini)
171+
172+
173+
</p>
174+
</details>
166175

167176
----------------------
168177

178+
#### Reverse proxy setup
179+
180+
Serving TensorHive through reverse proxy requires proper configuration of URL parameters in the `[api]` section of
181+
`main_config.ini`, including `url_schema`, `url_hostname`, `url_port` and `url_prefix`.
182+
183+
<details>
184+
<summary>(see example)</summary>
185+
<p>
186+
187+
Let's assume that the WebApp is served locally on `http://localhost:5000`, the API on `http://localhost:1111` and we
188+
want to serve TensorHive publicly at `https://some-server/tensorhive`. In such case the following `main_config.ini`:
189+
190+
```
191+
url_schema = https
192+
url_hostname = some-server
193+
url_port = 443
194+
url_prefix = tensorhive/api
195+
```
196+
should be used along with a reverse proxy similar to the following example for nginx:
197+
198+
```
199+
location /tensorhive {
200+
proxy_set_header X-Real-IP $remote_addr;
201+
proxy_set_header Host $host;
202+
proxy_set_header X-Forwarded-Host $host:$server_port;
203+
proxy_set_header X-Forwarded-Server $host;
204+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
205+
206+
add_header 'Access-Control-Allow-Origin' '*';
207+
add_header 'Access-Control-Allow-Credentials' 'true';
208+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
209+
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
210+
211+
proxy_pass http://localhost:5000/tensorhive;
212+
proxy_set_header SCRIPT_NAME /tensorhive;
213+
}
214+
215+
location /tensorhive/api {
216+
proxy_set_header X-Real-IP $remote_addr;
217+
proxy_set_header Host $host;
218+
proxy_set_header X-Forwarded-Host $host:$server_port;
219+
proxy_set_header X-Forwarded-Server $host;
220+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
221+
222+
add_header 'Access-Control-Allow-Origin' '*';
223+
add_header 'Access-Control-Allow-Credentials' 'true';
224+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
225+
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
226+
227+
proxy_pass http://localhost:1111;
228+
}
229+
```
230+
231+
</p>
232+
</details>
233+
234+
Citation
235+
------------------------
236+
If you use TensorHive for a scientific publication, we would appreciate citations:
237+
238+
```bibtex
239+
@article{JMLR:v22:20-225,
240+
author = {Paweł Rościszewski and Michał Martyniak and Filip Schodowski},
241+
title = {TensorHive: Management of Exclusive GPU Access for Distributed Machine Learning Workloads},
242+
journal = {Journal of Machine Learning Research},
243+
year = {2021},
244+
volume = {22},
245+
number = {215},
246+
pages = {1-5},
247+
url = {http://jmlr.org/papers/v22/20-225.html}
248+
}
249+
```
169250

170251
Contribution and feedback
171252
------------------------

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
'Click==7.0',
3636
'clickclick==20.10.2',
3737
'coloredlogs==10.0',
38-
'connexion==2.3.0',
39-
'cryptography==3.3.2',
38+
'connexion==2.5.0',
39+
'cryptography==3.2.1',
4040
'Flask==1.1.4',
4141
'Flask-Cors==3.0.9',
4242
'Flask-JWT-Extended==3.13.1',
@@ -61,7 +61,7 @@
6161
'python-dateutil==2.8.1',
6262
'python-editor==1.0.4',
6363
'python-usernames==0.2.3',
64-
'PyYAML==5.4',
64+
'PyYAML==5.3.1',
6565
'requests==2.25.1',
6666
'Safe==0.4',
6767
'six==1.16.0',

tensorhive/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.0.0'
1+
__version__ = '1.1.0'

tensorhive/api/APIServer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ def shutdown_session(exception=None):
3232
strict_validation=True)
3333
CORS(app.app)
3434
log.info('[⚙] Starting API server with {} backend'.format(API_SERVER.BACKEND))
35-
URL = 'http://{host}:{port}/{url_prefix}/ui/'.format(
35+
URL = '{schema}://{host}:{port}/{url_prefix}/ui/'.format(
36+
schema=API.URL_SCHEMA,
3637
host=API.URL_HOSTNAME,
37-
port=API_SERVER.PORT,
38+
port=API.URL_PORT,
3839
url_prefix=API.URL_PREFIX)
3940
log.info(green('[✔] API documentation (Swagger UI) available at: {}'.format(URL)))
4041
app.run(server=API_SERVER.BACKEND,

tensorhive/app/web/AppServer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ def _inject_api_endpoint_to_app():
5050
try:
5151
web_app_json_config_path = PosixPath(__file__).parent / 'dist/static/config.json'
5252
data = {
53-
'apiPath': 'http://{}:{}/{}'.format(
53+
'apiPath': '{}://{}:{}/{}'.format(
54+
API.URL_SCHEMA,
5455
API.URL_HOSTNAME,
55-
API_SERVER.PORT,
56+
API.URL_PORT,
5657
API.URL_PREFIX),
5758
'version': tensorhive.__version__
5859
}
@@ -78,7 +79,7 @@ def start_server():
7879
'workers': APP_SERVER.WORKERS,
7980
'loglevel': APP_SERVER.LOG_LEVEL
8081
}
81-
log.info(green('[✔] Web App available at: http://{}:{}'.format(API.URL_HOSTNAME, APP_SERVER.PORT)))
82+
log.info(green('[✔] Web App available at: http://{}:{}'.format(APP_SERVER.HOST, APP_SERVER.PORT)))
8283
GunicornStandaloneApplication(app, options).run()
8384
else:
8485
raise NotImplementedError('Selected backend is not supported yet.')

tensorhive/app/web/dev/build_vue/webpack.base.conf.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ module.exports = {
6060
loader: 'url-loader',
6161
query: {
6262
limit: 10000,
63-
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
63+
name: utils.assetsPath('fonts/[name].[hash:7].[ext]'),
64+
// workaround for vuejs-templates webpack issue 1266
65+
publicPath: process.env.NODE_ENV === 'production' ? '../../' : '/'
6466
}
6567
}
6668
]

tensorhive/app/web/dev/config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
index: path.resolve(__dirname, '../../dist/index.html'),
88
assetsRoot: path.resolve(__dirname, '../../dist'),
99
assetsSubDirectory: 'static',
10-
assetsPublicPath: '/',
10+
assetsPublicPath: './',
1111
productionSourceMap: true,
1212
// Gzip off by default as many popular static hosts such as
1313
// Surge or Netlify already gzip all static assets for you.

tensorhive/app/web/dev/index.html

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,39 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
<link rel="apple-touch-icon" sizes="57x57" href="/static/favicon/apple-icon-57x57.png">
7-
<link rel="apple-touch-icon" sizes="60x60" href="/static/favicon/apple-icon-60x60.png">
8-
<link rel="apple-touch-icon" sizes="72x72" href="/static/favicon/apple-icon-72x72.png">
9-
<link rel="apple-touch-icon" sizes="76x76" href="/static/favicon/apple-icon-76x76.png">
10-
<link rel="apple-touch-icon" sizes="114x114" href="/static/favicon/apple-icon-114x114.png">
11-
<link rel="apple-touch-icon" sizes="120x120" href="/static/favicon/apple-icon-120x120.png">
12-
<link rel="apple-touch-icon" sizes="144x144" href="/static/favicon/apple-icon-144x144.png">
13-
<link rel="apple-touch-icon" sizes="152x152" href="/static/favicon/apple-icon-152x152.png">
14-
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicon/apple-icon-180x180.png">
15-
<link rel="icon" type="image/png" sizes="192x192" href="/static/favicon/android-icon-192x192.png">
16-
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon/favicon-32x32.png">
17-
<link rel="icon" type="image/png" sizes="96x96" href="/static/favicon/favicon-96x96.png">
18-
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon/favicon-16x16.png">
19-
<link rel="manifest" href="/static/favicon/manifest.json">
6+
<link rel="apple-touch-icon" sizes="57x57" href="./static/favicon/apple-icon-57x57.png">
7+
<link rel="apple-touch-icon" sizes="60x60" href="./static/favicon/apple-icon-60x60.png">
8+
<link rel="apple-touch-icon" sizes="72x72" href="./static/favicon/apple-icon-72x72.png">
9+
<link rel="apple-touch-icon" sizes="76x76" href="./static/favicon/apple-icon-76x76.png">
10+
<link rel="apple-touch-icon" sizes="114x114" href="./static/favicon/apple-icon-114x114.png">
11+
<link rel="apple-touch-icon" sizes="120x120" href="./static/favicon/apple-icon-120x120.png">
12+
<link rel="apple-touch-icon" sizes="144x144" href="./static/favicon/apple-icon-144x144.png">
13+
<link rel="apple-touch-icon" sizes="152x152" href="./static/favicon/apple-icon-152x152.png">
14+
<link rel="apple-touch-icon" sizes="180x180" href="./static/favicon/apple-icon-180x180.png">
15+
<link rel="icon" type="image/png" sizes="192x192" href="./static/favicon/android-icon-192x192.png">
16+
<link rel="icon" type="image/png" sizes="32x32" href="./static/favicon/favicon-32x32.png">
17+
<link rel="icon" type="image/png" sizes="96x96" href="./static/favicon/favicon-96x96.png">
18+
<link rel="icon" type="image/png" sizes="16x16" href="./static/favicon/favicon-16x16.png">
19+
<link rel="manifest" href="./static/favicon/manifest.json">
2020
<meta name="msapplication-TileColor" content="#ffffff">
21-
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
21+
<meta name="msapplication-TileImage" content="./ms-icon-144x144.png">
2222
<meta name="theme-color" content="#ffffff">
2323
<title>TensorHive</title>
2424
<!-- css -->
25-
<link rel="stylesheet" href="/static/bootstrap/bootstrap.min.css">
25+
<link rel="stylesheet" href="./static/bootstrap/bootstrap.min.css">
2626

2727
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
2828
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
2929

30-
<link rel="stylesheet" href="/static/AdminLTE/AdminLTE.min.css">
31-
<link rel="stylesheet" href="/static/AdminLTE/skin-blue.min.css">
30+
<link rel="stylesheet" href="./static/AdminLTE/AdminLTE.min.css">
31+
<link rel="stylesheet" href="./static/AdminLTE/skin-blue.min.css">
3232
</head>
3333
<body class="hold-transition skin-blue sidebar-mini sidebar-collapse">
3434
<div id="root"></div>
3535

3636
<!-- built files will be auto injected. Static files below -->
37-
<script src="/static/jQuery/jQuery-2.2.0.min.js"></script>
38-
<script src="/static/bootstrap/bootstrap.min.js"></script>
39-
<script src="/static/AdminLTE/app.min.js"></script>
37+
<script src="./static/jQuery/jQuery-2.2.0.min.js"></script>
38+
<script src="./static/bootstrap/bootstrap.min.js"></script>
39+
<script src="./static/AdminLTE/app.min.js"></script>
4040
</body>
4141
</html>

0 commit comments

Comments
 (0)