aihwkit.cloud.client.v1.parsers module

Parsers for the AIHW Composer API.

class aihwkit.cloud.client.v1.parsers.ExperimentParser[source]

Bases: object

Parser for Experiment API responses.

static parse_date_string(date_string)[source]

Return a datetime from a date string.

Parameters

date_string (str) – the date string from the API.

Returns

A value from the CloudExperimentCategory enum.

Return type

datetime.datetime

static parse_experiment(api_response, api_client)[source]

Return a CloudExperiment from an API response.

Parameters
  • api_response (Dict) – the response from the API.

  • api_client (Any) – the client to be used in API requests.

Returns

A CloudExperiment based on the response. Some of the fields might not be populated if they are not present in the response.

Return type

aihwkit.cloud.client.entities.CloudExperiment

static parse_experiment_category(api_response)[source]

Return an Experiment category from an API response.

Parameters

api_response (Dict) – the response from the API.

Returns

A value from the CloudExperimentCategory enum.

Raises

InvalidResponseFieldError – if the API response contains an unrecognized category.

Return type

aihwkit.cloud.client.entities.CloudExperimentCategory

static parse_experiment_status(api_response)[source]

Return an Experiment status from an API response.

Parameters

api_response (Dict) – the response from the API.

Returns

A value from the CloudJobStatus enum.

Raises

InvalidResponseFieldError – if the API response contains an unrecognized status code.

Return type

aihwkit.cloud.client.entities.CloudJobStatus

static parse_job(api_response)[source]

Return an CloudJob from an API response.

Parameters

api_response (Dict) – the response from the API.

Returns

A CloudJob based on the response. Some of the fields might not be populated if they are not present in the response.

Return type

aihwkit.cloud.client.entities.CloudJob

class aihwkit.cloud.client.v1.parsers.GeneralParser[source]

Bases: object

Parser for generic responses.

static parse_login(api_response)[source]

Return the jwt token from an API response.

Parameters

api_response (Dict) – the response from the API.

Returns

A string with the jwt token.

Return type

str