def main(args): instance = None with open(args.instance, "r") as instance_file: instance = Instance.from_file(instance_file) if args.instance: plot_instance(instance) elif args.scheduling: plot_scheduling(instance, args.scheduling)
def main(opts): """ Main. """ try: scheduled = schedulers[opts.algorithm](Instance.from_file(opts.input)) opts.input.close() print_schedule(scheduled) if opts.plot: plot_schedule(scheduled) except Exception as e: sys.stderr.write(f"Error: {e}") opts.input.close() raise finally: opts.input.close()