generated from EGI-Federation/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from enolfc/accounting
New accounting check tool
- Loading branch information
Showing
10 changed files
with
570 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
no-duplicate-heading: | ||
siblings_only: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Class for interaction with the accounting portal""" | ||
|
||
import datetime | ||
import numbers | ||
|
||
import httpx | ||
|
||
ACCOUNTING_URL = "https://accounting.egi.eu/" | ||
SITE_VO_ACCOUNTING = ( | ||
"cloud/sum_elap_processors/SITE/VO/" | ||
"{start_year}/{start_month}/{end_year}/{end_month}" | ||
"/all/onlyinfrajobs/JSON/" | ||
) | ||
|
||
|
||
class Accounting: | ||
def __init__(self): | ||
self._data = {} | ||
|
||
def _get_accounting_data(self): | ||
"""Gets accounting data for sites / vos over the last 90 days""" | ||
today = datetime.date.today() | ||
start = today - datetime.timedelta(days=90) | ||
url = ACCOUNTING_URL + SITE_VO_ACCOUNTING.format( | ||
start_year=start.year, | ||
start_month=start.month, | ||
end_year=today.year, | ||
end_month=today.month, | ||
) | ||
# accounting generates a redirect here | ||
r = httpx.get(url, follow_redirects=True) | ||
self._data = r.json() | ||
return self._data | ||
|
||
def site_vos(self, site): | ||
if not self._data: | ||
self._get_accounting_data() | ||
for col in self._data: | ||
if col["id"] == site: | ||
return set( | ||
[ | ||
vo[0] | ||
for vo in col.items() | ||
if isinstance(vo[1], numbers.Number) | ||
and vo[1] != 0 | ||
and vo[0] not in ["Total", "Percent"] | ||
] | ||
) | ||
return set([]) | ||
|
||
def all_sites(self): | ||
if not self._data: | ||
self._get_accounting_data() | ||
for col in self._data: | ||
if col["id"] == "xlegend": | ||
return [site[1] for site in col.items() if site[0] != "id"] | ||
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
D4SCIENCE: | ||
- d4science.org | ||
WENMR: | ||
- enmr.eu | ||
OBSEA: | ||
- vo.obsea.es | ||
NBISBILS: | ||
- vo.nbis.se | ||
MSO4SC: | ||
- imath.cesga.es | ||
BIOISI: | ||
- bioisi | ||
TERRADUE: | ||
- geohazards.terradue.com | ||
GEODAB: | ||
- vo.geoss.eu | ||
CLARIN: | ||
- vo.clarin.eu | ||
DEIMOS: | ||
- vo.nextgeoss.eu | ||
EMSOERIC: | ||
- vo.emso-eric.eu | ||
TrainingInfrastructure: | ||
- training.egi.eu | ||
Notebooks: | ||
- vo.notebooks.egi.eu | ||
AoD: | ||
- vo.access.egi.eu | ||
EXTraS: | ||
- extras-fp7.eu | ||
Fusion: | ||
- fusion | ||
LSGC: | ||
- biomed | ||
MRILab: | ||
Peachnote: | ||
- peachnote.com | ||
OPENBIOMAP: | ||
- vo.openbiomaps.org | ||
IIASA: | ||
EMPHASIS: | ||
- vo.emphasisproject.eu | ||
EOSCSYNERGY: | ||
- eosc-synergy.eu | ||
- worsica.vo.incd.pt | ||
- cryoem.instruct-eric.eu | ||
- lagoproject.net | ||
- umsa.certi-sc-cz | ||
- mswss.ui.savbka.sk | ||
- o3as.data.kit.edu | ||
VESPA: | ||
- vo.europlanet-vespa.eu | ||
ECRIN: | ||
- vo.crmdr.org | ||
STARS4ALL: | ||
- vo.stars4all.eu | ||
GOSAFE: | ||
- gosafe.eng.it | ||
DIGITBRAIN: | ||
- vo.digitbrain.eu | ||
BELLE2: | ||
- belle | ||
OPERAS: | ||
- vo.operas-eu.org | ||
DEEP: | ||
- deep-hybrid-datacloud.eu | ||
POLICYCLOUD: | ||
- vo.ai4publicpolicy.eu | ||
CSCALE: | ||
- aquamonitor.c-scale.eu | ||
- eval.c-scale.eu | ||
- terrascope.c-scale.eu | ||
- waterwatch.c-scale.eu | ||
# these below are actually removed | ||
- HighResLandSurf.c-scale.eu | ||
- return.c-scale.eu | ||
- hisea.c-scale.eu | ||
- coastmonitor.c-scale.eu | ||
- in-sar-cubes.c-scale.eu | ||
- plankton.c-scale.eu | ||
- lost-salvage.c-scale.eu | ||
- gltfca.c-scale.eu | ||
- geohazards.c-scale.eu | ||
- pangeo.c-scale.eu | ||
EISCAT3D: | ||
- eiscat.se | ||
BINARE: | ||
- vo.binare-oy.eu | ||
COS4CLOUD: | ||
- cos4cloud-eosc.eu | ||
PEROVSKITE: | ||
- perla-pv.ro | ||
ENES: | ||
- vo.enes.org | ||
MINKE: | ||
- minka-sdg.org | ||
BD4NRG: | ||
- vo.bd4nrg.eu | ||
PITHIANRF: | ||
- vo.esc.pithia.eu | ||
- vo.pithia.eu | ||
CEITEC: [] | ||
PLOCAN: | ||
- vo.plocan.eu | ||
ENVRIFAIR: | ||
- vo.envri-fair.eu | ||
ICECUBE: | ||
- icecube | ||
MATRYCS: | ||
- vo.matrycs.eu | ||
OPENCOASTS: | ||
- opencoast.eosc-hub.eu | ||
AIIDALAB: | ||
- vo.max-centre.eu | ||
PANGEO: | ||
- vo.pangeo.eu | ||
LETHE: | ||
- vo.lethe-project.eu | ||
LATITUDO40: | ||
- vo.latitudo40.com.eu | ||
EUROSCIENCEGATEWAY: | ||
- vo.usegalaxy.eu | ||
CESSDA: | ||
- vo.cessda.eduteams.org | ||
SEADATANET: | ||
- vo.seadatanet.org | ||
ERIES: | ||
- vo.eries.eu | ||
EUROSEA: | ||
- vo.eurosea.marine.ie | ||
ANERIS: | ||
- vo.aneris.eu | ||
OPENRISKNET: | ||
- openrisknet.org | ||
OIPUB: | ||
- vo.oipub.com | ||
DECIDO: | ||
- vo.decido-project.eu | ||
AI4PUBLICPOLICY: | ||
- vo.ai4publicpolicy.eu | ||
PSMA: | ||
- vo.radiotracers4psma.eu | ||
EUREKA3D: | ||
- culturalheritage.vo.egi.eu | ||
NEURODESK: | ||
- vo.neurodesk.eu |
Oops, something went wrong.