from parallels.core.registry import Registry
from parallels.core import migrator_config
from parallels.core.workflow.runner.by_subscription import ActionRunnerBySubscription


def create_action_runner():
    """Create runner according current configuration
    """
    config = Registry.get_instance().get_context().config

    multithreading = None
    actions_to_skip = None

    if config is not None:
        multithreading = migrator_config.read_multithreading_params(config)
        actions_to_skip = migrator_config.read_actions_to_skip(config)

    return ActionRunnerBySubscription(multithreading, actions_to_skip)
