| Summary: | cannot update fairshare value from rest api | ||
|---|---|---|---|
| Product: | Slurm | Reporter: | azoshima |
| Component: | slurmrestd | Assignee: | Nate Rini <nate> |
| Status: | RESOLVED INFOGIVEN | QA Contact: | |
| Severity: | 4 - Minor Issue | ||
| Priority: | --- | CC: | alin4, ihmesa, nate |
| Version: | 20.11.8 | ||
| Hardware: | Linux | ||
| OS: | Linux | ||
| Site: | U WA Health Metrics | Alineos Sites: | --- |
| Atos/Eviden Sites: | --- | Confidential Site: | --- |
| Coreweave sites: | --- | Cray Sites: | --- |
| DS9 clusters: | --- | HPCnow Sites: | --- |
| HPE Sites: | --- | IBM Sites: | --- |
| NOAA SIte: | --- | OCF Sites: | --- |
| Recursion Pharma Sites: | --- | SFW Sites: | --- |
| SNIC sites: | --- | Linux Distro: | --- |
| Machine Name: | CLE Version: | ||
| Version Fixed: | Target Release: | --- | |
| DevPrio: | --- | Emory-Cloud Sites: | --- |
| Attachments: | from swagger | ||
(In reply to azoshima from comment #0) > We throw the following request to api (there is no PUT method available in > slurmrestd, so we did POST request) PUT vs POST is a little arbitrary here. POST was chosen since you're giving a new change request instead of modifying an existing object. slurmrestd is only a translator and is sending a new change request to slurmdbd in this case. > How can we update fairshare value via rest API? All of the entries in the slurmdb plugins are designed to be symmetric. The easiest way to figure out what to send is to query the current value: > curl $AUTH_ARGS 'http://localhost/slurmdb/v0.0.36/associations' Note that the fairshare tree values are held in the associations and not the accounts. sacctmgr joins them together to make it easier to handle via cli while slurmrestd does not. Please take a look at the generated API reference when trying to find a field name: > https://slurm.schedmd.com/archive/slurm-20.11.8/rest_api.html#dbv0.0.36_association Changing the fairshare values is done via this field: > shares_raw >> Integer Raw fairshare shares Please give it a try. Thank you for looking into this issue!
Association api endpoint accept only GET and DELETE request. Therefore we tried with Account api endpoint which accept POST method.
As you suggested we tried shares_raw value as one of association attribute, but it did not update share value. Share value was set as 1, even though we specified 5.
The data we used:
data = {
"accounts": [{
"associations": [{
"account": "something",
"cluster": "general",
"partition": None,
"user": None,
"shares_raw": 5
}],
"description": "something",
"name": "something",
"organization": "something"
}]
Thank you.
Created attachment 22609 [details]
from swagger
From swagger ui, we could not see POST method for /associations.
However, when we actually tried POST req to /association, it accepted.
Probably, openapi json needs to be updated.
This time, we also tried POST req to /associations to update shares_raw with the following data, but still it did not update share value.
data = {
"associations": [{
"account": "something",
"cluster": "general",
"partition": None,
"user": None,
"shares_raw": 5
}],
}
(In reply to azoshima from comment #6) > Created attachment 22609 [details] > from swagger > > From swagger ui, we could not see POST method for /associations. > However, when we actually tried POST req to /association, it accepted. > Probably, openapi json needs to be updated. This was corrected by bug#12538. Please upgrade to at least 21.08.3 for this fix. > https://github.com/SchedMD/slurm/commit/d8682afeee0 . > This time, we also tried POST req to /associations to update shares_raw with > the following data, but still it did not update share value. > > data = { > "associations": [{ > "account": "something", > "cluster": "general", > "partition": None, > "user": None, > "shares_raw": 5 > }], > } Please attach your slurmdbd log and slurmrestd log from during this test. My apologies. I tried POST request once again with the same data, and this time, it worked fine. It added account with specified share value. (Possibly i might used old jwt token last time.) Please go ahead to close this ticket. Thank you for your support. Closing per previous response. |
Hello We are trying to update account fairshare value from rest api. We throw the following request to api (there is no PUT method available in slurmrestd, so we did POST request) endpoint: /slurmdb/v0.0.36/accounts method: POST data: {"accounts": [ { "associations": [ { "account": "testaccount", "cluster": "general", "user": null, "share": 10 }, { "account": "testaccount", "cluster": "general", "user": "testuser" } ], "description": "testaccount", "name": "testaccount", "organization": "testaccount", } ] } How can we update fairshare value via rest api?