Skip to content

Commit

Permalink
add port support in solver
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyaoi committed Sep 12, 2018
1 parent 13579cc commit ba5aecd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cvpm/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ def train():
return json.dumps({"error": "not supported!", "code": "404"}), 404


def run_server(solver):
port = get_available_port()
def run_server(solver, port=None):
if port is None:
port = get_available_port()
logger.info("Server Running On: " + str(port))
with server.app_context():
server.solver = solver
Expand Down
4 changes: 2 additions & 2 deletions cvpm/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ def infer(self, input, config):
def train(self, train_x, train_y, **kwargs):
pass

def start(self):
run_server(self)
def start(self, port=None):
run_server(self, port)

0 comments on commit ba5aecd

Please sign in to comment.