green-coding-solutions / eco-ci-energy-estimation

Eco CI Energy estimation for Github Actions Runner VMs
MIT License
48 stars 10 forks source link

`eco-ci-output.txt` is empty for GitLab pipeline #31

Closed NatalieZava closed 11 months ago

NatalieZava commented 11 months ago

Hi guys, I'm trying to measure a GitLab job like this, but the resulting eco-ci-output.txt is empty.

image: ubuntu:22.04

services:
  - openjdk:11-jre-buster

include:
  remote: 'https://raw.githubusercontent.com/green-coding-berlin/eco-ci-energy-estimation/main/eco-ci-gitlab.yml'

stages:
  - build

build:
  stage: build
  script:
    - apt-get update
    - apt-get install default-jdk -y
    - export ECO_CI_LABEL="build"
    - !reference [.initialize_energy_estimator, script]
    - !reference [.start_measurement, script]
    - chmod +x ./gradlew
    - ./gradlew check assemble
    - !reference [.get_measurement, script]
    - !reference [.display_results, script]
  artifacts:
    paths:
      - eco-ci-output.txt

Here's the console output:

...
$ echo 'running eco-ci start script' # collapsed multi-line command
running eco-ci start script
⚠️ Unknown model model name : Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
model name  : Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
model name  : Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
model name  : Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz for estimation, running default ...
$ chmod +x ./gradlew
$ ./gradlew check assemble
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava
> Task :processResources
> Task :classes
> Task :bootJarMainClassName
> Task :bootJar
> Task :jar
> Task :compileTestJava
> Task :processTestResources
> Task :testClasses
> Task :test
> Task :check
> Task :assemble
BUILD SUCCESSFUL in 2m 37s
8 actionable tasks: 8 executed
$ echo 'running eco-ci measure script'
running eco-ci measure script
$ repo=$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME # collapsed multi-line command
38.38 32.23 17.45 8.14 8.12 12.92 4.24 5.53 5.53 11.05 10.00 4.96 12.04 30.50 54.75 58.46 60.90 58.75 81.42 59.45 64.65 60.15 62.53 61.90 62.56 48.48 38.89 40.70 72.50 50.51 40.46 99.50 99.50 58.19 57.89 61.10 62.96 81.27 81.30 58.69 71.54 67.34 69.00 72.39 35.13 27.66 21.88 24.23 14.73 10.31 9.14 17.01 13.40 13.33 19.49 53.52 53.79 53.02 52.76 53.88 52.63 52.90 53.16 48.74 60.45 73.30 65.49 74.00 84.38 70.28 92.11 90.50 87.68 89.90 88.35 88.24 90.45 90.00 86.40 88.80 84.74 86.22 87.82 83.59 66.67 50.89 46.08 40.61 53.03 53.25 51.13 48.36 55.42 43.25 50.00 44.16 57.18 78.48 67.17 78.59 56.96 52.79 74.25 65.91 76.59 77.27 62.53 61.21 60.86 64.82 72.98 67.34 63.61 60.00 61.15 61.77 66.08 94.71 76.32 60.45 56.53 70.43 67.51 61.27 65.49 62.28 70.85 64.91 60.05 61.46 57.68 78.50 71.07 73.37 74.37 59.19 61.65 86.65 70.85 84.79 97.24 82.78 82.16 62.03 56.64 59.75 61.62 54.27 83.17 73.05 60.10 79.35 37.75 0.00 8.50 1.25 36.00
$ echo 'running eco-ci display script'
running eco-ci display script
$ FORMAT_CLR="\e[44m" && TXT_CLEAR="\e[0m" # collapsed multi-line command
cat: /tmp/eco-ci/output-short.txt: No such file or directory
$ echo -e "$FORMAT_CLR$(cat /tmp/eco-ci/output.txt)$TXT_CLEAR"
$ cp /tmp/eco-ci/output.txt ./eco-ci-output.txt
section_end:1689932512:step_script
section_start:1689932512:archive_cache
Saving cache for successful job
Creating cache default...
WARNING: /tmp/eco-ci/venv/: no matching files
Archive is up to date!
Created cache
section_end:1689932512:archive_cache
section_start:1689932512:upload_artifacts_on_success
Uploading artifacts for successful job
Uploading artifacts...
eco-ci-output.txt: found 1 matching files and directories
Uploading artifacts as "archive" to coordinator... ok
section_end:1689932513:upload_artifacts_on_success
section_start:1689932513:cleanup_file_variables
Cleaning up file based variables
section_end:1689932514:cleanup_file_variables
Job succeeded
ArneTR commented 11 months ago

Hey @NatalieZava , nice that you are trying out the Eco-CI to measure your pipelines!

What I see in the debug is that the CPU is not found, which is suprising as we are currently not aware that Gitlab Shared runners are using different CPUs than the AMD Epyc ones. => Are you running on Gitlab shared runners or in a self hosted instance?

  1. @dan-mm Could you look into the error that /tmp/eco-ci/output-short.txt does not exist and thus 'eco-ci-output.txt' cannot be popuplated?
dan-mm commented 11 months ago

Hi @NatalieZava - thanks for the bug report, it was indeed a regression on my part. It should be fixed now, please let me know if you have any issues!

NatalieZava commented 11 months ago

Hi @dan-mm and @ArneTR - Thanks! It's working now 🤩

ArneTR commented 11 months ago

Hey @NatalieZava : Do you still have a reply for us if you are using a shared runner or a self-hosted one?

We have never seen this line before and are curious where the unknown CPU is coming from:

Unknown model model name : Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz

NatalieZava commented 11 months ago

Hi @ArneTR, it's a self-hosted runner in the company's data center.