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

Mutitheard downloading waveforms #49

Open
xumi1993 opened this issue Nov 15, 2022 · 0 comments
Open

Mutitheard downloading waveforms #49

xumi1993 opened this issue Nov 15, 2022 · 0 comments

Comments

@xumi1993
Copy link
Owner

Is your feature request related to a problem? Please describe.
Mutitheard downloading waveforms.

Describe the solution you'd like

  • Define a function like star_download
  • Open a ThreadPool and throw arguments of star_download into the ThreadPool.
  • Following mass_download in obspy
def star_download_mseed(args):
    """
    Star maps the arguments to the
    utils.download_and_split_mseed_bulk() function.

    :param args: The arguments to be passed.
    """
    try:
        ret_val = utils.download_and_split_mseed_bulk(
            *args, logger=self.logger)
    except utils.ERRORS as e:
        msg = ("Client '%s' - " % args[1]) + str(e)
        if "no data available" in msg.lower():
            self.logger.info(msg.split("Detailed response")[0].strip())
        else:
            self.logger.error(msg)
        return []
    return ret_val

pool = ThreadPool(min(threads_per_client, len(chunks)))

pool.map(
      star_download_mseed,
      [(self.client, self.client_name, chunk) for chunk in chunks])
pool.close()
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

No branches or pull requests

1 participant