File size: 706 Bytes
bfc1297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Precompute the Theme Lab default Markov backend for Docker deployments."""

from __future__ import annotations

import time

from apps.theme_lab.app import DEFAULT_MARKOV_CACHE, default_markov_request, write_precomputed_markov_backend


def main() -> None:
    request = default_markov_request()
    start = time.perf_counter()
    path = write_precomputed_markov_backend()
    elapsed = time.perf_counter() - start
    size_mb = path.stat().st_size / 1024 / 1024
    print(
        "Precomputed Theme Lab Markov cache "
        f"order={request.max_order} length={request.length} "
        f"at {DEFAULT_MARKOV_CACHE} in {elapsed:.2f}s ({size_mb:.1f} MB)"
    )


if __name__ == "__main__":
    main()