Skip to content

Commit 3ed7743

Browse files
committed
FileFetcher will open TGrid connection if data from alien involved
1 parent 7f4f208 commit 3ed7743

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Common/Utils/src/FileFetcher.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <cstdlib>
2424
#include <locale>
2525
#include <boost/process.hpp>
26+
#include <TGrid.h>
2627

2728
using namespace o2::utils;
2829
using namespace std::chrono_literals;
@@ -42,6 +43,11 @@ FileFetcher::FileFetcher(const std::string& input, const std::string& selRegex,
4243
}
4344
mNoRemoteCopy = mCopyCmd == "no-copy";
4445

46+
if (mCopyCmd.find("alien") != std::string::npos) {
47+
if (!gGrid && !TGrid::Connect("alien://")) {
48+
LOG(ERROR) << "Copy command refers to alien but connection to Grid failed";
49+
}
50+
}
4551
// parse input list
4652
mCopyDirName = o2::utils::Str::create_unique_path(mCopyDirName, 8);
4753
processInput(input);
@@ -127,8 +133,15 @@ void FileFetcher::processDirectory(const std::string& name)
127133
//____________________________________________________________
128134
bool FileFetcher::addInputFile(const std::string& fname)
129135
{
136+
static bool alienErrorPrinted = false;
130137
if (mRemRegex && std::regex_match(fname, *mRemRegex.get())) {
131138
mInputFiles.emplace_back(FileRef{fname, mNoRemoteCopy ? fname : createCopyName(fname), true, false});
139+
if (fname.find("alien:") == 0) {
140+
if (!gGrid && !TGrid::Connect("alien://") && !alienErrorPrinted) {
141+
LOG(ERROR) << "File name starts with alien but connection to Grid failed";
142+
alienErrorPrinted = true;
143+
}
144+
}
132145
mNRemote++;
133146
} else if (fs::exists(fname)) { // local file
134147
mInputFiles.emplace_back(FileRef{fname, "", false, false});

0 commit comments

Comments
 (0)