Skip to content

inference-sim/tektonc-data-collection

Repository files navigation

Benchmarking with tektonc

Tekton Basics

A Pipeline is set of Tasks. Tasks run in parallel. The execution flow can be controlled implicitly (via one task consume a result of another) or explcitly with mechanisms like runAfter, when and finally. A Task is a sequence of Steps. Steps run sequentially. The step can programmatically determine to execute or skip.

To execute a Pipeline create a PipelineRun, an object that identifies:

  • the Pipeline to execute and
  • the values of any parameters

Tekton creates a TaskRun for each Task in the Pipeline. A TaskRun is an object that identifies:

  • the Task and
  • the values of any parameters (passed from the PipelineRun)

The TaskRun is implemented by a Pod Each Step is implemented by a Container in the Pod.

Usage

Requirements

  1. HF token
  2. s3 bucket and necessary keys for uploading results
  3. Access to cluster with tekton (installing Tekton)

Setup

  1. Create a namespace where the Tekton pipeline will execute.

    export $NAMESPACE=your_namespace
    kubectl create ns $NAMESPACE

    or

    oc new-project $NAMESPACE

    For convenience, set the current context:

    kubectl config set-context --current --namespace $NAMESPACE
  2. Create a secret hf-secret containing your HuggingFace token in the namespace.

    kubectl create secret generic hf-secret \
        --namespace ${NAMESPACE} \
        --from-literal="HF_TOKEN=${HF_TOKEN}" \
        --dry-run=client -o yaml | kubectl apply -f -
  3. Create a secret containing your s3 credentials AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

    kubectl create secret generic s3-secret \
        --namespace ${NAMESPACE} \
        --from-literal="AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" \
        --from-literal="AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" \
        --dry-run=client -o yaml | kubectl apply -f -
  4. Give the tasks needed permissions

    envsubst '$NAMESPACE' < tekton/roles.yaml | kubectl apply -f -
    oc adm policy add-scc-to-user anyuid -z default -n $NAMESPACE
  5. Create RWX PVC model-pvc (300Gi) and data-pvc (20Gi) and source-pvc (20Gi) for storing models and execution results, respectively. These PVC is shared between all tasks. For example:

    export PVC_NAME=model-pvc
    export PVC_SIZE=300Gi
    export PVC_NAME=data-pvc
    export PVC_SIZE=20Gi
    export PVC_NAME=source-pvc
    export PVC_SIZE=20Gi
    cat <<EOF | kubectl apply -f -
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
        name: ${PVC_NAME}
        namespace: ${NAMESPACE}
    spec:
        accessModes:
        - ReadWriteMany
        resources:
            requests:
                storage: ${PVC_SIZE}
        # storageClassName: ocs-storagecluster-cephfs
        volumeMode: Filesystem
    EOF
  6. Install tkn cli:

    brew install tektoncd-cli

Running a pipeline

  1. Deploy the steps and tasks:

    for step in tekton/steps/*.yaml; do
        kubectl apply -f $step
    done
    for task in tekton/tasks/*.yaml; do
        kubectl apply -f $task
    done
  2. Build and deploy the pipeline:

    python tektonc/tektonc.py \
    -t tektoncsample/prefix-caching/pipeline.yaml.j2 \
    -f tektoncsample/prefix-caching/values.yaml \
    -r tektoncsample/prefix-caching/pipelinerun.yaml \
    -o tektoncsample/prefix-caching/pipeline.yaml
    
    kubectl apply -f tektoncsample/prefix-caching/pipeline.yaml
  3. Deploy the PipelineRun.

    Run the pipeline by deploying the PipelineRun:

    kubectl apply -f tektoncsample/prefix-caching/pipelinerun.yaml
    export EXPERIMENT_ID=
    export NAMESPACE=
    envsubst < tektoncsample/prefix-caching/pipelinerun.yaml | kubectl apply -f -

Inspection

See the PipelineRun object created:

tkn pr list

See the TaskRun objects created:

tkn tr list

See the logs for a TaskRun:

tkn tr logs <taskrun_name> -f

Describe a TaskRun:

tkn tr describe <taskrun_name>

Cleanup

Delete the PipelineRun:

tkn pr delete <pipelinerun_name> -f

About

Tektonc Data collection for vLLM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors