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

446 send workflow names #41

Merged
merged 10 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test the action locally
name: test-action

on:
push:
Expand All @@ -12,6 +12,7 @@ on:
# only run once a week to show the action is working and preserve as much energy as possible
# Reason being that we pull our ML model and this could have changed in the meantim
- cron: '22 4 * * 6'
workflow_dispatch:

permissions:
contents: read
Expand All @@ -23,6 +24,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Initialize Energy Estimation
uses: ./
Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ runs:
- if: inputs.task == 'get-measurement'
id: run-lap-model
name: Running estimation model
env:
NAME: ${{ github.workflow }}
shell: bash
run: |
${{github.action_path}}/scripts/make_measurement.sh -l "${{inputs.label}}" -r "${{ github.run_id }}" -b "${{inputs.branch}}" -R "${{ github.repository }}" -c ${{ github.sha }} -sd ${{inputs.send-data}} -s "github"
${{github.action_path}}/scripts/make_measurement.sh -l "${{inputs.label}}" -r "${{ github.run_id }}" -b "${{inputs.branch}}" -R "${{ github.repository }}" -c ${{ github.sha }} -sd ${{inputs.send-data}} -s "github" -n $NAME
lap_data_file="/tmp/eco-ci/lap-data.json"
echo "data-lap-json=$(cat $lap_data_file)" >> $GITHUB_OUTPUT

Expand Down
1 change: 1 addition & 0 deletions eco-ci-gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ cache:
-c $CI_COMMIT_SHA \
-sd $ECO_CI_SEND_DATA \
-s "gitlab" \
-n "gitlab-ci.yml" \

.display_results:
script:
Expand Down
21 changes: 20 additions & 1 deletion scripts/make_measurement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,22 @@ function make_measurement() {
unit="mJ"
model_name_uri=$(echo $MODEL_NAME | jq -Rr @uri)

curl -X POST "$add_endpoint" -H 'Content-Type: application/json' -d "{\"energy_value\":\"$value_mJ\",\"energy_unit\":\"$unit\",\"cpu\":\"$model_name_uri\",\"commit_hash\":\"${commit_hash}\",\"repo\":\"${repo}\",\"branch\":\"${branch}\",\"workflow\":\"$WORKFLOW_ID\",\"run_id\":\"${run_id}\",\"project_id\":\"\",\"label\":\"$label\", \"source\":\"$source\", \"cpu_util_avg\":\"$cpu_avg\", \"duration\":\"$time\"}"
curl -X POST "$add_endpoint" -H 'Content-Type: application/json' -d "{
\"energy_value\":\"$value_mJ\",
\"energy_unit\":\"$unit\",
\"cpu\":\"$model_name_uri\",
\"commit_hash\":\"${commit_hash}\",
\"repo\":\"${repo}\",
\"branch\":\"${branch}\",
\"workflow\":\"$WORKFLOW_ID\",
\"run_id\":\"${run_id}\",
\"project_id\":\"\",
\"label\":\"$label\",
\"source\":\"$source\",
\"cpu_util_avg\":\"$cpu_avg\",
\"duration\":\"$time\",
\"workflow_name\":\"$workflow_name\"
}"
fi

# write data to output
Expand Down Expand Up @@ -122,6 +137,10 @@ while [[ $# -gt 0 ]]; do
source="$2"
shift
;;
-n|--name)
workflow_name="$2"
shift
;;
\?)
echo "Invalid option -$OPTARG" >&2
;;
Expand Down