pyslurmutils.client.rest.api.slurm_access.validated_slurm_request#

pyslurmutils.client.rest.api.slurm_access.validated_slurm_request(method, base_url, path, path_params=None, query_params=None, json=None, headers=None, raise_http_error=True, **kwargs)[source]#

Sends an HTTP request and convert the response to the appropriate Pydantic model.

Parameters:
  • method (str) – HTTP method to use for the request (e.g., “GET”, “POST”).

  • base_url (str) – The base URL to which the path is appended.

  • path (str) – The specific API path for the request (e.g., “/slurm/v0.0.38/job/{job_id}”).

  • path_params (Optional[Dict[str, str]]) – A dictionary of path parameters to be substituted in the path.

  • query_params (Optional[Dict[str, str]]) – A dictionary of query parameters.

  • json (Optional[Dict]) – A dictionary to represent the JSON body for POST/PUT requests.

  • headers (Optional[Dict]) – A dictionary to represent the header for the request.

  • raise_http_error (bool) – Raise RemoteHttpError.

  • kwargs – Additional parameters to be passed to the requests.request() call.

Return type:

BaseModel

Returns:

A Pydantic model instance of the HTTP request response.

Raises:
  • ValueError – If header keys are missing or response validation failed.

  • RemoteHttpError – The HTTP request status indicates an error.