コード例 #1
0
ファイル: test_instigation.py プロジェクト: prezi/dagster
    def test_sensor_next_tick(self, graphql_context):
        repository_selector = infer_repository_selector(graphql_context)
        external_repository = graphql_context.get_repository_location(
            repository_selector["repositoryLocationName"]).get_repository(
                repository_selector["repositoryName"])
        graphql_context.instance.reconcile_scheduler_state(external_repository)

        sensor_name = "always_no_config_sensor"
        external_sensor = external_repository.get_external_sensor(sensor_name)
        selector = infer_instigation_selector(graphql_context, sensor_name)

        # need to be running and create a sensor tick in the last 30 seconds in order to generate a
        # future tick
        graphql_context.instance.start_sensor(external_sensor)
        _create_sensor_tick(graphql_context.instance)

        result = execute_dagster_graphql(
            graphql_context,
            INSTIGATION_QUERY,
            variables={"instigationSelector": selector})

        assert result.data
        assert result.data["instigationStateOrError"][
            "__typename"] == "InstigationState"
        next_tick = result.data["instigationStateOrError"]["nextTick"]
        assert next_tick
コード例 #2
0
ファイル: test_instigation.py プロジェクト: prezi/dagster
    def test_schedule_next_tick(self, graphql_context):
        repository_selector = infer_repository_selector(graphql_context)
        external_repository = graphql_context.get_repository_location(
            repository_selector["repositoryLocationName"]).get_repository(
                repository_selector["repositoryName"])
        graphql_context.instance.reconcile_scheduler_state(external_repository)

        schedule_name = "no_config_pipeline_hourly_schedule"
        external_schedule = external_repository.get_external_schedule(
            schedule_name)
        selector = infer_instigation_selector(graphql_context, schedule_name)

        # need to be running in order to generate a future tick
        graphql_context.instance.start_schedule_and_update_storage_state(
            external_schedule)
        result = execute_dagster_graphql(
            graphql_context,
            INSTIGATION_QUERY,
            variables={"instigationSelector": selector})

        assert result.data
        assert result.data["instigationStateOrError"][
            "__typename"] == "InstigationState"
        next_tick = result.data["instigationStateOrError"]["nextTick"]
        assert next_tick