Skip to content

Commit

Permalink
Added ml-metadata-store rockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
TakoB222 committed Sep 19, 2024
1 parent f405549 commit 3ef3ffa
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
58 changes: 58 additions & 0 deletions ml-metadata-server/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Based on: https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/distributions/otelcol/Dockerfile
name: ml-metadata-server
summary: Part of the ML Metadata (MLMD) framework.
description: |
ML Metadata is a framework for managing and tracking metadata associated with ML workflows.
It is part of the TensorFlow Extended (TFX) ecosystem, but it can be used independently as well.
version: "1.14.0"
license: Apache-2.0
base: ubuntu@22.04
run-user: _daemon_

platforms:
amd64:

parts:
server:
plugin: nil
source: https://github.com/google/ml-metadata.git
source-tag: v1.14.0
build-packages:
- build-essential
- git
- clang
- cmake
- make
- ca-certificates
- musl-dev
- openssl
- curl
- unzip
- software-properties-common
- python3-distutils
- python-is-python3
- python3-dev
build-environment:
- CGO_ENABLED: 0
- GOOS: linux
- BAZEL_VERSION: 5.3.0
override-build: |
# Set up Bazel 5.3.0
mkdir /bazel && cd /bazel
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \
chmod +x bazel-*.sh && ./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh && \
cd $CRAFT_PART_BUILD && rm -f /bazel/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
#Build
bazel build -c opt --action_env=PATH \
--define=grpc_no_ares=true --verbose_failures \
//ml_metadata/metadata_store:metadata_store_server --cxxopt="-std=c++17"
security-team-requirement:
plugin: nil
override-build: |
mkdir -p ${CRAFT_PART_INSTALL}/usr/share/rocks
(echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && \
dpkg-query --root=${CRAFT_PROJECT_DIR}/../bundles/ubuntu-22.04/rootfs/ -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) \
> ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query
Empty file.
51 changes: 51 additions & 0 deletions ml-metadata-server/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
[tox]
skipsdist = True
skip_missing_interpreters = True
envlist = pack, export-to-docker, sanity, integration

[testenv]
setenv =
PYTHONPATH={toxinidir}
PYTHONBREAKPOINT=ipdb.set_trace

[testenv:pack]
passenv = *
allowlist_externals =
rockcraft
commands =
rockcraft pack

[testenv:export-to-docker]
passenv = *
allowlist_externals =
bash
skopeo
yq
commands =
# export rock to docker
bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \
VERSION=$(yq eval .version rockcraft.yaml) && \
ARCH=$(yq eval ".platforms | keys | .[0]" rockcraft.yaml) && \
ROCK="$\{NAME\}_$\{VERSION\}_$\{ARCH\}.rock" && \
DOCKER_IMAGE=$NAME:$VERSION && \
echo "Exporting $ROCK to docker as $DOCKER_IMAGE" && \
skopeo --insecure-policy copy oci-archive:$ROCK docker-daemon:$DOCKER_IMAGE'

[testenv:sanity]
passenv = *
deps =
pytest
charmed-kubeflow-chisme
commands =
# run rock tests
pytest -s -v --tb native --show-capture=all --log-cli-level=INFO {posargs} {toxinidir}/tests

[testenv:integration]
passenv = *
allowlist_externals =
echo
commands =
# TODO: Implement integration tests here
echo "WARNING: This is a placeholder test - no test is implemented here."

0 comments on commit 3ef3ffa

Please sign in to comment.