Skip to content

Commit

Permalink
Merge pull request #468 from mystic-ai/matthew/turbo-registry
Browse files Browse the repository at this point in the history
Turbo Registry Integration
  • Loading branch information
MPCherry committed Jul 17, 2024
2 parents b1431d1 + b096b1c commit 2f8f775
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ pipeline_graph: new_pipeline:my_new_pipeline
pipeline_name: twitter-roberta-base-sentiment
description: null
readme: null
extras: {}
extras: {}
3 changes: 3 additions & 0 deletions pipeline/console/container/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def build_container(namespace: Namespace):

pipeline_config = PipelineConfig.parse_obj(pipeline_config_yaml)

if pipeline_config.extras and pipeline_config.extras.get("turbo_registry", False):
template = docker_templates.turbo_registry_template

if not pipeline_config.runtime:
raise ValueError("No runtime config found")
if not pipeline_config.runtime.python:
Expand Down
6 changes: 5 additions & 1 deletion pipeline/console/container/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ def push_container(namespace: Namespace):

docker_client: docker.DockerClient = docker.from_env(timeout=600)

registry_info = http.get(endpoint="/v4/registry")
registry_params = {}
if pipeline_config.extras and pipeline_config.extras.get("turbo_registry", False):
registry_params["turbo_registry"] = "yes"

registry_info = http.get(endpoint="/v4/registry", params=registry_params)
registry_info = registry_schemas.RegistryInformation.parse_raw(registry_info.text)

upload_registry = registry_info.url
Expand Down
1 change: 1 addition & 0 deletions pipeline/container/docker_templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ def _read_template(template_name: str) -> str:
dockerfile_template = _read_template("dockerfile_template.txt")
pipeline_template_python = _read_template("pipeline_template.py")
readme_template = _read_template("readme_template.md")
turbo_registry_template = _read_template("turbo_registry_template.txt")
32 changes: 32 additions & 0 deletions pipeline/container/docker_templates/turbo_registry_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is automatically generated by pipeline-ai and should not be changed by hand.
FROM python:{python_version}-slim

WORKDIR /app

RUN apt update -y
RUN pip install --no-cache-dir -U pip setuptools wheel

# Install serving packages
RUN pip install --no-cache-dir -U fastapi==0.105.0 uvicorn==0.25.0 \
python-multipart==0.0.6 loguru==0.7.2

# Container commands
{container_commands}

# Install python dependencies
RUN pip install --no-cache-dir {python_requirements}

# Copy in files
COPY ./ ./

FROM scratch
COPY --from=0 / /

WORKDIR /app

ENV PYTHONUNBUFFERED=1
ENV PIPELINE_PATH={pipeline_path}
ENV PIPELINE_NAME={pipeline_name}
ENV PIPELINE_IMAGE={pipeline_image}

CMD ["uvicorn", "pipeline.container.startup:create_app", "--host", "0.0.0.0", "--port", "14300"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pipeline-ai"
version = "2.3.2"
version = "2.4.0"
description = "Pipelines for machine learning workloads."
authors = [
"Paul Hetherington <ph@mystic.ai>",
Expand Down

0 comments on commit 2f8f775

Please sign in to comment.