示例#1
0
def get_unique_base_execution():
    """Setup unique execution for a single function and yield its QueryCompiler that's suitable for inplace modifications."""
    # It's better to use decimal IDs rather than hex ones due to factory names formatting
    execution_id = int(uuid.uuid4().hex, 16)
    format_name = f"Base{execution_id}"
    engine_name = "Python"
    execution_name = f"{format_name}On{engine_name}"

    # Dynamically building all the required classes to form a new execution
    base_qc = type(format_name, (TestQC, ), {})
    base_io = type(f"{execution_name}IO", (BaseOnPythonIO, ),
                   {"query_compiler_cls": base_qc})
    base_factory = type(
        f"{execution_name}Factory",
        (BaseOnPythonFactory, ),
        {"prepare": classmethod(lambda cls: setattr(cls, "io_cls", base_io))},
    )

    # Setting up the new execution
    setattr(factories, f"{execution_name}Factory", base_factory)
    old_engine, old_format = modin.set_execution(engine=engine_name,
                                                 storage_format=format_name)
    yield base_qc

    # Teardown the new execution
    modin.set_execution(engine=old_engine, storage_format=old_format)
    try:
        delattr(factories, f"{execution_name}Factory")
    except AttributeError:
        pass
示例#2
0
            def init_remote_ray(partition):
                from ray import ray_constants
                import modin
                from modin.core.execution.ray.common import initialize_ray

                modin.set_execution("Ray", partition)
                initialize_ray(
                    override_is_cluster=True,
                    override_redis_address=f"localhost:{ray_constants.DEFAULT_PORT}",
                    override_redis_password=ray_constants.REDIS_DEFAULT_PASSWORD,
                )
示例#3
0
def pytest_configure(config):
    if config.option.extra_test_parameters is not None:
        import modin.pandas.test.utils as utils

        utils.extra_test_parameters = config.option.extra_test_parameters

    execution = config.option.execution

    if execution is None:
        return

    if execution == BASE_EXECUTION_NAME:
        set_base_execution(BASE_EXECUTION_NAME)
        config.addinivalue_line(
            "filterwarnings", "default:.*defaulting to pandas.*:UserWarning")
    else:
        partition, engine = execution.split("On")
        modin.set_execution(engine=engine, storage_format=partition)
示例#4
0
def test_set_execution():
    set_execution("Bar", "Foo")
    assert FactoryDispatcher.get_factory() == FooOnBarFactory
示例#5
0
def set_base_execution(name=BASE_EXECUTION_NAME):
    setattr(factories, f"{name}Factory", BaseOnPythonFactory)
    modin.set_execution(engine="python", storage_format=name.split("On")[0])
示例#6
0
文件: cluster.py 项目: prutskov/modin
 def __exit__(self, *a, **kw):
     set_execution(*self.old_execution)
     self.connection.deactivate()
     self.old_execution = None
示例#7
0
文件: cluster.py 项目: prutskov/modin
 def __enter__(self):
     self.spawn(wait=True)  # make sure cluster is ready
     self.connection.activate()
     self.old_execution = set_execution(self.target_engine,
                                        self.target_storage_format)
     return self