Skip to content

[io] Silently fallback if full xroot path is not found on EOS#16173

Merged
vepadulano merged 1 commit into
root-project:masterfrom
vepadulano:tfile-open-eos-fallback
Jan 29, 2025
Merged

[io] Silently fallback if full xroot path is not found on EOS#16173
vepadulano merged 1 commit into
root-project:masterfrom
vepadulano:tfile-open-eos-fallback

Conversation

@vepadulano

Copy link
Copy Markdown
Member

Sometimes the getxattr call returns a valid string, but the string is incomplete. Namely, part of the full URL to the file on EOS is missing (usually the filename itself). Workaround by checking for the presence of the filename in the xurl string and in case it is not present, avoid calling TFile::Open.

@vepadulano
vepadulano requested a review from hahnjo August 6, 2024 07:28
@vepadulano
vepadulano requested a review from pcanal as a code owner August 6, 2024 07:28
@github-actions

github-actions Bot commented Aug 6, 2024

Copy link
Copy Markdown

Test Results

    18 files      18 suites   4d 20h 18m 12s ⏱️
 2 683 tests  2 682 ✅ 0 💤 1 ❌
46 598 runs  46 597 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit bcffa30.

♻️ This comment has been updated with latest results.

@hahnjo hahnjo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LG iff the URL really contains the full path. If not, maybe it's enough that the last part has the right filename?

@vepadulano

Copy link
Copy Markdown
Member Author

Sorry for coming back to this after a long time. I have rebased and tested on lxplus. Indeed GetFile() returns just the file name as passed to TFile::Open, so we want to check that the string ends with the file name rather than doing the full comparison.

root [0] auto f1 = TFile::Open("/eos/root/h1/dstarmb.root");
TFile::Open:
	fileurl.GetFile()=/eos/root/h1/dstarmb.root
	xurl=root://eospublic.cern.ch//eos/root-eos/h1/dstarmb.root
root [1] auto f2 = TFile::Open("myfile.root", "recreate");
TFile::Open:
	fileurl.GetFile()=myfile.root
	xurl=root://eoshome-v.cern.ch//eos/user/v/vpadulan/myfile.root

@vepadulano
vepadulano force-pushed the tfile-open-eos-fallback branch from 540f742 to 24c7c48 Compare January 23, 2025 12:27
@vepadulano
vepadulano requested a review from hahnjo January 23, 2025 12:27
@vepadulano
vepadulano force-pushed the tfile-open-eos-fallback branch from 24c7c48 to 894ff54 Compare January 23, 2025 12:36
@pcanal
pcanal requested review from amadio and removed request for hahnjo January 23, 2025 13:16

@amadio amadio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. When EOS fails, usually it just returns the URL of the MGM (the namespace server), without a path. So this should be good to skip the cases in which the file has just been created as intended.

@amadio

amadio commented Jan 24, 2025

Copy link
Copy Markdown
Member

Sorry for coming back to this after a long time. I have rebased and tested on lxplus. Indeed GetFile() returns just the file name as passed to TFile::Open, so we want to check that the string ends with the file name rather than doing the full comparison.

root [0] auto f1 = TFile::Open("/eos/root/h1/dstarmb.root");
TFile::Open:
	fileurl.GetFile()=/eos/root/h1/dstarmb.root
	xurl=root://eospublic.cern.ch//eos/root-eos/h1/dstarmb.root
root [1] auto f2 = TFile::Open("myfile.root", "recreate");
TFile::Open:
	fileurl.GetFile()=myfile.root
	xurl=root://eoshome-v.cern.ch//eos/user/v/vpadulan/myfile.root

Note, however, that in your first case, because EOS is mounted not onto /eos/root-eos as it is on the server, but /eos/root, the comparison will fail. Normally the paths would be the same, but it might be better to use basename on the fileurl and just check that the name of the file is at the end of the URL, as suggested by Vincenzo.

Sometimes the `getxattr` call returns a valid string, but the string is
incomplete. Namely, part of the full URL to the file on EOS is missing (usually
the filename itself). Workaround by checking that the xurl string ends with the
filename and in case it is not present, avoid calling TFile::Open.

Co-authored-by: Jonas Hahnfeld <jonas.hahnfeld@cern.ch>
@vepadulano
vepadulano force-pushed the tfile-open-eos-fallback branch from 894ff54 to bcffa30 Compare January 28, 2025 11:03
@vepadulano
vepadulano merged commit c122dbd into root-project:master Jan 29, 2025
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.

3 participants