Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Add versioning and prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean A. Senellart committed Jul 31, 2018
1 parent f77c1ee commit 0926cbc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## [Unreleased]

### Breaking changes

### New features

### Fixes and improvements

## [v0.2.0](https://github.com/OpenNMT/nmt-wizard/releases/tag/v0.2.0) (2018-07-31)

### Breaking changes
* redefine more consistent routes
* change `task_id` as positional argument for simpler client commands
Expand All @@ -8,6 +16,7 @@

### New features

* versioning information
* possibility to launch multi-gpu tasks
* launch error now reports error message in task log
* define `auto` registry - resolved by launcher checking at `default_for` in registry definition
Expand Down
20 changes: 20 additions & 0 deletions client/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@
from datetime import datetime
import math

VERSION = "0.2.0-ce"
def append_version(v):
global VERSION
VERSION += ":" + v
def get_version():
return VERSION

class VersionAction(argparse.Action):
def __init__(self, nargs=0, **kw):
super(VersionAction, self).__init__(nargs=nargs, **kw)
def __call__(self, parser, namespace, values, option_string=None):
print("Client version: %s" % VERSION)
r = requests.get(os.path.join(os.getenv('LAUNCHER_URL'), "version"))
if r.status_code != 200:
raise RuntimeError('incorrect result from \'version\' service: %s' % r.text)
print("Server version: %s" % r.text)
sys.exit(1)

reimage = re.compile(r"(([-A-Za-z_.0-9]+):|)([-A-Za-z_.0-9]+/[-A-Za-z_.0-9]+)(:([-A-Za-z_.0-9]+)|)$")
logger = None

Expand Down Expand Up @@ -133,6 +151,8 @@ def confirm(prompt=None, resp=False):
help="task identifier")
parser_file.add_argument('-f', '--filename',
help="filename to retrieve - for instance log", required=True)
parser.add_argument('--version', action=VersionAction, help="Version information")


def process_request(serviceList, cmd, is_json, args, auth=None):
res = None
Expand Down
7 changes: 7 additions & 0 deletions server/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
import time
from redis.exceptions import ConnectionError

VERSION = "0.2.0-ce"
def append_version(v):
global VERSION
VERSION += ":" + v
def get_version():
return VERSION

app = Flask(__name__)

ch = logging.StreamHandler()
Expand Down
6 changes: 5 additions & 1 deletion server/app/routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app import app, redis, services
from app import app, redis, services, get_version
import flask
from nmtwizard import common, task
from nmtwizard.helper import build_task_id, shallow_command_analysis, change_parent_task
Expand Down Expand Up @@ -309,3 +309,7 @@ def post_log(task_id):
@app.route("/status", methods=["GET"])
def get_status():
return flask.jsonify(200)

@app.route("/version", methods=["GET"])
def get_version_request():
return flask.make_response(get_version())

0 comments on commit 0926cbc

Please sign in to comment.