Skip to content

Usage Scenario Variables and ScenarioRunner templates #1172

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

Merged
merged 28 commits into from
May 2, 2025

Conversation

ArneTR
Copy link
Member

@ArneTR ArneTR commented May 1, 2025

Adds measurement templates for beginners and quick measurements with GMT.

YOu can now do:

  • Quickly measure a website
    • ./run-template website "https://www.google.de"
  • Quickly measure an AI prompt (will default to gemma3:1b)
    • ./run-template ai "How cool is the GMT?"

This makes the tool more beginner friendly, but also abstracts away some of the pitfalls that are happing with measuring these two cases for instance that for both you need to have sensible providers active and for websites the resolution should be at least 1/10 of the page load time (typically 10 ms)

We will iterate on these modes and add warnings / guard-clauses as needed, but will have them as bare like this for the moment.

Greptile Summary

Added measurement templates and usage scenario variables to enable quick website and AI measurements, with significant updates to the ScenarioRunner and API endpoints.

  • Added usage_scenario_variables JSONB column to runs, jobs, and watchlist tables with proper constraints
  • Introduced /v2/jobs and /v2/runs endpoints, deprecating v1 versions with backward compatibility
  • Added validation and error handling for usage scenario variables in ScenarioRunner
  • Added test coverage for variable handling, template functionality and API changes
  • Security concern: Potential shell injection risk in Docker command execution with shell=True

@ArneTR
Copy link
Member Author

ArneTR commented May 1, 2025

@ribalba How do you like these modes? Do they fulfill your idea of an easy mode?

I am keeping the templates in the GMT repository and thus they are automatically versioned. To not muddy the overview of which version they have been changed in the GMT now overloads the commit-hash with the actual folder of the templates. Thus a change to the AI template will still keep the same commit_hash for the website template and vice versa.

* main:
  Root DIR of GMT was not accurate
  Renamed Runner to ScenarioRunner and moved to lib/
  Software add now returns job_id on insert; Jobs API now allows filter for job_id [skip ci] (#1170)
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

23 file(s) reviewed, 11 comment(s)
Edit PR Review Bot Settings | Greptile

@ArneTR ArneTR changed the title Scenario runner templates Usage Scenario Variables and ScenarioRunner templates May 1, 2025
Copy link

github-actions bot commented May 1, 2025

Old Energy Estimation

Eco CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Measurement #1 28.5396 3227.83 4.18 771.37
--- --- --- --- ---
Total Run 28.54 3227.83 4.18 771.37
--- --- --- --- ---
Additional overhead from Eco CI N/A 9.11 4.00 2.28

🌳 CO2 Data:
City: Chicago, Lat: 41.8835, Lon: -87.6305
IP: 172.183.175.195
CO₂ from energy is: 1.191069270 g
CO₂ from manufacturing (embodied carbon) is: 0.220082512 g
Carbon Intensity for this location: 369 gCO₂eq/kWh
SCI: 1.411152 gCO₂eq / pipeline run emitted


Total cost of whole PR so far:

@ArneTR
Copy link
Member Author

ArneTR commented May 2, 2025

@greptileai

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

29 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile

@ArneTR
Copy link
Member Author

ArneTR commented May 2, 2025

@greptileai

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

24 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

github-actions bot commented May 2, 2025

Eco CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Measurement #1 23.597 3801.55 3.82 995.44
--- --- --- --- ---
Total Run 23.60 3801.55 3.82 995.44
--- --- --- --- ---
Additional overhead from Eco CI N/A 11.63 4.07 2.86

🌳 CO2 Data:
City: Chicago, Lat: 41.8835, Lon: -87.6305
IP: 20.88.39.126
CO₂ from energy is: 1.532024650 g
CO₂ from manufacturing (embodied carbon) is: 0.284012777 g
Carbon Intensity for this location: 403 gCO₂eq/kWh
SCI: 1.816037 gCO₂eq / pipeline run emitted


Total cost of whole PR so far:

@ArneTR ArneTR merged commit 4f2a73b into main May 2, 2025
1 check failed
@ArneTR ArneTR deleted the scenario-runner-templates branch May 2, 2025 10:26
ArneTR added a commit that referenced this pull request May 4, 2025
* main: (27 commits)
  Bump orjson from 3.10.16 to 3.10.18 (#1168)
  Bump pydantic from 2.11.3 to 2.11.4 (#1169)
  Bump psycopg[binary] from 3.2.6 to 3.2.7 (#1171)
  Resource limits now also from services key; Added tests (#1173)
  (fix): Cron job queue check logic was reversed
  Updated ee
  Moving [system] and [machine] to upper case
  Shortened model
  Watchlist must insert usage_scenario_variables
  Comment for MCP
  Job ID now a field to filter by
  Usage Scenario Variables and ScenarioRunner templates (#1172)
  Disabled providers are now removed also from DB entry not only from effective measurement
  (fix): Entries for config options that were null where not correctly showing
  Made temperatur error more helpful
  Typo
  Root DIR of GMT was not accurate
  Renamed Runner to ScenarioRunner and moved to lib/
  Software add now returns job_id on insert; Jobs API now allows filter for job_id [skip ci] (#1170)
  (test-fix): New wording
  ...
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.

1 participant