Пример #1
0
 def migrate(self, scenario=None):
     namespace_scheduler = namespace.Namespace({
         '__init_task__': self.init,
         'info_result': {
             utl.INSTANCES_TYPE: {}
         }
     })
     # "process_migration" is dict with 3 keys:
     #    "preparation" - is cursor that points to tasks must be processed
     #                    before migration i.e - taking snapshots,
     #                    figuring out all services are up
     #    "migration" - is cursor that points to the first
     #                  task in migration process
     #    "rollback" - is cursor that points to tasks must be processed
     #                 in case of "migration" failure
     if not scenario:
         process_migration = {
             "migration": cursor.Cursor(self.process_migrate())}
     else:
         scenario.init_tasks(self.init)
         scenario.load_scenario()
         process_migration = {k: cursor.Cursor(v)
                              for k, v in scenario.get_net().items()}
     scheduler_migr = scheduler.Scheduler(namespace=namespace_scheduler,
                                          **process_migration)
     scheduler_migr.start()
Пример #2
0
 def test_iterating_first_case_cursor(self):
     cur = cursor.Cursor(self.elements[0])
     expected_result = [
         self.elements[0], self.elements[1], self.elements[4],
         self.elements[6], self.elements[5]
     ]
     expected_result.reverse()
     for c in cur:
         self.assertEqual(expected_result.pop(), c)
Пример #3
0
    def migrate(self):
        namespace_scheduler = namespace.Namespace({
            '__init_task__': self.init,
            'info_result': {
                utl.INSTANCES_TYPE: {}
            }
        })

        task_resources_transporting = self.transport_resources()
        transport_instances_and_dependency_resources = self.migrate_instances()

        process_migration = task_resources_transporting >> transport_instances_and_dependency_resources

        process_migration = cursor.Cursor(process_migration)
        scheduler_migr = scheduler.Scheduler(namespace=namespace_scheduler,
                                             cursor=process_migration)
        scheduler_migr.start()
Пример #4
0
 def migrate(self, scenario=None):
     namespace_scheduler = namespace.Namespace({
         '__init_task__': self.init,
         'info_result': {
             utl.INSTANCES_TYPE: {}
         }
     })
     if not scenario:
         process_migration = self.process_migrate()
     else:
         scenario.init_tasks(self.init)
         scenario.load_scenario()
         process_migration = scenario.get_net()
     process_migration = cursor.Cursor(process_migration)
     scheduler_migr = scheduler.Scheduler(namespace=namespace_scheduler,
                                          cursor=process_migration)
     scheduler_migr.start()
Пример #5
0
def process_chain(cloud, iteration):
    chain = evacuate_vms.Evacuate(iteration=iteration,
                                  cloud='src_cloud',
                                  init=cloud.init)
    scheduler.Scheduler(migration=cursor.Cursor(chain)).start()
Пример #6
0
def process_test_chain():
    chain = (AddNumbers(1, 2) >> DivideNumbers(4, 3) >>
             MultiplyNumbers(4, 2) >> DivisionByZero())
    scheduler.Scheduler(migration=cursor.Cursor(chain)).start()
Пример #7
0
 def test_cursor(self):
     cur = cursor.Cursor(self.elements[5])
     self.assertEqual(cur.current(), self.elements[0])