Skip to content

GreenSiteDirector updates#2

Closed
mezzeddinee wants to merge 1 commit intoGreenDIGIT-project:mainfrom
mezzeddinee:main
Closed

GreenSiteDirector updates#2
mezzeddinee wants to merge 1 commit intoGreenDIGIT-project:mainfrom
mezzeddinee:main

Conversation

@mezzeddinee
Copy link
Copy Markdown
Collaborator

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...

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)
Copy link
Copy Markdown
Member

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"
Copy link
Copy Markdown
Member

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
Copy link
Copy Markdown
Member

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,
Copy link
Copy Markdown
Member

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"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

simplify,correct

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.

2 participants