coldfront icon indicating copy to clipboard operation
coldfront copied to clipboard

push budget summary data to open ondemand

Open johrstrom opened this issue 3 years ago • 4 comments

If you published a json something like this about project budget allocations, we could show warnings in OnDemand about budgets that are about to be overrun (we set the % threshold on our side).

https://osc.github.io/ood-documentation/latest/customization.html#disk-quota-warnings-on-dashboard

johrstrom avatar Mar 11 '22 16:03 johrstrom

Or should I be calling an API?

johrstrom avatar Mar 11 '22 16:03 johrstrom

:face_palm, we already have this for balances. Can you support this format? And/or do you already? (sorry if I forgot! lol I apparently already forgot our feature for balances.)

https://osc.github.io/ood-documentation/latest/customization.html#balance-warnings-on-dashboard

johrstrom avatar Mar 11 '22 16:03 johrstrom

@johrstrom This sounds like a great feature. Can you provide more details on what a "resource balance" is? I think we would just need to better understand the mapping between OOD balance fields and the data ColdFront captures on an allocation.

We're working on a REST API (see #316) and this could be an endpoint we make available.

aebruno avatar Mar 11 '22 18:03 aebruno

I had to look this up and also add a ticket for us to update those docs :sweat_smile:

Here's what we're publishing.

{
    "balances": [
        {
            "project": "PZS1010", 
            "user": "johrstrom", 
            "value": 19
        }, 
        {
            "project": "PZS0714", 
            "user": "johrstrom", 
            "value": 7
        }
   ],
    "config": {
        "project_type": "project", 
        "unit": "dollar"
    }, 
    "timestamp": 1615986006, 
    "version": 1
}

Turns out these values being sent are 'estimated days remaining'. image

We use these locale's to change the messaging, i.e., interpret what value means and show to the user. https://github.com/OSC/ondemand/blob/master/apps/dashboard/config/locales/en.yml#L54-L57

Specifically this https://github.com/OSC/osc-ood-config/blob/80d9fed697ce21a561d9f25c2851224614ca2a25/ondemand.osc.edu/locales/en.yml#L6-L8

So you can use the messaging and values like so. Looks like it's a < operation against the threshold so if folks pay up front it's your remaining budge is < so much?

johrstrom avatar Mar 11 '22 19:03 johrstrom