Beispiel #1
0
def main():
    """
    REPL-environment CLI-Client
    :return:
    """

    print welcome

    while True:
        # read-eval-print-loop
        syntax = read_loop()  # read
        try:
            parseSyntax(syntax)  # eval
        except Exception as e:
            print 'Something went wrong:', e.message
            print 'try it again!'  # print
        else:
            print 'sucessfully read syntax'  # print
            print syntax.strip()
            break
    # prozesse sind erzeugt - process manager ist initialisiert. weiter im text....
    init_process = raw_input("Welcher Prozess soll zuerst laufen? [%s]:"
                             % " oder ".join([p.process.name for p in ProcessManager().jobs]))
    # welcher scheduler soll verwendet werden?
    while True:
        requested_scheduler = raw_input("Welchen Scheduler soll ich verwenden? ")
        q = input("initial process quantum: ")
        ts = input("initial process timeslice: ")
        try:
            scheduler = SchedulerFactory.getScheduler(requested_scheduler, timeslice=ts, quantum=q)
        except Exception as e:
            print 'something went wrong:', e
            print 'try one of these:', SchedulerFactory.getPossibleChoices()
        else:
            scheduler.initialize(init_process)
            scheduler.run()
            print_scheduler_results()
            print_process_results()
            break
 def test_factory_possible_choices(self):
     choices = SchedulerFactory.getPossibleChoices()
     print choices
     self.assertIn('FiFo'.lower(), choices)
Beispiel #3
0
 def get(self):
     possible_scheds = SchedulerFactory.getPossibleChoices()
     options = {"installed scheduler": possible_scheds}
     return jsonify(options)