Skip to content

Restore purchasedNodes After Job Block#12

Merged
2Ryan09 merged 12 commits intomainfrom
node-overage-restore
Apr 23, 2026
Merged

Restore purchasedNodes After Job Block#12
2Ryan09 merged 12 commits intomainfrom
node-overage-restore

Conversation

@2Ryan09
Copy link
Copy Markdown
Contributor

@2Ryan09 2Ryan09 commented Apr 16, 2026

Sister of slaclab/sdf-cli#10

Comment thread schema.py
{ "$lookup": { "from": "clusters", "localField": "clustername", "foreignField": "name", "as": "cluster"}},
{ "$unwind": "$cluster" },
{ "$project": { "_id": 0, "facility": "$facility", "clustername": "$clustername", "purchasedNodes": { "$multiply": [ "$servers", "$cluster.nodecpucount" ] } }},
{ "$project": { "_id": 0, "facility": "$facility", "clustername": "$clustername", "purchasedNodes": { "$toInt": { "$multiply": [ "$servers", "$cluster.nodecpucount" ] } } }},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does this affect floats?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nodecpucount fields are declared as both int (via ClusterInput) and float (via FacilityClusterUsage), and servers was declared as a float (but all usage seems to use int-like values), so this is more a assurance that the returned value remained int.

@2Ryan09
Copy link
Copy Markdown
Contributor Author

2Ryan09 commented Apr 17, 2026

Turns out I missed the call to sacctmgr within FacilityUsage.format_data that would allow us to not have to ping coact-api to gather the purchased nodes, making this PR unnecessary. All changes this PR intended are fully encapsulated in slaclab/sdf-cli#10 I second guessed myself, the original implementation was correct

@2Ryan09 2Ryan09 closed this Apr 17, 2026
@2Ryan09 2Ryan09 reopened this Apr 17, 2026
@2Ryan09 2Ryan09 merged commit 7f788de into main Apr 23, 2026
1 check passed
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