Skip to content

Commit

Permalink
Merge pull request #43 from SpiNNakerManchester/ignore_version
Browse files Browse the repository at this point in the history
Ignore version
  • Loading branch information
andrewgait committed Jan 31, 2020
2 parents acdec43 + c3704d0 commit 2e13446
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions spalloc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
"min_ratio": "0.333",
"max_dead_boards": "0",
"max_dead_links": "None",
"require_torus": "False"}
"require_torus": "False",
"ignore_version": "False"}


def _read_none_or_float(parser, option):
Expand Down Expand Up @@ -182,7 +183,8 @@ def read_config(filenames=None):
"min_ratio": parser.getfloat(SECTION, "min_ratio"),
"max_dead_boards": _read_none_or_int(parser, "max_dead_boards"),
"max_dead_links": _read_none_or_int(parser, "max_dead_links"),
"require_torus": parser.getboolean(SECTION, "require_torus")}
"require_torus": parser.getboolean(SECTION, "require_torus"),
"ignore_version": parser.getboolean(SECTION, "ignore_version")}

tags = _read_none_or_str(parser, "tags")
cfg["tags"] = None if tags is None else list(
Expand Down
9 changes: 7 additions & 2 deletions spalloc/scripts/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# The acceptable range of server version numbers
VERSION_RANGE_START = (0, 1, 0)
VERSION_RANGE_STOP = (2, 0, 0)
VERSION_RANGE_STOP = (5, 0, 1)


class Terminate(Exception):
Expand Down Expand Up @@ -79,6 +79,10 @@ def build_server_arg_group(self, server_args, cfg):
"--timeout", default=cfg["timeout"], type=float, metavar="SECONDS",
help="seconds to wait for a response from the server (default: "
"%(default)s)")
server_args.add_argument(
"--ignore_version", default=cfg["ignore_version"], type=bool,
help="Ignore the server version (WARNING: could result in errors) "
"default: %(default)s)")

def __call__(self, argv=None):
cfg = config.read_config()
Expand All @@ -94,7 +98,8 @@ def __call__(self, argv=None):

try:
with self.client_factory(args.hostname, args.port) as client:
version_verify(client, args.timeout)
if not args.ignore_version:
version_verify(client, args.timeout)
self.body(client, args)
return 0
except (IOError, OSError, ProtocolError, ProtocolTimeoutError) as e:
Expand Down

0 comments on commit 2e13446

Please sign in to comment.