Example #1
0
def test_healthy():

    with instance_for_test(
            overrides={
                "run_coordinator": {
                    "module":
                    "dagster.core.run_coordinator.queued_run_coordinator",
                    "class": "QueuedRunCoordinator",
                },
            }) as instance:
        init_time = pendulum.now("UTC")
        beyond_tolerated_time = init_time + datetime.timedelta(seconds=60)

        controller = DagsterDaemonController(instance)
        assert not controller.daemon_healthy(instance, curr_time=init_time)

        controller.run_iteration(init_time)
        assert controller.daemon_healthy(instance, curr_time=init_time)

        assert not controller.daemon_healthy(instance,
                                             curr_time=beyond_tolerated_time)
Example #2
0
def test_healthy_with_different_daemons():
    with instance_for_test() as instance:
        init_time = pendulum.now("UTC")
        controller = DagsterDaemonController(instance)
        controller.run_iteration(init_time)

    with instance_for_test(
            overrides={
                "run_coordinator": {
                    "module":
                    "dagster.core.run_coordinator.queued_run_coordinator",
                    "class": "QueuedRunCoordinator",
                },
            }) as instance:
        assert not DagsterDaemonController.daemon_healthy(instance,
                                                          curr_time=init_time)