Verified Commit b9f7c3d6 authored by Raphaël Bleuse's avatar Raphaël Bleuse
Browse files

Remove alternate launcher function

parent ff701e59
......@@ -53,36 +53,3 @@ def launch_scheduler(scheduler,
# print("Aborted...")
# return 1
return 0
def launch_scheduler_main(
scheduler_class,
argv=None,
standalone=True,
**kwargs):
for arg in argv or sys.argv[1:]:
if arg == "--verbose":
kwargs["verbose"] = 999
elif arg.startswith("--options="):
kwargs["options"] = json.loads(arg[arg.index("=") + 1:])
elif arg.startswith("--options-file="):
with open(arg) as options_file:
kwargs["options"] = json.load(options_file)
elif arg.startswith("--timeout="):
kwargs["timeout"] = int(arg[arg.index("=") + 1:])
elif arg.startswith("--socket-endpoint="):
kwargs["socket_endpoint"] = int(arg[arg.index("=") + 1:])
elif arg.startswith("--event-socket-endpoint="):
kwargs["event_socket_endpoint"] = int(arg[arg.index("=") + 1:])
else:
print("Invalid argument: {}".format(arg))
scheduler = scheduler_class(options)
ret = launch_scheduler(scheduler, **kwargs)
if standalone:
sys.exit(ret)
else:
if ret != 0:
raise ValueError(
"Scheduler exited with return code: {}".format(ret))
......@@ -10,7 +10,6 @@
from abc import ABCMeta, abstractmethod
from pybatsim.batsim.batsim import BatsimScheduler, Batsim
from pybatsim.batsim.tools.launcher import launch_scheduler_main
from .resource import Resources, ComputeResource
from .job import Job, Jobs
......@@ -217,11 +216,6 @@ class Scheduler(metaclass=ABCMeta):
"""
@classmethod
def launch_main(cls, **kwargs):
"""Initialise this scheduler class and run it as if it were started with the launcher."""
launch_scheduler_main(cls, **kwargs)
def __init__(self, options={}):
self._options = options
debug = self.options.get("debug", False)
......
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