Commit 49ce9738 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[scripts][execute] Make loop address an option

This makes its usage more clear and explicit.

It also fixes an issue where the loop paradigm can only be
used with a block having a database as input.

This change requires update in beat/beat.core> executors
calling these scripts.
parent 6b8a780b
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
"""Executes a single algorithm. (%(version)s) """Executes a single algorithm. (%(version)s)
usage: usage:
%(prog)s [--debug] [--cache=<path>] <addr> <dir> [<db_addr>] [<loop_addr>] %(prog)s [--debug] [--cache=<path>] [--loop=<loop_addr>] <addr> <dir> [<db_addr>]
%(prog)s (--help) %(prog)s (--help)
%(prog)s (--version) %(prog)s (--version)
...@@ -47,14 +47,13 @@ arguments: ...@@ -47,14 +47,13 @@ arguments:
<dir> Directory containing all configuration required to run the user <dir> Directory containing all configuration required to run the user
algorithm algorithm
<db_addr> Address for databases-related I/O requests <db_addr> Address for databases-related I/O requests
<loop_addr> Address for loop-related I/O requests
options: options:
-h, --help Shows this help message and exit -h, --help Shows this help message and exit
-V, --version Shows program's version number and exit -V, --version Shows program's version number and exit
-d, --debug Runs executor in debugging mode -d, --debug Runs executor in debugging mode
-c, --cache=<path> Cache prefix, otherwise defaults to '/cache' -c, --cache=<path> Cache prefix, otherwise defaults to '/cache'
--loop=loop_addr Address for loop-related I/O requests
""" """
...@@ -187,10 +186,11 @@ def main(): ...@@ -187,10 +186,11 @@ def main():
logger.debug("zmq client connected to db `%s'", args["<db_addr>"]) logger.debug("zmq client connected to db `%s'", args["<db_addr>"])
loop_socket = None loop_socket = None
if args["<loop_addr>"]: loop_addr = args.get("--loop")
if loop_addr:
loop_socket = context.socket(zmq.PAIR) loop_socket = context.socket(zmq.PAIR)
loop_socket.connect(args["<loop_addr>"]) loop_socket.connect(loop_addr)
logger.debug("zmq client connected to loop `%s'", args["<loop_addr>"]) logger.debug("zmq client connected to loop `%s'", loop_addr)
# Check the dir # Check the dir
if not os.path.exists(args["<dir>"]): if not os.path.exists(args["<dir>"]):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment