Salome HOME
updated copyright message
[modules/yacs.git] / src / evalyfx / YACSEvalResource.cxx
index 4996f266b62ad97d970ed0ada9412d625b710082..92b8b20d132c61bd3c98ad8d2e7d22283fdd98b2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2012-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -15,7 +15,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-// 
+//
 // Author : Anthony Geay (EDF R&D)
 
 #include "YACSEvalResource.hxx"
@@ -337,6 +337,8 @@ void YACSEvalParamsForCluster::checkConsistency() const
 {
   if(_remoteWorkingDir.empty())
     throw YACS::Exception("YACSEvalParamsForCluster::checkConsistency : remote work dir is not set !");
+  if(_localWorkingDir.empty())
+    throw YACS::Exception("YACSEvalParamsForCluster::checkConsistency : local work dir is not set !");
   if(_wcKey.empty())
     throw YACS::Exception("YACSEvalParamsForCluster::checkConsistency : WC key is not set !");
   if(_nbOfProcs==0)
@@ -403,7 +405,6 @@ YACSEvalResource *YACSEvalListOfResources::at(std::size_t i) const
 
 bool YACSEvalListOfResources::isInteractive() const
 {
-  const MapOfParserResourcesType& zeList(_rm->GetList());
   std::vector<std::string> allMachines(getAllChosenMachines());
   if(allMachines.empty())
     return true;
@@ -411,14 +412,7 @@ bool YACSEvalListOfResources::isInteractive() const
   std::vector<bool> status(sz);
   for(std::vector<std::string>::const_iterator it=allMachines.begin();it!=allMachines.end();it++,ii++)
     {
-      std::map<std::string, ParserResourcesType>::const_iterator it2(zeList.find(*it));
-      if(it2==zeList.end())
-        {
-          std::ostringstream oss; oss << "YACSEvalListOfResources::isInteractive : presence of non existing \"" << *it << "\" !";
-          throw YACS::Exception(oss.str());
-        }
-      const ParserResourcesType& elt((*it2).second);
-      status[ii]=(elt.Batch==none);
+      status[ii]=isMachineInteractive(*it);
     }
   std::size_t trueRet(std::count(status.begin(),status.end(),true)),falseRet(std::count(status.begin(),status.end(),false));
   if(trueRet==sz && falseRet==0)
@@ -462,6 +456,19 @@ YACSEvalListOfResources::~YACSEvalListOfResources()
     delete *it;
 }
 
+bool YACSEvalListOfResources::isMachineInteractive(const std::string& machine) const
+{
+  const MapOfParserResourcesType& zeList(_rm->GetList());
+  std::map<std::string, ParserResourcesType>::const_iterator it2(zeList.find(machine));
+  if(it2==zeList.end())
+    {
+      std::ostringstream oss; oss << "YACSEvalListOfResources::isMachineInteractive : no such machine with name \"" << machine << "\" !";
+      throw YACS::Exception(oss.str());
+    }
+  const ParserResourcesType& elt((*it2).second);
+  return (elt.Batch==none);
+}
+
 class EffectiveComparator
 {
 public: