Skip to content
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

Issue warnings when lazy-download is not used. #6476

Merged
merged 1 commit into from Nov 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Utilities/StorageFactory/interface/LocalFileSystem.h
Expand Up @@ -16,6 +16,7 @@ class LocalFileSystem

bool isLocalPath(const std::string &path);
std::string findCachePath(const std::vector<std::string> &paths, double minFreeSpace);
void issueWarning();

private:
int readFSTypes(void);
Expand All @@ -26,6 +27,7 @@ class LocalFileSystem

std::vector<FSInfo *> fs_;
std::vector<std::string> fstypes_;
std::string unusable_dir_warnings_;

// undefined, no semantics
LocalFileSystem(LocalFileSystem &);
Expand Down
34 changes: 34 additions & 0 deletions Utilities/StorageFactory/src/LocalFileSystem.cc
Expand Up @@ -423,6 +423,9 @@ LocalFileSystem::findCachePath(const std::vector<std::string> &paths,
{
struct stat s;
struct statfs sfs;
std::ostringstream warningst;
warningst << "Cannot use lazy-download because:\n";

for (size_t i = 0, e = paths.size(); i < e; ++i)
{
char *fullpath;
Expand Down Expand Up @@ -491,13 +494,44 @@ LocalFileSystem::findCachePath(const std::vector<std::string> &paths,
free(fullpath);
return result;
}
else if (m)
{
if (!m->local)
{
warningst << "- The mount " << fullpath << " is not local.\n";
}
else if (m->freespc < minFreeSpace)
{
warningst << " - The mount at " << fullpath << " has only " << m->freespc << " GB free; a minumum of " << minFreeSpace << " GB is required.\n";
}
else if (access(fullpath, W_OK))
{
warningst << " - The process has no permission to write into " << fullpath << "\n";
}
}

free(fullpath);
}

std::string warning_str = warningst.str();
if (warning_str.size())
{
warning_str = warning_str.substr(0, warning_str.size()-2);
}
unusable_dir_warnings_ = std::move(warning_str);

return std::string();
}

void
LocalFileSystem::issueWarning()
{
if (unusable_dir_warnings_.size())
{
edm::LogWarning("LocalFileSystem::findCachePath()") << unusable_dir_warnings_;
}
}

/** Initialise local file system status. */
LocalFileSystem::LocalFileSystem(void)
{
Expand Down
25 changes: 18 additions & 7 deletions Utilities/StorageFactory/src/StorageFactory.cc
Expand Up @@ -264,14 +264,25 @@ StorageFactory::wrapNonLocalFile (Storage *s,
int mode)
{
StorageFactory::CacheHint hint = cacheHint();
if (((hint == StorageFactory::CACHE_HINT_LAZY_DOWNLOAD) || (mode & IOFlags::OpenWrap))
&& ! (mode & IOFlags::OpenWrite)
&& ! m_tempdir.empty()
&& (path.empty() || ! m_lfs.isLocalPath(path)))
if ((hint == StorageFactory::CACHE_HINT_LAZY_DOWNLOAD) || (mode & IOFlags::OpenWrap))
{
if (accounting())
s = new StorageAccountProxy(proto, s);
s = new LocalCacheFile(s, m_tempdir);
if (mode & IOFlags::OpenWrite)
{
// For now, issue no warning - otherwise, we'd always warn on output files.
}
else if (m_tempdir.empty())
{
m_lfs.issueWarning();
}
else if (path.empty() || m_lfs.isLocalPath(path))
{
// For now, issue no warning - otherwise, we'd always warn on local input files.
}
else
{
if (accounting()) {s = new StorageAccountProxy(proto, s);}
s = new LocalCacheFile(s, m_tempdir);
}
}

return s;
Expand Down