Created attachment 22353 [details] patch The openapi.json spec published may be valid, but can not be used for the slurmrestd service. slurmrestd does not conform to the protocol described by the openapi.json I want to use the openapi.json to use the the slurmrestd api. This is what I got so far. To my understanding there are some OpenAPI incompatible constructs in the protocol which can not be fixed by the openapi.json. (e.g. job_resources/allocated_nodes using dynamic dict keys) Sometimes status=500 is a valid response, often the arguments/responce is incomplete, the _error schema is used with every permuation of error errno error_number While I can only test with 0.0.36 I provide patches for 37 & 38 as well. Project to improve the API is here: https://github.com/commonism/slurmrest
Markus Thanks for your patchset. I'm currently in the process of reviewing and chopping it up into multiple patches. This change being correct in bug#12982 > 2166 @@ -1743,11 +1767,21 @@⏎ > 2167 },⏎ > 2168 "sockets": {⏎ > 2169 "type": "object",⏎ > 2170 - "description": "assignment status of each socket by socket id"⏎ > 2171 + "description": "FIXME",⏎ > 2172 + "properties": {⏎ > 2173 + "0": {⏎ > 2174 + "type": "string"⏎ > 2175 + }⏎ > 2176 + }⏎ > 2177 },⏎ > 2178 "cores": {⏎ > 2179 "type": "object",⏎ > 2180 - "description": "assignment status of each core by core id"⏎ > 2181 + "description": "FIXME",⏎ > 2182 + "properties": {⏎ > 2183 + "0": {⏎ > 2184 + "type": "string"⏎ > 2185 + }⏎ > 2186 + }⏎ > 2187 }⏎ > 2188 }⏎ > 2189 }, --Nate
Created attachment 23642 [details] patch for master (v2) > The openapi.json spec published may be valid, > but can not be used for the slurmrestd service. Thanks for submitting your patchset. In the future, please make sure to do one change per patch otherwise we need to break them up before we can review and push them upstream. This makes it easier for us to review and faster overall. > To my understanding there are some OpenAPI incompatible constructs > in the protocol which can not be fixed by the openapi.json. > (e.g. job_resources/allocated_nodes using dynamic dict keys) This is getting handled in bug#12982. The dumping of the core/nodes fell out of sync with the upstream API. > Sometimes status=500 is a valid response, > often the arguments/responce is incomplete, > the _error schema is used with every permuation of error errno error_number Translating internal Slurm error codes in the HTTP error codes is an ongoing process. Instead opted to provide the error output as default since anything other than 200 is a failure of one type or another. > While I can only test with 0.0.36 I provide patches for 37 & 38 as well. We only do security patches for back levels of the plugins. The attached is only targeted at the v38 plugins that will be included with slurm-22.05 release. Please take a look at the patchset and see if anything was missed.
Created attachment 23643 [details] patch for master (v3) rebased to master (3d69f0c)
Comment on attachment 23643 [details] patch for master (v3) Thank you for your contribution. The changes are now upstream in the master branch and will be included in the slurm-22.05 release. > https://github.com/SchedMD/slurm/compare/19fb02bd16d...82455a3fa637d85
(In reply to Nate Rini from comment #3) > This change being correct in bug#12982 > > 2166 @@ -1743,11 +1767,21 @@⏎ > > 2167 },⏎ > > 2168 "sockets": {⏎ > > 2169 "type": "object",⏎ > > 2170 - "description": "assignment status of each socket by socket id"⏎ > > 2171 + "description": "FIXME",⏎ > > 2172 + "properties": {⏎ > > 2173 + "0": {⏎ > > 2174 + "type": "string"⏎ > > 2175 + }⏎ > > 2176 + }⏎ > > 2177 },⏎ > > 2178 "cores": {⏎ > > 2179 "type": "object",⏎ > > 2180 - "description": "assignment status of each core by core id"⏎ > > 2181 + "description": "FIXME",⏎ > > 2182 + "properties": {⏎ > > 2183 + "0": {⏎ > > 2184 + "type": "string"⏎ > > 2185 + }⏎ > > 2186 + }⏎ > > 2187 }⏎ > > 2188 }⏎ > > 2189 }, The patch is … let's say as correct as possible. To my understanding the data structure chosen can not be described by OpenAPI due to the use of dynamic property names (depending on the number of cores/sockets). core/sockets should be an array of objects, the identifier a key in this object.
(In reply to Markus Kötter from comment #12) > (In reply to Nate Rini from comment #3) > > This change being correct in bug#12982 It will be corrected in bug#12982. The entire parsing of the CPU usage was incorrect. > To my understanding the data structure chosen can not be described by > OpenAPI due to the use of dynamic property names (depending on the number of > cores/sockets). > core/sockets should be an array of objects, the identifier a key in this > object. Which openapi generator are you using? Yes, the dynamic property names are going to get removed and replaced by an array.
Closing this ticket as the patches are now upstream. Please reply if you have any more questions. Thanks, --Nate
*** Ticket 13522 has been marked as a duplicate of this ticket. ***
*** Ticket 13524 has been marked as a duplicate of this ticket. ***
(In reply to Nate Rini from comment #13) > Which openapi generator are you using? https://github.com/commonism/aiopenapi3 https://github.com/commonism/slurmrest
Thanks for sharing the openapi parser for python.
*** Ticket 11955 has been marked as a duplicate of this ticket. ***
(In reply to Markus Kötter from comment #0) > To my understanding there are some OpenAPI incompatible constructs > in the protocol which can not be fixed by the openapi.json. > (e.g. job_resources/allocated_nodes using dynamic dict keys) This is not correct. It is possible and part of the specification via "additionalProperties". https://swagger.io/docs/specification/data-models/dictionaries/ And will be useful for SLURM for Environment & others as well. I would not combine additionalProperties with static properties due to lacking client side support.
(In reply to Markus Kötter from comment #23) > I would not combine additionalProperties with static properties due to > lacking client side support. This has been an ongoing issue with client generators. We have implemented many things in the standard that turned out to not be implemented by any of the clients. With any luck, the generators will improve and we will be able to use more of these features. Are there any more questions?
Closing out the ticket as there appear to be no more questions.