1
0
mirror of https://github.com/gsi-upm/soil synced 2024-11-14 15:32:29 +00:00
soil/run.py

24 lines
978 B
Python
Raw Normal View History

2018-02-05 11:47:56 +00:00
import argparse
2017-12-15 16:59:50 +00:00
from server import ModularServer
2018-04-16 08:55:27 +00:00
from simulator import Simulator
2017-12-15 16:59:50 +00:00
2018-04-16 08:55:27 +00:00
def run(simulator, name="SOIL", port=8001, verbose=False):
server = ModularServer(simulator, name=(name[0] if isinstance(name, list) else name), verbose=verbose)
server.port = port
2017-12-15 16:59:50 +00:00
server.launch()
if __name__ == "__main__":
2018-02-05 11:47:56 +00:00
parser = argparse.ArgumentParser(description='Visualization of a Graph Model')
2018-04-11 17:40:59 +00:00
parser.add_argument('--name', '-n', nargs=1, default='SOIL', help='name of the simulation')
2018-02-05 11:47:56 +00:00
parser.add_argument('--dump', '-d', help='dumping results in folder output', action='store_true')
2018-04-16 08:55:27 +00:00
parser.add_argument('--port', '-p', nargs=1, default=8001, help='port for launching the server')
2018-02-05 11:47:56 +00:00
parser.add_argument('--verbose', '-v', help='verbose mode', action='store_true')
args = parser.parse_args()
2018-04-16 08:55:27 +00:00
soil = Simulator(dump=args.dump)
run(soil, name=args.name, port=(args.port[0] if isinstance(args.port, list) else args.port), verbose=args.verbose)