Update monitoring workflow #87
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: KVFinder-web service job submission statistics | |
on: | |
schedule: | |
- cron: '0 0 1 * *' | |
push: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
data: | |
name: Get job submission data | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get data from the server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script: | | |
echo ${{ secrets.PASSWORD }} | sudo -S su - -c "cat /home/${{ secrets.USERNAME }}/01_2023_to_12_2024.txt > /home/${{ secrets.USERNAME }}/usage.txt && ls /var/lib/containers/storage/volumes/kvfinder_web_service_kvfinder-jobs/_data -lhrt --time-style=long-iso >> /home/${{ secrets.USERNAME }}/usage.txt" | |
scp-copy: | |
name: Copy job submission data | |
runs-on: ubuntu-latest | |
needs: [data] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Copy job submission data | |
uses: nicklasfrahm/scp-action@main | |
with: | |
direction: download | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
insecure_password: ${{ secrets.PASSWORD }} | |
insecure_ignore_fingerprint: true | |
source: /home/${{ secrets.USERNAME }}/usage.txt | |
target: ./usage.txt | |
- name: Run python script to produce usage plots | |
run: | | |
pip install -r .github/workflows/requirements.txt | |
python3 .github/workflows/statistics.py | |
mkdir usage | |
mv usage.txt *.png usage/ | |
- name: Send job submission data to the server | |
uses: nicklasfrahm/scp-action@main | |
with: | |
direction: upload | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
insecure_password: ${{ secrets.PASSWORD }} | |
insecure_ignore_fingerprint: true | |
source: ${{ steps.date.outputs.date }}.tar.gz | |
target: ./statistics/${{ steps.date.outputs.date }}.tar.gz | |
- name: Upload job submission data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.date.outputs.date }} | |
path: ${{ steps.date.outputs.date }} | |
- name: Clean up | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script: | | |
echo ${{ secrets.PASSWORD }} | sudo -S su - -c "rm /home/${{ secrets.USERNAME }}/usage.txt" |