def standard_return(): return repositoryFactory(repositoryType = repositoryType, root_dir = root_dir, **kwargs)
old_path = os.path.join(local_root, old_root_dir) new_path = os.path.join(local_root, root_dir) rep_type = dirs[-1] #jobs or templates if not os.path.isdir(old_path): logger.debug('No old repository found') _all_new_reps[new_path] = False return standard_return() else: _all_new_reps[new_path] = True if os.path.isdir(new_path): logger.debug('New repository has already been created') return standard_return() else: msg ='One of previous versions of repository is found; %s will be migrated to the new repository' % rep_type logger.warning(msg) new_repository = repositoryFactory(repositoryType = repositoryType, root_dir = root_dir, **kwargs) kwargs['schema'] = old_schema[:] kwargs['init_schema'] = False old_repository = repositoryFactory(repositoryType = repositoryType, root_dir = old_root_dir, **kwargs) ids = old_repository.getJobIds({}) nn = 0 while ids: ids_m = ids[:_migrate_at_once] ids = ids[_migrate_at_once:] try: jobs = checkoutJobs(old_repository, ids_m) except Exception, e: msg = ("Error while getting %s from the old repository: " % rep_type) + str(e) logger.error(msg) else: