Skip to content

Commit

Permalink
Merge pull request #359 from roscisz/develop
Browse files Browse the repository at this point in the history
R1.1.0
  • Loading branch information
roscisz authored Feb 2, 2022
2 parents 22b15fc + 126ab6f commit 5b50245
Show file tree
Hide file tree
Showing 42 changed files with 604 additions and 296 deletions.
93 changes: 87 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
TensorHive
===
![](https://img.shields.io/badge/release-v1.0.0-brightgreen.svg?style=popout-square)
![](https://img.shields.io/badge/pypi-v1.0.0-brightgreen.svg?style=popout-square)
![](https://img.shields.io/badge/release-v1.1.0-brightgreen.svg?style=popout-square)
![](https://img.shields.io/badge/pypi-v1.1.0-brightgreen.svg?style=popout-square)
![](https://img.shields.io/badge/Issues%20and%20PRs-welcome-yellow.svg?style=popout-square)
![](https://img.shields.io/badge/platform-Linux-blue.svg?style=popout-square)
![](https://img.shields.io/badge/hardware-Nvidia-green.svg?style=popout-square)
![](https://img.shields.io/badge/platform-GNU/Linux-blue.svg?style=popout-square)
![](https://img.shields.io/badge/python-3.5%20|%203.6%20|%203.7%20|%203.8-blue.svg?style=popout-square)
![](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=popout-square)

Expand Down Expand Up @@ -158,14 +157,96 @@ Web application and API Documentation can be accessed via URLs highlighted in gr
##### Advanced configuration
You can fully customize TensorHive behaviours via INI configuration files (which will be created automatically after `tensorhive init`):
```
~/.config/TensorHive/hosts_config.ini
~/.config/TensorHive/main_config.ini
~/.config/TensorHive/mailbot_config.ini
~/.config/TensorHive/hosts_config.ini
```
[(see example)](https://github.com/roscisz/TensorHive/blob/master/tensorhive/main_config.ini)
<details>
<summary>(see example)</summary>
<p>

[hosts_config.ini](https://github.com/roscisz/TensorHive/blob/master/tensorhive/hosts_config.ini)
[main_config.ini](https://github.com/roscisz/TensorHive/blob/master/tensorhive/main_config.ini)
[mailbot_config.ini](https://github.com/roscisz/TensorHive/blob/master/tensorhive/mailbot_config.ini)


</p>
</details>

----------------------

#### Reverse proxy setup

Serving TensorHive through reverse proxy requires proper configuration of URL parameters in the `[api]` section of
`main_config.ini`, including `url_schema`, `url_hostname`, `url_port` and `url_prefix`.

<details>
<summary>(see example)</summary>
<p>

Let's assume that the WebApp is served locally on `http://localhost:5000`, the API on `http://localhost:1111` and we
want to serve TensorHive publicly at `https://some-server/tensorhive`. In such case the following `main_config.ini`:

```
url_schema = https
url_hostname = some-server
url_port = 443
url_prefix = tensorhive/api
```
should be used along with a reverse proxy similar to the following example for nginx:

```
location /tensorhive {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
proxy_pass http://localhost:5000/tensorhive;
proxy_set_header SCRIPT_NAME /tensorhive;
}
location /tensorhive/api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
proxy_pass http://localhost:1111;
}
```

</p>
</details>

Citation
------------------------
If you use TensorHive for a scientific publication, we would appreciate citations:

```bibtex
@article{JMLR:v22:20-225,
author = {Paweł Rościszewski and Michał Martyniak and Filip Schodowski},
title = {TensorHive: Management of Exclusive GPU Access for Distributed Machine Learning Workloads},
journal = {Journal of Machine Learning Research},
year = {2021},
volume = {22},
number = {215},
pages = {1-5},
url = {http://jmlr.org/papers/v22/20-225.html}
}
```

Contribution and feedback
------------------------
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
'Click==7.0',
'clickclick==20.10.2',
'coloredlogs==10.0',
'connexion==2.3.0',
'cryptography==3.3.2',
'connexion==2.5.0',
'cryptography==3.2.1',
'Flask==1.1.4',
'Flask-Cors==3.0.9',
'Flask-JWT-Extended==3.13.1',
Expand All @@ -61,7 +61,7 @@
'python-dateutil==2.8.1',
'python-editor==1.0.4',
'python-usernames==0.2.3',
'PyYAML==5.4',
'PyYAML==5.3.1',
'requests==2.25.1',
'Safe==0.4',
'six==1.16.0',
Expand Down
2 changes: 1 addition & 1 deletion tensorhive/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.0'
__version__ = '1.1.0'
5 changes: 3 additions & 2 deletions tensorhive/api/APIServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ def shutdown_session(exception=None):
strict_validation=True)
CORS(app.app)
log.info('[⚙] Starting API server with {} backend'.format(API_SERVER.BACKEND))
URL = 'http://{host}:{port}/{url_prefix}/ui/'.format(
URL = '{schema}://{host}:{port}/{url_prefix}/ui/'.format(
schema=API.URL_SCHEMA,
host=API.URL_HOSTNAME,
port=API_SERVER.PORT,
port=API.URL_PORT,
url_prefix=API.URL_PREFIX)
log.info(green('[✔] API documentation (Swagger UI) available at: {}'.format(URL)))
app.run(server=API_SERVER.BACKEND,
Expand Down
7 changes: 4 additions & 3 deletions tensorhive/app/web/AppServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ def _inject_api_endpoint_to_app():
try:
web_app_json_config_path = PosixPath(__file__).parent / 'dist/static/config.json'
data = {
'apiPath': 'http://{}:{}/{}'.format(
'apiPath': '{}://{}:{}/{}'.format(
API.URL_SCHEMA,
API.URL_HOSTNAME,
API_SERVER.PORT,
API.URL_PORT,
API.URL_PREFIX),
'version': tensorhive.__version__
}
Expand All @@ -78,7 +79,7 @@ def start_server():
'workers': APP_SERVER.WORKERS,
'loglevel': APP_SERVER.LOG_LEVEL
}
log.info(green('[✔] Web App available at: http://{}:{}'.format(API.URL_HOSTNAME, APP_SERVER.PORT)))
log.info(green('[✔] Web App available at: http://{}:{}'.format(APP_SERVER.HOST, APP_SERVER.PORT)))
GunicornStandaloneApplication(app, options).run()
else:
raise NotImplementedError('Selected backend is not supported yet.')
Expand Down
4 changes: 3 additions & 1 deletion tensorhive/app/web/dev/build_vue/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ module.exports = {
loader: 'url-loader',
query: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
name: utils.assetsPath('fonts/[name].[hash:7].[ext]'),
// workaround for vuejs-templates webpack issue 1266
publicPath: process.env.NODE_ENV === 'production' ? '../../' : '/'
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion tensorhive/app/web/dev/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
index: path.resolve(__dirname, '../../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
assetsPublicPath: './',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
Expand Down
42 changes: 21 additions & 21 deletions tensorhive/app/web/dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" sizes="57x57" href="/static/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/static/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/static/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/static/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/static/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/static/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/static/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/static/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/static/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/static/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon/favicon-16x16.png">
<link rel="manifest" href="/static/favicon/manifest.json">
<link rel="apple-touch-icon" sizes="57x57" href="./static/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="./static/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="./static/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="./static/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="./static/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="./static/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="./static/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="./static/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="./static/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="./static/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="./static/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="./static/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="./static/favicon/favicon-16x16.png">
<link rel="manifest" href="./static/favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="msapplication-TileImage" content="./ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<title>TensorHive</title>
<!-- css -->
<link rel="stylesheet" href="/static/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="./static/bootstrap/bootstrap.min.css">

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

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

<!-- built files will be auto injected. Static files below -->
<script src="/static/jQuery/jQuery-2.2.0.min.js"></script>
<script src="/static/bootstrap/bootstrap.min.js"></script>
<script src="/static/AdminLTE/app.min.js"></script>
<script src="./static/jQuery/jQuery-2.2.0.min.js"></script>
<script src="./static/bootstrap/bootstrap.min.js"></script>
<script src="./static/AdminLTE/app.min.js"></script>
</body>
</html>
Loading

0 comments on commit 5b50245

Please sign in to comment.