Skip to content

Commit

Permalink
[Python] pass api_client configuration to model deserialize (OpenAPIT…
Browse files Browse the repository at this point in the history
…ools#13922)

The if not passed the models create a new configuration object which
configures logging and determines cpu count every time.
This causes extreme performance issues when deserializing larger sets of
items.

See also
kubernetes-client/python#1921
  • Loading branch information
juliantaylor authored Nov 7, 2022
1 parent 363906f commit 3dc8403
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ class ApiClient(object):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)

kwargs["local_vars_configuration"] = self.configuration
instance = klass(**kwargs)

if has_discriminator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ def __deserialize_model(self, data, klass):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)

kwargs["local_vars_configuration"] = self.configuration
instance = klass(**kwargs)

if has_discriminator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ def __deserialize_model(self, data, klass):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)

kwargs["local_vars_configuration"] = self.configuration
instance = klass(**kwargs)

if has_discriminator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ def __deserialize_model(self, data, klass):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)

kwargs["local_vars_configuration"] = self.configuration
instance = klass(**kwargs)

if has_discriminator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ def __deserialize_model(self, data, klass):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)

kwargs["local_vars_configuration"] = self.configuration
instance = klass(**kwargs)

if has_discriminator:
Expand Down

0 comments on commit 3dc8403

Please sign in to comment.