Skip to content

Add s3 client plugin - #1039

Merged
pavlis merged 5 commits into
masterfrom
add_s3_worker_plugin
Oct 1, 2026
Merged

pavlis merged 5 commits into
masterfrom
add_s3_worker_plugin

Conversation

@pavlis

@pavlis pavlis commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

This branch initiates creating a standard interface to Amazon S3 for mspass for both serial and parallel workflows. There is work to be done before we merge it, but this adds these features:

  1. A generic fetch_s3_client that can be used for serial or parallel workflows via the same api. The design parallels the similar use for a database client implemented a few months ago.
  2. The prototypes for this came from workflows used for the 2026 Earthscope MsPASS course. This differs significantly from that prototype found in the tutorials repository in several ways. Most notably it defines 3 different classes for setting up an s3 client for GeoLab (requires the earthscope_sdk to function and has a lot of additional complications), Anonymous access for open data, and a Stock version for someone using MsPASS running with an AWS account from an AWS server.
  3. The serial version adds a decorator @lru_cache for efficiency when an s3 client needs to be accessed inside a function in a serial workflow. An older version required passing a session object in a serial job which turns out to be a potential issue. When a client is created on each entry from a session object new connections have to be created. That is at least inefficient and at worst may have been subject to leaking resources by not properly closing connections.

I tested the GeoLab and Anonymous versions on GeoLab and both work there for a simple test. Most lacking is a pytest suite to fully exercise this new code. An additional glaring deficiency is no documentation for this new feature in docs. There are some subtle issues we will need to explain for using this we must document before we release the world on this feature.

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.08%. Comparing base (c53d735) to head (e028e07).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1039      +/-   ##
==========================================
+ Coverage   74.94%   75.08%   +0.14%     
==========================================
  Files         184      185       +1     
  Lines       37795    37900     +105     
  Branches     2565     2565              
==========================================
+ Hits        28324    28457     +133     
+ Misses       8548     8520      -28     
  Partials      923      923              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pavlis pavlis left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changes I see all look sensible. Grateful to have an AI to create the pytest functions,. I had no idea how to do that. What it creates seems reasonable.

@pavlis

pavlis commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator Author

Thought about merging this but maybe we need a rough documentation page first. On the other hand, putting this in the master will allow us to test it more easily and cleanly. That may be needed to write an effective user manual page anyway. What do you think @wangyinz ?

@pavlis

pavlis commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator Author

@wangyinz maybe we should use a simpler name for this module? We could use just "s3.py" and add other functionality to this module directly, but it would probably be better to keep this organization centered on usage of a client but shorten the name to something like "s3client.py". I'll let you decide as I'm not at all sure which is better or if it even matters.

@wangyinz

Copy link
Copy Markdown
Member

I think we could merge it and add the docs later after testing more on it. For the names, I don't have a strong preference. If had to pick, I guess s3client makes more sense.

(somehow github stop sending me notice on messages like these... sorry for ignoring it earlier)

@pavlis

pavlis commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

I think I will go ahead and change the module name. s3client makes more sense. If I figure out how to do that I'll do it and merge this pull request.

The old name of s3_worker_plugin for the module was misleading.   s3client is more descriptive because the module contains the fetch_s3_client function and not just the plugin code.
Fix a dumb mistake.   After I changed the module name I neglected to change the import line for the test code for that module.
@pavlis
pavlis merged commit 396b97f into master Oct 1, 2026
23 checks passed
@pavlis
pavlis deleted the add_s3_worker_plugin branch October 1, 2026 08:44
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.

2 participants