Skip to content

Instantly share code, notes, and snippets.

@HumairAK
HumairAK / train-no-cache.yaml
Created June 7, 2024 17:51
train-no-cache.yaml
# PIPELINE DEFINITION
# Name: tutorial-data-passing-2
# Inputs:
# message: str [Default: 'message']
components:
comp-preprocess:
executorLabel: exec-preprocess
inputDefinitions:
parameters:
message:
@HumairAK
HumairAK / gen_10.py
Created May 21, 2024 18:38
gen_10.py
#!/usr/bin/env python3
from typing import Dict, List
from kfp import compiler
from kfp import dsl
from kfp.dsl import Input, InputPath, Output, OutputPath, Dataset, Model, component
@dsl.component(base_image="quay.io/opendatahub/ds-pipelines-ci-executor-image:v1.0")
@HumairAK
HumairAK / gen-5.py
Created May 21, 2024 17:58
gen-5.py
#!/usr/bin/env python3
from typing import Dict, List
from kfp import compiler
from kfp import dsl
from kfp.dsl import Input, InputPath, Output, OutputPath, Dataset, Model, component
@dsl.component(base_image="quay.io/opendatahub/ds-pipelines-ci-executor-image:v1.0")
@HumairAK
HumairAK / minio.yaml
Created November 1, 2023 17:17
TLS Enabled Minio on OCP
kind: Deployment
apiVersion: apps/v1
metadata:
name: minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
template:
@HumairAK
HumairAK / simple_download_with_annotation_submitted.yaml
Created July 18, 2023 13:10
After apiserver adds copy steps (final).
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
annotations:
pipelines.kubeflow.org/big_data_passing_format: $(workspaces.$TASK_NAME.path)/artifacts/simple-pipeline-fe138/$TASKRUN_NAME/$TASK_PARAM_NAME
pipelines.kubeflow.org/pipeline_spec: '{"name": "simple_pipeline"}'
pipelines.kubeflow.org/run_name: Run of pre_version_at_2023-07-16T19:34:54.400Z
(954d1)
sidecar.istio.io/inject: "false"
tekton.dev/artifact_bucket: mlpipeline
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: simple-pipeline
annotations:
tekton.dev/output_artifacts: '{"produce-output": [{"key": "artifacts/$PIPELINERUN/produce-output/mydestfile.tgz",
"name": "produce-output-mydestfile", "path": "/tmp/outputs/mydestfile/data"}]}'
tekton.dev/input_artifacts: '{}'
tekton.dev/artifact_bucket: mlpipeline
tekton.dev/artifact_endpoint: minio-service.kubeflow:9000
import kfp
from kfp import dsl
from kfp import components
from kubernetes import client as k8s_client
import os
def produce_output(
mydestfile: kfp.components.OutputPath(), # Note: _file is stripped
):
import urllib.request
kind: ConfigMap
apiVersion: v1
metadata:
name: custom-script
labels:
app: ds-pipeline-sample
component: data-science-pipelines
data:
artifact_script: |-
#!/usr/bin/env sh
@HumairAK
HumairAK / v2-flip-coin.py
Created June 21, 2023 19:50
flip-coin example in kfp v2
import kfp
from kfp import dsl
@dsl.component(base_image="quay.io/hukhan/python:3.9.17-alpine3.18")
def get_random_int_op(minimum: int, maximum: int) -> int:
"""Generate a random number between minimum and maximum (inclusive)."""
import random
result = random.randint(minimum, maximum)
print(result)
@HumairAK
HumairAK / vscode_debug_test.json
Last active March 27, 2023 23:24
Use something similar for testing via debug in vscode
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug ODH Model Controller Tests",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/controllers",
"env": {