-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add numalogic udf module - preproc, inference, postproc and trainer udfs - config updates and factory classes - dockerfile - image release github action --------- Signed-off-by: Avik Basu <[email protected]> Co-authored-by: Kushal Batra <[email protected]>
- Loading branch information
Showing
55 changed files
with
17,724 additions
and
666 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
tests | ||
.github | ||
.gitignore | ||
.hack | ||
.ruff_cache | ||
docs | ||
examples | ||
.coveragerc | ||
.pre-commit-config.yaml | ||
CHANGELOG.md | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
mkdocs.yml | ||
README.md | ||
USERS.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Docker Image Push | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Docker Login | ||
uses: docker/[email protected] | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAYIO_USERNAME }} | ||
password: ${{ secrets.QUAYIO_PASSWORD }} | ||
|
||
- name: Docker Build | ||
env: | ||
QUAYIO_ORG: quay.io/numaio | ||
PLATFORM: linux/x86_64 | ||
TARGET: numalogic/udf | ||
run: | | ||
type=$(basename $(dirname $GITHUB_REF)) | ||
tag=$(basename $GITHUB_REF) | ||
if [[ $type == "heads" ]]; then | ||
tag="$(basename $GITHUB_REF)v${{ env.version }}" | ||
fi | ||
image_name="${QUAYIO_ORG}/numalogic/udf:${tag}" | ||
docker buildx build \ | ||
--output "type=image,push=true" \ | ||
--platform="${PLATFORM}" \ | ||
--build-arg INSTALL_EXTRAS='redis druid' | ||
--tag $image_name . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#################################################################################################### | ||
# builder: install needed dependencies | ||
#################################################################################################### | ||
|
||
ARG PYTHON_VERSION=3.11 | ||
ARG POETRY_VERSION=1.6 | ||
FROM python:${PYTHON_VERSION}-slim-bookworm AS builder | ||
|
||
ENV PYTHONFAULTHANDLER=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONHASHSEED=random \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
POETRY_VERSION=${POETRY_VERSION} \ | ||
POETRY_HOME="/opt/poetry" \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
POETRY_NO_INTERACTION=1 \ | ||
PYSETUP_PATH="/opt/pysetup" \ | ||
VENV_PATH="/opt/pysetup/.venv" | ||
|
||
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
curl \ | ||
build-essential \ | ||
dumb-init \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* \ | ||
&& pip install --no-cache --upgrade pip \ | ||
&& curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
#################################################################################################### | ||
# udf: used for running the udf vertices | ||
#################################################################################################### | ||
FROM builder AS udf | ||
|
||
ARG INSTALL_EXTRAS | ||
|
||
WORKDIR $PYSETUP_PATH | ||
COPY ./pyproject.toml ./poetry.lock ./ | ||
|
||
# TODO install cpu/gpu based on args/arch | ||
RUN poetry install --without dev --no-cache --no-root -E numaflow --extras "${INSTALL_EXTRAS}" && \ | ||
poetry run pip install --no-cache "torch>=2.0,<3.0" --index-url https://download.pytorch.org/whl/cpu && \ | ||
poetry run pip install --no-cache "pytorch-lightning>=2.0<3.0" && \ | ||
rm -rf ~/.cache/pypoetry/ | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||
|
||
EXPOSE 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[loggers] | ||
keys=root, pllogger | ||
|
||
[handlers] | ||
keys=consoleHandler | ||
|
||
[formatters] | ||
keys=consoleFormatter | ||
|
||
[logger_root] | ||
level=INFO | ||
handlers=consoleHandler | ||
|
||
[logger_pllogger] | ||
level=ERROR | ||
handlers=consoleHandler | ||
qualname=pytorch_lightning | ||
propagate=0 | ||
|
||
[handler_consoleHandler] | ||
class=StreamHandler | ||
level=DEBUG | ||
formatter=consoleFormatter | ||
|
||
[formatter_consoleFormatter] | ||
format=%(asctime)s - %(thread)d - %(levelname)s - %(message)s | ||
class=logging.Formatter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from numalogic.connectors._config import ( | ||
RedisConf, | ||
PrometheusConf, | ||
ConnectorConf, | ||
DruidConf, | ||
DruidFetcherConf, | ||
ConnectorType, | ||
) | ||
|
||
__all__ = [ | ||
"RedisConf", | ||
"PrometheusConf", | ||
"ConnectorConf", | ||
"DruidConf", | ||
"DruidFetcherConf", | ||
"ConnectorType", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from dataclasses import dataclass, field | ||
from enum import IntEnum | ||
|
||
from omegaconf import MISSING | ||
|
||
|
||
class ConnectorType(IntEnum): | ||
redis = 0 | ||
prometheus = 1 | ||
druid = 2 | ||
|
||
|
||
@dataclass | ||
class ConnectorConf: | ||
url: str | ||
|
||
|
||
@dataclass | ||
class PrometheusConf(ConnectorConf): | ||
pushgateway: str | ||
scrape_interval: int = 30 | ||
|
||
|
||
@dataclass | ||
class RedisConf(ConnectorConf): | ||
port: int | ||
expiry: int = 300 | ||
master_name: str = "mymaster" | ||
|
||
|
||
@dataclass | ||
class Pivot: | ||
index: str = "timestamp" | ||
columns: list[str] = field(default_factory=list) | ||
value: list[str] = field(default_factory=lambda: ["count"]) | ||
|
||
|
||
@dataclass | ||
class DruidFetcherConf: | ||
datasource: str | ||
dimensions: list[str] = field(default_factory=list) | ||
aggregations: dict = field(default_factory=dict) | ||
group_by: list[str] = field(default_factory=list) | ||
pivot: Pivot = field(default_factory=lambda: Pivot()) | ||
granularity: str = "minute" | ||
|
||
def __post_init__(self): | ||
from pydruid.utils.aggregators import doublesum | ||
|
||
if not self.aggregations: | ||
self.aggregations = {"count": doublesum("count")} | ||
|
||
|
||
@dataclass | ||
class DruidConf(ConnectorConf): | ||
endpoint: str | ||
fetcher: DruidFetcherConf = MISSING |
Oops, something went wrong.