Skip to content

Commit

Permalink
change from job to pod
Browse files Browse the repository at this point in the history
  • Loading branch information
asmacdo committed Nov 8, 2024
1 parent 99ac264 commit 6ee89b2
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 65 deletions.
51 changes: 23 additions & 28 deletions .github/manifests/disk-usage-report-job.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
apiVersion: batch/v1
kind: Job
apiVersion: v1
kind: Pod
metadata:
name: disk-usage-report-job
spec:
template:
metadata:
labels:
app: disk-usage-report
spec:
containers:
- name: disk-usage-report
image: IMAGE_PLACEHOLDER
args:
- "/home/asmacdo"
volumeMounts:
- name: persistent-storage
mountPath: "/home/"
restartPolicy: Never
nodeSelector:
NodeGroupType: default
NodePool: default
hub.jupyter.org/node-purpose: user
tolerations:
- key: "hub.jupyter.org/dedicated"
operator: "Equal"
value: "user"
effect: "NoSchedule"
volumes:
containers:
- name: disk-usage-report
image: IMAGE_PLACEHOLDER
args:
- "/home/asmacdo"
volumeMounts:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-persist
mountPath: "/home/"
restartPolicy: Never
nodeSelector:
NodeGroupType: default
NodePool: default
hub.jupyter.org/node-purpose: user
tolerations:
- key: "hub.jupyter.org/dedicated"
operator: "Equal"
value: "user"
effect: "NoSchedule"
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-persist
73 changes: 36 additions & 37 deletions .github/workflows/report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,51 +50,50 @@ jobs:
run: |
kubectl get pods -n jupyterhub
- name: Deploy Hello World Pod
run: |
kubectl apply -f .github/manifests/hello-world-pod.yaml
- name: Wait for Hello World Pod to complete
run: |
kubectl wait --for=condition=Ready pod/hello-world-pod --timeout=300s # 5 minutes
continue-on-error: true # Allow the workflow to continue even if this step fails

- name: Get Hello World Pod logs
run: |
kubectl logs hello-world-pod
if: ${{ success() }} # Only run this step if the previous step was successful

- name: Delete Hello World Pod
run: |
kubectl delete pod hello-world-pod
if: ${{ always() }} # Always run this step, even if other steps fail
#
# - name: Replace image placeholder in manifest
# run: |
# sed -i 's|IMAGE_PLACEHOLDER|'"${{ secrets.DOCKERHUB_USERNAME }}/disk_usage_report:latest"'|' .github/manifests/disk-usage-report-job.yaml
#
# - name: Deploy Disk Usage Report Job
# - name: Deploy Hello World Pod
# run: |
# kubectl apply -f .github/manifests/disk-usage-report-job.yaml
# kubectl apply -f .github/manifests/hello-world-pod.yaml
#
# # TODO should timeout be longer?
# - name: Wait for Disk Usage Report Job to complete
# - name: Wait for Hello World Pod to complete
# run: |
# kubectl wait --for=condition=complete job/disk-usage-report-job --timeout=300s
# continue-on-error: true
# kubectl wait --for=condition=Ready pod/hello-world-pod --timeout=300s # 5 minutes
# continue-on-error: true # Allow the workflow to continue even if this step fails
#
# - name: Retrieve generated report file
# - name: Get Hello World Pod logs
# run: |
# POD_NAME=$(kubectl get pods --selector=job-name=disk-usage-report-job -o jsonpath='{.items[0].metadata.name}')
# kubectl cp $POD_NAME:/output/du_report.json du_report.json -n jupyterhub
# cat du_report.json
# continue-on-error: true
# kubectl logs hello-world-pod
# if: ${{ success() }} # Only run this step if the previous step was successful
#
# # continue-on-error for previous steps so we delete the job
# - name: Delete Disk Usage Report Job
# - name: Delete Hello World Pod
# run: |
# kubectl delete job disk-usage-report-job
# kubectl delete pod hello-world-pod
# if: ${{ always() }} # Always run this step, even if other steps fail
#
- name: Replace image placeholder in manifest
run: |
sed -i 's|IMAGE_PLACEHOLDER|'"${{ secrets.DOCKERHUB_USERNAME }}/disk_usage_report:latest"'|' .github/manifests/disk-usage-report-job.yaml
- name: Deploy Disk Usage Report Job Pod
run: |
kubectl apply -f .github/manifests/disk-usage-report-job.yaml
# TODO should timeout be longer?
- name: Wait for Disk Usage Report Job to complete
run: |
kubectl wait --for=condition=complete pod/disk-usage-report-job --timeout=300s
continue-on-error: true

- name: Retrieve generated report file
run: |
kubectl cp disk-usage-report-job:/output/du_report.json du_report.json
cat du_report.json
continue-on-error: true

# continue-on-error for previous steps so we delete the job
- name: Delete Disk Usage Report Job
run: |
kubectl delete pod disk-usage-report-job
# - name: Clone dandi-hub-usage-reports repository
# run: |
# git clone https://github.com/dandi/dandi-hub-usage-reports.git
Expand Down

0 comments on commit 6ee89b2

Please sign in to comment.