-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add the option for a sentinel file for the origin #1003
Conversation
This PR added an additional field |
Oh! Should this be SentinelFile or SentinelLocation? The latter may be more reasonable for a S3 backend. |
@haoming29 I will patch on the ui change after the name is decided. |
Trying to understand the intension for S3 here. Will the user provide a path to the sentinel file for either S3 and POSIX? Or only a file name? The latter is what I assumed in this PR and I actually checked and require that the parameter does not contain a directory. |
I think you'll have to think about a good way to incorporate the origin's configured storage type. In the case of an S3 sentinel object, we might require that for a given Of course, if you want to check that an authenticated S3 object exists before starting xrootd, you'll also need to handle creating the signed AWSv4 URLs with the credentials Pelican knows about, and that's not a small task. You could either write all of the functionality to do this in Pelican (and wind up duplicating half the magic of the S3 plugin) or you could use the AWS SDK and add a lot of bloat... Maybe the approach is to start XRootD first and immediately try to pull the file/object. If the origin can't get something from itself, we assume the sentinel doesn't exist. |
@jhiemstrawisc That clarifies things a lot! I like your suggestion as to start xrootd first then pull a file and see if we can make it for S3 backend. For POSIX backend, I think it's easy enough to |
Is the parameter naming finalized here yet? |
Let's do |
e9ad911
to
7b7ddf9
Compare
As @jhiemstrawisc and I discussed. The scope of this PR is to only add the sentinel file as the option for a POSIX backend, given the upcoming large changes in S3 configurations. We will come back and revisit this for S3 once that's done. |
@haoming29 In testing the UI I hit the following error that killed the web app.
Notably I used garbage in the config values so not sure if this is really a "bug"
|
@CannonLock Do you have a file |
@haoming29 No, more so just bummed this took out the web app. Would be nice if we could keep the webapp running through this type of thing so they could continue to edit the config file/read the logs right in the webapp... Just a idea for the future. |
Good point. This would be a corner case where we expect user to have a test file in place before running Pelican. If they decided to change the test file on the go, they should be prepared to have the new test file before making the change. It would be nice if we can have a tooltip/description to emphasize this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small nitpicks on coding style. After that, I think this is pre-approved and feel free to merge!
server_utils/origin.go
Outdated
if export.SentinelLocation != "" { | ||
sentinelPath := path.Clean(export.SentinelLocation) | ||
if path.Base(sentinelPath) != sentinelPath { | ||
return false, fmt.Errorf("invalid SentinelLocation path for StoragePrefix %s, file must not contain a directory. Got %s", export.StoragePrefix, export.SentinelLocation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return false, fmt.Errorf("invalid SentinelLocation path for StoragePrefix %s, file must not contain a directory. Got %s", export.StoragePrefix, export.SentinelLocation) | |
return false, errors.Errorf("invalid SentinelLocation path for StoragePrefix %s, file must not contain a directory. Got %s", export.StoragePrefix, export.SentinelLocation) |
server_utils/origin.go
Outdated
fullPath := filepath.Join(export.StoragePrefix, sentinelPath) | ||
_, err := os.Stat(fullPath) | ||
if err != nil { | ||
return false, errors.Wrap(err, fmt.Sprintf("fail to open SentinelLocation %s for StoragePrefix %s. Directory check failed", export.SentinelLocation, export.StoragePrefix)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return false, errors.Wrap(err, fmt.Sprintf("fail to open SentinelLocation %s for StoragePrefix %s. Directory check failed", export.SentinelLocation, export.StoragePrefix)) | |
return false, errors.Wrapf(err, "fail to open SentinelLocation %s for StoragePrefix %s. Directory check failed", export.SentinelLocation, export.StoragePrefix) |
Closes #995