Skip to content

Set default threading state for Client downloads - #3

Open
calum-chamberlain wants to merge 1 commit into
GeoNet:mainfrom
calum-chamberlain:patch-1
Open

Set default threading state for Client downloads#3
calum-chamberlain wants to merge 1 commit into
GeoNet:mainfrom
calum-chamberlain:patch-1

Conversation

@calum-chamberlain

Copy link
Copy Markdown

To minimise the need for different argument calls compared to obspy's FDSN client, it would help to set a default state for threading at instantiation. This PR adds a max_threads value to the Client object which can later be overloaded by individual method calls, but if the max_threads is not set for an individual method call, it defaults to the Client's preset default. In this way you could just change the instantiation of the client compared to obspy's FDSN client without changing any other code and still make use of threading, e.g.:

client = Client("GEONET", max_threads=40)
client.get_waveforms(...)  # all other calls could remain the same as using obspy fdsn client.

@staylorofford staylorofford left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a sensible change I also desire.

I see no issue with the edits of @calum-chamberlain.

GeoNet may want to consider adding documentation for max_threads in the functions where it is called, as otherwise it is only documented in the code under the init function and tangentially within the get_events and get_waveforms functions themselves.

@salichon

Copy link
Copy Markdown

@pasansherath or @Thomas-Benson give it a try and give it a tick ?
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants