예제 #1
0
def setup_json_file_logger(tf_name, name="foo", level=logging.DEBUG):
    logger_def = define_json_file_logger(name, tf_name, level)
    init_logger_context = InitLoggerContext(
        {},
        logger_def,
        pipeline_def=PipelineDefinition([], "test"),
        run_id="",
    )

    return logger_def.logger_fn(init_logger_context)
예제 #2
0
def test_write_dagster_meta():
    with get_temp_file_name() as tf_name:
        execution_context = create_test_pipeline_execution_context(
            logger_defs={'json': define_json_file_logger('foo', tf_name, logging.DEBUG)}
        )
        execution_context.log.debug('some_debug_message', context_key='context_value')
        data = list(parse_json_lines(tf_name))
        assert len(data) == 1
        assert data[0]['name'] == 'foo'
        assert data[0]['orig_message'] == 'some_debug_message'
        assert data[0]['context_key'] == 'context_value'
예제 #3
0
def test_write_dagster_meta():
    with get_temp_file_name() as tf_name:
        execution_context = create_test_pipeline_execution_context(
            logger_defs={
                "json": define_json_file_logger("foo", tf_name, logging.DEBUG)
            })
        execution_context.log.debug("some_debug_message",
                                    context_key="context_value")
        data = list(parse_json_lines(tf_name))
        assert len(data) == 1
        assert data[0]["name"] == "foo"
        assert data[0]["orig_message"] == "some_debug_message"
        assert data[0]["context_key"] == "context_value"
예제 #4
0
def setup_json_file_logger(tf_name, name='foo', level=logging.DEBUG):
    logger_def = define_json_file_logger(name, tf_name, level)
    init_logger_context = InitLoggerContext({}, PipelineDefinition([]),
                                            logger_def, '')

    return logger_def.logger_fn(init_logger_context)