-
Notifications
You must be signed in to change notification settings - Fork 1
GreenSiteDirector updates #2
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
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # src/GreenDIRAC/WorkloadManagementSystem/Agent/GreenReportingAgent.py # src/GreenDIRAC/__init__.py
- Introduced SiteDirectorGreen for green-aware pilot scheduling - Integrates with GD-CI and CIM APIs to fetch live PUE and carbon intensity (CI) - Caches metrics and computes combined green efficiency score (30% PUE / 70% CI) - Sorts queues by green efficiency before submitting pilots - Maintains full compatibility with standard DIRAC SiteDirector logic - Initial implementation does not yet use class inheritance; will be refactored in a future PR to extend the base SiteDirector cleanly
…robust JobDB storage - Added direct CIM API integration for fetching PUE and CI via GOCDB site mapping. - Implemented automatic JWT token retrieval and caching for CIM API authentication. - Computed energy (kWh) and CO₂ emissions (gCO₂) per job using TDP, PUE, and CI. - Enhanced logging: added site-level summaries and detailed per-job reporting.
| self.maxJobsAtOnce = self.am_getOption("MaxJobsAtOnce", self.maxJobsAtOnce) | ||
| self.login = self.am_getOption("CIM_EMAIL", self.login) | ||
| self.password = self.am_getOption("CIM_PASSWORD", self.password) | ||
| self.cim_api_base = self.am_getOption("cim_api_base", self.cim_api_base) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put it into the configuration
| def initialize(self): | ||
| """Sets defaults""" | ||
| # CIM API settings | ||
| self.login = "atsareg@in2p3.fr" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this and the next line
| pue, ci, gocdb = siteRes["Value"] | ||
|
|
||
| cpu_s = float(rec.get("TotalCPUTime(s)", 0)) | ||
| energy_kwh = cpu_s * tdp / cores / 1000.0 / 3600.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a separate function. Later we can have several models/functions to compare
| emissions = energy_kwh * pue * ci / 1000.0 # gCO2 | ||
|
|
||
| rec.update({ | ||
| "Energy(kwh)": energy_kwh, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the record field values against the common "Catalin's" document
| age = (time.time() - float(self.token_ts)) / 3600 | ||
| if age < self.token_max_age_hours: | ||
| return self.token | ||
| url = f"{self.cim_api_base.rstrip('/')}/../gd-cim-api/get-token" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify,correct
instead of gd-cim-api
…sed on the GreenScore CEE/(PUE*CI)
README for GreenDIRAC overview
The current repository for Green DIRAC still contains the initial impl of the GreenSiteDirector (e.g., CIM token is not dynamic), This PR shall correct the issue and contains the latest updates...