Skip to content
Snippets Groups Projects
Commit 508d2c27 authored by Ramesh Kumar's avatar Ramesh Kumar
Browse files

Merge branch 'master' into TMSS-471

parents e07aae07 cacef72a
No related branches found
No related tags found
1 merge request!310Resolve TMSS-471
...@@ -521,6 +521,7 @@ def main_test_environment(): ...@@ -521,6 +521,7 @@ def main_test_environment():
group.add_option('-w', '--websockets', dest='websockets', action='store_true', help='Enable json updates pushed via websockets') group.add_option('-w', '--websockets', dest='websockets', action='store_true', help='Enable json updates pushed via websockets')
group.add_option('-f', '--feedbackservice', dest='feedbackservice', action='store_true', help='Enable feedbackservice to handle feedback from observations/pipelines which comes in via the (old qpid) otdb messagebus.') group.add_option('-f', '--feedbackservice', dest='feedbackservice', action='store_true', help='Enable feedbackservice to handle feedback from observations/pipelines which comes in via the (old qpid) otdb messagebus.')
group.add_option('--all', dest='all', action='store_true', help='Enable/Start all the services, upload schemas and testdata') group.add_option('--all', dest='all', action='store_true', help='Enable/Start all the services, upload schemas and testdata')
group.add_option('--simulate', dest='simulate', action='store_true', help='Simulate a run of the first example scheduling_unit (implies --data and --eventmessages and --ra_test_environment)')
group = OptionGroup(parser, 'Messaging options') group = OptionGroup(parser, 'Messaging options')
parser.add_option_group(group) parser.add_option_group(group)
...@@ -529,6 +530,11 @@ def main_test_environment(): ...@@ -529,6 +530,11 @@ def main_test_environment():
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if options.simulate:
options.data = True
options.eventmessages = True
options.ra_test_environment = True
logging.basicConfig(format = '%(asctime)s %(levelname)s %(message)s', level = logging.INFO) logging.basicConfig(format = '%(asctime)s %(levelname)s %(message)s', level = logging.INFO)
with TMSSTestEnvironment(host=options.host, preferred_django_port=options.port, public_host=options.public_host, with TMSSTestEnvironment(host=options.host, preferred_django_port=options.port, public_host=options.public_host,
...@@ -567,6 +573,15 @@ def main_test_environment(): ...@@ -567,6 +573,15 @@ def main_test_environment():
print() print()
print("Press Ctrl-C to exit (and remove the test database and django server automatically)") print("Press Ctrl-C to exit (and remove the test database and django server automatically)")
if options.simulate:
stop_event = threading.Event()
with create_scheduling_unit_blueprint_simulator(1, stop_event=stop_event,
exchange=options.exchange, broker=options.broker):
try:
stop_event.wait()
except KeyboardInterrupt:
return
waitForInterrupt() waitForInterrupt()
...@@ -631,6 +646,8 @@ def create_scheduling_unit_blueprint_simulator(scheduling_unit_blueprint_id: int ...@@ -631,6 +646,8 @@ def create_scheduling_unit_blueprint_simulator(scheduling_unit_blueprint_id: int
if isProductionEnvironment(): if isProductionEnvironment():
raise RuntimeError("Do not use this tool to simulate running a scheduling_unit in a production environment!") raise RuntimeError("Do not use this tool to simulate running a scheduling_unit in a production environment!")
logger.info("starting to simulate a run for scheduling_unit id=%s ...", self.scheduling_unit_blueprint_id)
super().start_handling() super().start_handling()
try: try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment