Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(aspirational hack project) Auto-generate EFS usage report & Log storage #173

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

asmacdo
Copy link
Member

@asmacdo asmacdo commented Jul 16, 2024

We will run a github action at 1 month intervals (or whatever) that generates the efs-usage report from kubernetes, commits it to a private datalad repo.

Github action:

  • report generation and retrieve log: kubectl apply -f inspect-pvc-pod.yaml && kubectl logs -f $(kubectl get pods -o jsonpath="{.items[?(@.metadata.name=='inspect-pvc-pod')].metadata.name}") (ish)
  • execution via datalad run (@yarikoptic this is the usecase for datalad publishing some containers)
  • push updated datalad repo to some repo

(Side Bonus: GH Action with access to EKS builds towards GitOps goal)

EFS_HOME="$EFS_PERSIST_MNT/home"

# Generate the size report
du -sh $EFS_HOME/* | awk '{print $1, $2}' > $EFS_HOME/size_report.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do this way (storing into EFS itself), better to IMHO

Suggested change
du -sh $EFS_HOME/* | awk '{print $1, $2}' > $EFS_HOME/size_report.txt
cd "$EFS_HOME" && d8 -sh * | awk '{print $1, $2}' > size_report.txt

then you would avoid having some irrelevant path prefix there.

Comment on lines +26 to +27
# Keep the container running
sleep 3600
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs cleanup

Suggested change
# Keep the container running
sleep 3600

sleep 3600
volumeMounts:
- name: efs-storage
mountPath: /mnt/efs-persist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ATM we are transferring 10TB but good amount of space is occupied by a few users, e.g. the largest (500G) is by one user having 1 single NWB file. We could/should quickly inspect and reach out asking if could be removed.

But ideally we need a simple script which may be prints N largest files per each user and sorts users by the total size or smth like that....

# cd /mnt/efs-persist/home; for u in *; do biggies=$(find $u -size +1000000 -print0 | xargs -0 -r ls -Sl | head -n 5 | tr '\n' '>'); [ -z "$biggies" ] || { du -sm $u; echo  "${biggies}" | tr '>' '\n'; }; done

but ran on the original efs

here is the pod definition we used for pod to mount target EFS

apiVersion: v1
kind: Pod
metadata:
  name: sleep-tender
spec:
  containers:
  - name: inspect-pvc-container
    image: busybox
    command:
        - /bin/sh
        - -c
        - ls -la /mnt/efs-persist; echo sleeping; sleep 3600; echo exiting
    volumeMounts:
    - name: efs-storage
      mountPath: /mnt/efs-persist
      readOnly: true
  volumes:
  - name: efs-storage
    persistentVolumeClaim:
      claimName: efs-persist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants