def METHOD_NAME(ex):
    messages = {}
    @ex.main
    def main_function(_run):
        for i in range(10):
            val = i * i
            ex.log_scalar("training.loss", val)
        messages["messages"] = ex.current_run._metrics.get_last_metrics()
    ex.run()
    assert ex.current_run is not None
    messages = messages["messages"]
    assert len(messages) == 10
    for i in range(len(messages) - 1):
        assert messages[i].step < messages[i + 1].step
        assert messages[i].step == i
        assert messages[i].timestamp <= messages[i + 1].timestamp