Skip to content

Commit

Permalink
feat: Add kfp-metadata-writer charm (#350)
Browse files Browse the repository at this point in the history
* feat: Introduce charm for KFP V2 metadata-writer component 
* gitignore: Add venv folder
* ci: Integrate kfp-metadata-reviewer charm
* tests(bundle-integration): Reduce idle_period to 30 from 120 to 
avoid huge amount of waiting and tests failing
  • Loading branch information
orfeas-k authored and DnPlas committed Nov 20, 2023
1 parent 340ee83 commit 3b2bf14
Show file tree
Hide file tree
Showing 24 changed files with 1,008 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
matrix:
charm:
- kfp-api
- kfp-metadata-writer
- kfp-persistence
- kfp-profile-controller
- kfp-schedwf
Expand All @@ -33,6 +34,7 @@ jobs:
matrix:
charm:
- kfp-api
- kfp-metadata-writer
- kfp-persistence
- kfp-profile-controller
- kfp-schedwf
Expand All @@ -52,6 +54,7 @@ jobs:
matrix:
charm:
- kfp-api
- kfp-metadata-writer
- kfp-persistence
- kfp-profile-controller
- kfp-schedwf
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __pycache__/
.coverage
.idea
.vscode
venv
65 changes: 65 additions & 0 deletions charms/kfp-metadata-writer/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Contributing

## Overview

This document outlines the processes and practices recommended for contributing enhancements to `kfp-metadata-writer`.

## Talk to us First

Before developing enhancements to this charm, you should [open an issue](/../../issues) explaining your use case. If you would like to chat with us about your use-cases or proposed implementation, you can reach us at [MLOps Mattermost public channel](https://chat.charmhub.io/charmhub/channels/mlops-documentation) or on [Discourse](https://discourse.charmhub.io/).

## Pull Requests

Please help us out in ensuring easy to review branches by rebasing your pull request branch onto the `main` branch. This also avoids merge commits and creates a linear Git commit history.

All pull requests require review before being merged. Code review typically examines:
- code quality
- test coverage
- user experience for Juju administrators of this charm.

## Recommended Knowledge

Familiarising yourself with the [Charmed Operator Framework](https://juju.is/docs/sdk) library will help you a lot when working on new features or bug fixes.

## Build Charm

To build `kfp-metadata-writer` run:

```shell
charmcraft pack
```

## Developing

You can use the environments created by `tox` for development. For example, to load the `unit` environment into your shell, run:

```shell
tox --notest -e unit
source .tox/unit/bin/activate
```

### Testing

Use tox for testing. For example to test the `integration` environment, run:

```shell
tox -e integration
```

See `tox.ini` for all available environments.

### Deploy

```bash
# Create a model
juju add-model dev
# Enable DEBUG logging
juju model-config logging-config="<root>=INFO;unit=DEBUG"
# Deploy the charm
juju deploy ./kfp-metadata-writer_ubuntu-20.04-amd64.charm \
--resource oci-image=$(yq '.resources."oci-image"."upstream-source"' metadata.yaml)
```

## Canonical Contributor Agreement

Canonical welcomes contributions to this charm. Please check out our [contributor agreement](https://ubuntu.com/legal/contributors) if you're interested in contributing.
13 changes: 13 additions & 0 deletions charms/kfp-metadata-writer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Kubeflow Pipelines Metadata Writer Operator

### Overview
This charm encompasses the Kubernetes Python operator for Kubeflow Pipelines
Metadata Writer (see [CharmHub](https://charmhub.io/?q=kfp-metadata-writer)).

## Install

To install Kubeflow Pipelines Metadata Writer, run:

juju deploy kfp-metadata-writer --trust

For more information, see https://juju.is/docs
13 changes: 13 additions & 0 deletions charms/kfp-metadata-writer/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Learn more about charmcraft.yaml configuration at:
# https://juju.is/docs/sdk/charmcraft-config
type: "charm"
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
run-on:
- name: "ubuntu"
channel: "20.04"
parts:
charm:
charm-python-packages: [setuptools, pip] # Fixes install of some packages
1 change: 1 addition & 0 deletions charms/kfp-metadata-writer/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
options: {}
90 changes: 90 additions & 0 deletions charms/kfp-metadata-writer/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions charms/kfp-metadata-writer/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: kfp-metadata-writer
summary: Reusable end-to-end ML workflows built using the Kubeflow Pipelines SDK
description: |
Machine learning (ML) toolkit that is dedicated to making deployments
of ML workflows on Kubernetes simple, portable, and scalable.
docs: https://discourse.charmhub.io/t/12108
website: https://charmhub.io/kfp-metadata-writer
source: https://github.com/canonical/kfp-operators
containers:
kfp-metadata-writer:
resource: oci-image
resources:
oci-image:
type: oci-image
description: OCI image for KFP Metadata Writer
upstream-source: gcr.io/ml-pipeline/metadata-writer:2.0.2
requires:
grpc:
interface: grpc
schema:
v1:
provides:
type: object
properties:
service:
type: string
port:
type: string
required:
- service
- port
versions: [v1]
__schema_source: https://raw.githubusercontent.com/canonical/operator-schemas/master/grpc.yaml
40 changes: 40 additions & 0 deletions charms/kfp-metadata-writer/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

# Testing tools configuration
[tool.coverage.run]
branch = true

[tool.coverage.report]
show_missing = true

[tool.pytest.ini_options]
minversion = "6.0"
log_cli_level = "INFO"

# Formatting tools configuration
[tool.black]
line-length = 99
target-version = ["py38"]

[tool.isort]
line_length = 99
profile = "black"

# Linting tools configuration
[tool.flake8]
max-line-length = 99
max-doc-length = 99
max-complexity = 10
exclude = [".git", "__pycache__", ".tox", "build", "dist", "*.egg_info", "venv"]
select = ["E", "W", "F", "C", "N", "R", "D", "H"]
# Ignore W503, E501 because using black creates errors with this
# Ignore D107 Missing docstring in __init__
ignore = ["W503", "E501", "D107"]
# D100, D101, D102, D103: Ignore missing docstrings in tests
per-file-ignores = ["tests/*:D100,D101,D102,D103,D104"]
docstring-convention = "google"
# Check for properly formatted copyright header in each file
copyright-check = "True"
copyright-author = "Canonical Ltd."
copyright-regexp = "Copyright\\s\\d{4}([-,]\\d{4})*\\s+%(author)s"
2 changes: 2 additions & 0 deletions charms/kfp-metadata-writer/requirements-fmt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
black
isort
24 changes: 24 additions & 0 deletions charms/kfp-metadata-writer/requirements-fmt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements-fmt.in
#
black==23.9.1
# via -r requirements-fmt.in
click==8.1.7
# via black
isort==5.12.0
# via -r requirements-fmt.in
mypy-extensions==1.0.0
# via black
packaging==23.2
# via black
pathspec==0.11.2
# via black
platformdirs==3.11.0
# via black
tomli==2.0.1
# via black
typing-extensions==4.8.0
# via black
8 changes: 8 additions & 0 deletions charms/kfp-metadata-writer/requirements-lint.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
black
codespell
flake8
flake8-builtins
flake8-copyright
isort
pep8-naming
pyproject-flake8
51 changes: 51 additions & 0 deletions charms/kfp-metadata-writer/requirements-lint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile requirements-lint.in
#
black==23.9.1
# via -r requirements-lint.in
click==8.1.7
# via black
codespell==2.2.6
# via -r requirements-lint.in
flake8==6.1.0
# via
# -r requirements-lint.in
# flake8-builtins
# pep8-naming
# pyproject-flake8
flake8-builtins==2.1.0
# via -r requirements-lint.in
flake8-copyright==0.2.4
# via -r requirements-lint.in
isort==5.12.0
# via -r requirements-lint.in
mccabe==0.7.0
# via flake8
mypy-extensions==1.0.0
# via black
packaging==23.2
# via black
pathspec==0.11.2
# via black
pep8-naming==0.13.3
# via -r requirements-lint.in
platformdirs==3.11.0
# via black
pycodestyle==2.11.0
# via flake8
pyflakes==3.1.0
# via flake8
pyproject-flake8==6.1.0
# via -r requirements-lint.in
tomli==2.0.1
# via
# black
# pyproject-flake8
typing-extensions==4.8.0
# via black

# The following packages are considered to be unsafe in a requirements file:
# setuptools
Loading

0 comments on commit 3b2bf14

Please sign in to comment.