Skip to content

Server-side download URL generation#1438

Open
ponyisi wants to merge 5 commits into
developfrom
server-url-generation
Open

Server-side download URL generation#1438
ponyisi wants to merge 5 commits into
developfrom
server-url-generation

Conversation

@ponyisi
Copy link
Copy Markdown
Collaborator

@ponyisi ponyisi commented May 12, 2026

This is a first pass at generating download URLs for ServiceX output on the server side. The client can request a list of files in a transform, and URLs will be returned.

We have a hook here for doing this with other backends, e.g. xrootd-based ones. At some point we also probably want to cache results for some length of time.

@ponyisi ponyisi requested a review from MattShirley May 12, 2026 20:12
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.36%. Comparing base (042db4d) to head (6741de0).
⚠️ Report is 8 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1438      +/-   ##
===========================================
+ Coverage    88.91%   89.36%   +0.45%     
===========================================
  Files          103      104       +1     
  Lines         3679     3921     +242     
  Branches       454      494      +40     
===========================================
+ Hits          3271     3504     +233     
- Misses         333      342       +9     
  Partials        75       75              

☔ View full report in Codecov by Sentry.
📢 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.

@ponyisi ponyisi marked this pull request as draft May 12, 2026 20:33
@ponyisi ponyisi requested a review from BenGalewsky May 12, 2026 20:33
@ponyisi ponyisi force-pushed the server-url-generation branch from c75c2e9 to 31f7365 Compare May 13, 2026 21:21
@ponyisi ponyisi marked this pull request as ready for review May 13, 2026 21:30
Comment thread servicex_app/servicex_app/routes.py Outdated

class FileURLGenerator(ServiceXResource):
def __init__(self):
if True: # S3 backend
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this conditional block needed? How does S3 hook in to this?

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.

Sorry, this is admittedly unclear. Basically, this is a placeholder for an if-statement for a different storage backend (e.g. xrootd).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you set a backend class attribute that is typed as a literal and defaults to "s3"? Then it can be used for the two conditional blocks.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess it actually shouldn't be a class attribute but an instance attribute so it's defined when the object is created

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Actually thinking about this further, the backend is a global setting right (i.e. we don't support multiple backends)? Then the backend system should be defined in the helm values and can be used in the conditional here.

But also, when does the __init__ method fire for flask routes like this? I don't see it commonly being used for resources (and there's no super call). Is one object created when the route is setup, or is one object created for every request? If the latter, then this __init__ implementation would generate unnecessary boto objects. Instead, the client could be moved outside FileURLGenerator so one client is used consistently.

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.

Yes, the intention was that when we actually figure out how we want to signal the backend system being used via the helm chart, that the conditional would work based on that.

The __init__ is, as far as I know, only called when the routes are being set up. I think the call to the superclass constructor is essentially a noop but I'll add it.

@ponyisi ponyisi requested a review from MattShirley May 20, 2026 02:25
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