예제 #1
0
    def test_get_local_schedulers(self):
        schedulers = get_schedulers(session_name="test_session")
        self.assertTrue(isinstance(schedulers["local"], LocalScheduler))
        self.assertTrue(isinstance(schedulers["default"], LocalScheduler))

        self.assertEquals("test_session", schedulers["local"].session_name)
        self.assertEquals("test_session", schedulers["default"].session_name)
예제 #2
0
def session(name: Optional[str] = None, backend: str = "standalone", **scheduler_args):
    if backend != "standalone":
        raise ValueError(
            f"Unsupported session backend: {backend}. Supported values: standalone"
        )

    if not name:
        name = _gen_session_name(backend)

    scheduler_args["session_name"] = name
    return StandaloneSession(name=name, schedulers=get_schedulers(**scheduler_args))