Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
def compose(*funcs): | |
"""Functional composition | |
[f, g, h] will be f(g(h(x))) | |
""" | |
def compose_two(f, g): | |
def c(x): | |
return f(g(x)) | |
return c | |
return functools.reduce(compose_two, funcs) |
# Common core utils are too small that don't warrant creating a package | |
from argparse import ArgumentParser, Namespace, ArgumentDefaultsHelpFormatter | |
import csv | |
import functools | |
import logging | |
import sys | |
from typing import Callable as F | |
from typing import List, TypeVar, Type, Iterator | |
from pydantic import BaseModel |