

def create_migration_flow(obj, config, migration):
    '\n    Creates migration flow for object ``obj`` based on configuration ``config``\n    migration ``migration``.\n    :param obj: model.Model instance\n    :param config: configuration\n    :param migration: migration (part of configuration)\n    :return: migration flow for an object\n    '
    if (obj.find_link(migration.destination) is not None):
        return None
    cls = obj.get_class()
    flow_factories = migration.migration_flow_factories
    if (cls not in flow_factories):
        raise RuntimeError('Failed to find migration flow factory')
    else:
        flow = linear_flow.Flow(('top_level_' + taskflow_utils.object_name(obj)), retry=retry.AlwaysRevert())
        factory = flow_factories[cls]()
        migration_tasks = factory.create_flow(config, migration, obj)
        flow.add(*migration_tasks)
        return flow

dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/os/migrate/base.py create_migration_flow/original