Salome HOME
Write test file in a temporary directory
[modules/yacs.git] / src / evalyfx / YACSEvalResource.hxx
index 4eee308fc2cac600eb74374ea60dda9ce3cdc89a..a8cecab48f34a8bd51e32aababea20a679e2c267 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2012-2022  CEA/DEN, EDF R&D
 //
 // 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)
 
 #ifndef __YACSEVALRESOURCE_HXX__
@@ -26,6 +26,7 @@
 #include <map>
 #include <string>
 #include <vector>
+#include <list>
 
 #ifdef WIN32
 #define NOMINMAX
@@ -48,6 +49,7 @@ public:
   YACSEVALYFX_EXPORT void lock() { _isLocked=true; }
   YACSEVALYFX_EXPORT bool isLocked() const { return _isLocked; }
   YACSEVALYFX_EXPORT void checkNonLocked() const;
+  YACSEVALYFX_EXPORT void checkLocked() const;
 private:
   bool _isLocked;
 };
@@ -66,7 +68,8 @@ public:
   YACSEVALYFX_EXPORT std::string getValueOfKey(const char *key) const;
   YACSEVALYFX_EXPORT void setProperty(const std::string& key, const std::string &value);
   YACSEVALYFX_EXPORT void resetOverloadedProps() { checkNonLocked(); _overloadedPropertyMap.clear(); }
-  void apply();
+  YACSEVALYFX_EXPORT std::string getName() const;
+  void apply(bool interactiveStatus);
 public:
   YACSEvalVirtualYACSContainer();
   void set(YACSEvalResource *gf, YACS::ENGINE::Container *cont);
@@ -81,6 +84,7 @@ private:
   unsigned int getNbProcPerNode() const { return getValueOfKeyUInt(NB_PROC_PER_NODE_KEY); }
   unsigned int getValueOfKeyUInt(const char *key) const;
   std::map<std::string,std::string> listOfPropertiesInYACSContainer() const;
+  void checkNotNullYACSContainer() const;
 public:
   static const char CONTAINER_NAME_KEY[];
   static const char CPU_CLOCK_KEY[];
@@ -112,7 +116,7 @@ public:
   YACSEVALYFX_EXPORT void setWantedMachine(const std::string& machine);
   YACSEVALYFX_EXPORT std::size_t size() const { return _containers.size(); }
   YACSEVALYFX_EXPORT YACSEvalVirtualYACSContainer *at(std::size_t i) const;
-  YACSEVALYFX_EXPORT void apply();
+  YACSEVALYFX_EXPORT void apply(bool interactiveStatus);
 public:
   void fitWithCurrentCatalogAbs();
   void aggregate(ParserResourcesType& entry) const;
@@ -128,6 +132,35 @@ protected:
 
 class ResourcesManager_cpp;
 
+class YACSEvalParamsForCluster
+{
+public:
+  YACSEvalParamsForCluster():_exclusiveness(false),_nbOfProcs(1) { }
+  bool getExclusiveness() const { return _exclusiveness; }
+  YACSEVALYFX_EXPORT void setExclusiveness(bool newStatus);
+  std::string getRemoteWorkingDir() const { return _remoteWorkingDir; }
+  void setRemoteWorkingDir(const std::string& remoteWorkingDir) { _remoteWorkingDir=remoteWorkingDir; }
+  std::string getLocalWorkingDir() const { return _localWorkingDir; }
+  void setLocalWorkingDir(const std::string& localWorkingDir) { _localWorkingDir=localWorkingDir; }
+  std::string getWCKey() const { return _wcKey; }
+  void setWCKey(const std::string& wcKey) { _wcKey=wcKey; }
+  unsigned int getNbProcs() const { return _nbOfProcs; }
+  void setNbProcs(unsigned int nbProcs) { _nbOfProcs=nbProcs; }
+  void setMaxDuration(const std::string& maxDuration) { _maxDuration=maxDuration; }
+  std::string getMaxDuration() const { return _maxDuration; }
+  std::list<std::string>& getInFiles(){ return _in_files;}
+  const std::list<std::string>& getInFiles()const { return _in_files;}
+  YACSEVALYFX_EXPORT void checkConsistency() const;
+private:
+  bool _exclusiveness;
+  std::string _remoteWorkingDir;
+  std::string _localWorkingDir;
+  std::string _wcKey;
+  std::string _maxDuration;
+  unsigned int _nbOfProcs;
+  std::list<std::string> _in_files;
+};
+
 class YACSEvalListOfResources : public YACSEvalNonConstLocker
 {
 public:
@@ -139,8 +172,13 @@ public:
   YACSEVALYFX_EXPORT YACSEvalResource *at(std::size_t i) const;
   YACSEVALYFX_EXPORT bool isInteractive() const;
   YACSEVALYFX_EXPORT unsigned int getNumberOfProcsDeclared() const;
+  YACSEVALYFX_EXPORT void checkOKForRun() const;
+  YACSEVALYFX_EXPORT YACSEvalParamsForCluster& getAddParamsForCluster() { return _paramsInCaseOfCluster; }
+  YACSEVALYFX_EXPORT const YACSEvalParamsForCluster& getAddParamsForCluster() const { return _paramsInCaseOfCluster; }
   void apply();
   YACSEVALYFX_EXPORT ~YACSEvalListOfResources();
+public:// info only
+  YACSEVALYFX_EXPORT bool isMachineInteractive(const std::string& machine) const;
 public:
   ResourcesManager_cpp *getCatalogEntry() const { return _rm; }
   YACS::ENGINE::DeploymentTree *getDeploymentTree() const { return _dt; }
@@ -156,6 +194,7 @@ private:
   int _maxLevOfPara;
   std::vector<YACSEvalResource *> _resources;
   YACS::ENGINE::DeploymentTree *_dt;
+  YACSEvalParamsForCluster _paramsInCaseOfCluster;
 };
 
 #endif