Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added gzip as default request header #277

Merged
merged 2 commits into from
Oct 19, 2021

Conversation

rsaggino
Copy link
Contributor

@rsaggino rsaggino commented Jun 3, 2021

Fixes #273 by adding gzip headers to the api client.

Tested on a small dev cluster, nipyapi 0.16.2 and NiFi 1.11.
It seems like there were additional improvements on NiFi/nipyapi that reduced the impact of this patch, this is still necessary on larger clusters and while making complex automations.

Before:

In []: %%time
   ...: import nipyapi
   ...: a=nipyapi.canvas.list_all_processors()
   ...:
   ...:
CPU times: user 22.3 s, sys: 3.46 s, total: 25.8 s
Wall time: 1min 27s

In []: %%time
   ...: import nipyapi
   ...: a=nipyapi.canvas.list_all_controllers()
   ...:
   ...:
CPU times: user 12.1 s, sys: 2.24 s, total: 14.3 s
Wall time: 35.7 s

After:

In []: %%time
   ...: import nipyapi
   ...: a=nipyapi.canvas.list_all_processors()
   ...:
   ...:
CPU times: user 19.8 s, sys: 1.11 s, total: 20.9 s
Wall time: 1min 1s

In []: %%time
   ...: import nipyapi
   ...: a=nipyapi.canvas.list_all_controllers()
   ...:
   ...:
CPU times: user 11.4 s, sys: 481 ms, total: 11.9 s
Wall time: 19.6 s

@coveralls
Copy link

coveralls commented Jun 3, 2021

Coverage Status

Coverage increased (+0.3%) to 69.11% when pulling 64e2a9d on rsaggino:gzip_nifi_api into 292aa1e on Chaffelson:main.

@ottobackwards
Copy link
Contributor

swagger-api/swagger-codegen#10085

So, this is a problem with the code gen.
I'm not sure we would want to change this file itself, since it is generated.

Normally for issues such as this, I would apply a patch post generation. Thoughts @Chaffelson ?

@ottobackwards
Copy link
Contributor

Note, that given url lib support for gzip, this is the right fix for the generated code
It is just how it is managed.

@rsaggino
Copy link
Contributor Author

rsaggino commented Jun 4, 2021

Normally for issues such as this, I would apply a patch post generation. Thoughts @Chaffelson ?

That would be the best option (aside from fixing this upstream).
Is the post-gen scripted somewhere or completely manual?

@ottobackwards
Copy link
Contributor

@Chaffelson
Copy link
Owner

The client is primarily generated using mustache templates, so if this was added to the template then all future clients would pick it up.

@rsaggino
Copy link
Contributor Author

The client is primarily generated using mustache templates, so if this was added to the template then all future clients would pick it up.

This is an easy fix but could get lost in future updates of the templates. Any preference?

@Chaffelson
Copy link
Owner

Chaffelson commented Jun 11, 2021 via email

@ottobackwards
Copy link
Contributor

@Chaffelson maybe you can list out explicitly what we would want to do?

@ottobackwards
Copy link
Contributor

ie:

  • update template in pr
  • generate using scripts
  • cut a release
  • ???
  • profit?

@rsaggino
Copy link
Contributor Author

Applied the change also to the mustache template.
Given the idea to use Bravado in the future, we could leave the generate script aside.

@rsaggino
Copy link
Contributor Author

@Chaffelson can we proceed with this?

@ottobackwards
Copy link
Contributor

I'm +1 on this, pending whatever testing @Chaffelson does for these kinds of changes

@ottobackwards
Copy link
Contributor

fwiw
:)

@Chaffelson
Copy link
Owner

Yeah this is the way to do it, I was going to cut a release this week but am dealing with unexpected covid isolation so it'll have to be next week sorry.

@Chaffelson
Copy link
Owner

Managed to get some testing on this done today and it's looking good, I'll be rolling up the new client for 1.13 in the next week and including this in it

@Chaffelson Chaffelson merged commit 288bec1 into Chaffelson:main Oct 19, 2021
rsaggino added a commit to rsaggino/nipyapi that referenced this pull request Nov 2, 2022
* Added gzip as default request header

* Gzip Fix on the mustache  template
@rsaggino rsaggino deleted the gzip_nifi_api branch October 16, 2023 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compression support on NiFi api requests
4 participants