Commit 5773c103 authored by Samuel GAIST's avatar Samuel GAIST Committed by André Anjos
Browse files

[utils][commands][scheduler] Change port for address as parameter

The broker might be on another machine.
parent b79bec25
...@@ -82,12 +82,12 @@ class Command(BaseCommand): ...@@ -82,12 +82,12 @@ class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument( parser.add_argument(
"--port", "--broker-address",
"-p", "-b",
type=int, type=str,
dest="port", dest="broker_address",
default=5555, default="tcp://localhost:5555",
help="Port of the broker", help="Address of the broker",
) )
parser.add_argument( parser.add_argument(
"--interval", "--interval",
...@@ -102,8 +102,9 @@ class Command(BaseCommand): ...@@ -102,8 +102,9 @@ class Command(BaseCommand):
signal.signal(signal.SIGTERM, self.__signal_handler) signal.signal(signal.SIGTERM, self.__signal_handler)
signal.signal(signal.SIGINT, self.__signal_handler) signal.signal(signal.SIGINT, self.__signal_handler)
broker_address = "tcp://localhost:{}".format(options["port"]) client = BeatComputationClient(
client = BeatComputationClient(broker_address, options["verbosity"] >= 2) options["broker_address"], options["verbosity"] >= 2
)
# client.timeout = 100 # client.timeout = 100
running_job_splits = [] running_job_splits = []
......
...@@ -63,9 +63,9 @@ def start_worker(worker_name, broker_address, prefix, cache, verbosity=0): ...@@ -63,9 +63,9 @@ def start_worker(worker_name, broker_address, prefix, cache, verbosity=0):
) )
def start_scheduler(port, verbosity=0): def start_scheduler(broker_address, verbosity=0):
db.connections.close_all() db.connections.close_all()
call_command("scheduler", port=port, verbosity=verbosity) call_command("scheduler", broker_address=broker_address, verbosity=verbosity)
class WorkerRegistration(TransactionTestCase): class WorkerRegistration(TransactionTestCase):
...@@ -183,7 +183,7 @@ class TestSchedulerBase(TransactionTestCase, BackendUtilitiesMixin): ...@@ -183,7 +183,7 @@ class TestSchedulerBase(TransactionTestCase, BackendUtilitiesMixin):
verbosity = self.command_verbosity verbosity = self.command_verbosity
self.scheduler = multiprocessing.Process( self.scheduler = multiprocessing.Process(
target=start_scheduler, args=(self.port, verbosity) target=start_scheduler, args=(self.broker_address, verbosity)
) )
self.scheduler.start() self.scheduler.start()
......
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