X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fevalyfx%2FYACSEvalYFXPattern.hxx;h=d67e3ca8212fb5d23a1d6627f30a904f538c7755;hb=49b47d59a19c61558557bf82d10b56264afa7af0;hp=110f22b9017123ab20b6052db658443eb0308dda;hpb=f7d267d3f761477904935647ce34fa54339286e0;p=modules%2Fyacs.git diff --git a/src/evalyfx/YACSEvalYFXPattern.hxx b/src/evalyfx/YACSEvalYFXPattern.hxx index 110f22b90..d67e3ca82 100644 --- a/src/evalyfx/YACSEvalYFXPattern.hxx +++ b/src/evalyfx/YACSEvalYFXPattern.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2012-2015 CEA/DEN, EDF R&D +// Copyright (C) 2012-2016 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 __YACSEVALYFXPATTERN_HXX__ @@ -38,11 +38,14 @@ namespace YACS class ForEachLoop; class ComposedNode; class InputPyPort; + class SequenceAny; } } class YACSEvalYFX; +class YACSEvalSession; class YACSEvalObserver; +class YACSEvalExecParams; class YACSEvalListOfResources; class ResourcesManager_cpp; class YACSEvalYFXRunOnlyPatternInternalObserver; @@ -54,6 +57,8 @@ public: std::vector< YACSEvalInputPort *> getFreeInputPorts() const; std::vector< YACSEvalOutputPort *> getFreeOutputPorts() const; static YACSEvalYFXPattern *FindPatternFrom(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme); + void setParallelizeStatus(bool newVal) { _parallelizeStatus=newVal; } + bool getParallelizeStatus() const { return _parallelizeStatus; } bool isAlreadyComputedResources() const; void checkNonAlreadyComputedResources() const; void checkAlreadyComputedResources() const; @@ -63,6 +68,7 @@ public: void registerObserver(YACSEvalObserver *observer); YACSEvalObserver *getObserver() const { return _observer; } YACSEvalYFX *getBoss() const { return _boss; } + YACSEvalListOfResources *getResourcesInternal() const { return _res; } virtual void setOutPortsOfInterestForEvaluation(const std::vector& outputs) = 0; virtual void resetOutputsOfInterest() = 0; virtual void generateGraph() = 0; @@ -72,23 +78,27 @@ public: virtual bool isLocked() const = 0; virtual YACSEvalListOfResources *giveResources() = 0; virtual YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const = 0; + virtual std::string getErrorDetailsInCaseOfFailure() const = 0; + virtual std::string getStatusOfRunStr() const = 0; virtual std::vector getResults() const = 0; - virtual void emitStart() const = 0; -public: - static const char DFT_PROC_NAME[]; + virtual std::vector getResultsInCaseOfFailure(std::vector& passedIds) const = 0; + virtual bool go(const YACSEvalExecParams& params, YACSEvalSession *session) const = 0; +public://for _gen + const std::vector< YACSEvalInputPort >& getInputs() const { return _inputs; } + static YACS::ENGINE::TypeCode *CreateSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType); + static YACSEvalSeqAny *BuildValueInPort(YACS::ENGINE::InputPyPort *port); protected: YACSEvalYFXPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme); - YACS::ENGINE::TypeCode *createSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType); void setResources(YACSEvalListOfResources *res); void resetResources(); - YACSEvalListOfResources *getResourcesInternal() const { return _res; } ResourcesManager_cpp *getCatalogInAppli() const { return _rm; } - static YACSEvalSeqAny *BuildValueInPort(YACS::ENGINE::InputPyPort *port); + static YACSEvalSeqAny *BuildValueFromEngineFrmt(YACS::ENGINE::SequenceAny *data); private: void cleanScheme(); private: YACSEvalYFX *_boss; bool _ownScheme; + bool _parallelizeStatus; YACS::ENGINE::Proc *_scheme; ResourcesManager_cpp *_rm; YACSEvalListOfResources *_res; @@ -96,8 +106,15 @@ private: protected: std::vector< YACSEvalInputPort > _inputs; std::vector< YACSEvalOutputPort > _outputs; +public: + static const char ST_OK[]; // execution goes to the end without any trouble -> results can be exploited without any problem with getResults and getResultsInCaseOfFailure. + static const char ST_FAILED[]; // execution has reached some failed evaluation (normal errors due to incapacity of one node to evaluate) -> results can be exploited without any problem with getResultsInCaseOfFailure + static const char ST_ERROR[]; // execution has encountered hard errors (SIGSEGV in a server, internal error in YACS) -> results can be exploited with getResultsInCaseOfFailure but you can't make hypothesis for other ids not in passedIds. + static const std::size_t MAX_LGTH_OF_INP_DUMP; }; +class YACSEvalYFXGraphGen; + class YACSEvalYFXRunOnlyPattern : public YACSEvalYFXPattern { public: @@ -112,22 +129,78 @@ public: bool isLocked() const; YACSEvalListOfResources *giveResources(); YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const; + std::string getErrorDetailsInCaseOfFailure() const; + std::string getStatusOfRunStr() const; std::vector getResults() const; - void emitStart() const; + std::vector getResultsInCaseOfFailure(std::vector& passedIds) const; + bool go(const YACSEvalExecParams& params, YACSEvalSession *session) const; // - YACS::ENGINE::ForEachLoop *getUndergroundForEach() const { return _FEInGeneratedGraph; } + YACS::ENGINE::ForEachLoop *getUndergroundForEach() const; static bool IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode); -public: - static const char GATHER_NODE_NAME[]; private: + void emitStart() const; void buildInputPorts(); void buildOutputPorts(); + YACSEvalYFXGraphGen *getGenerator() const; +public://for _gen + const std::vector& getOutputsOfInterest() const { return _outputsOfInterest; } + YACS::ENGINE::ComposedNode *getRunNode() const { return _runNode; } private: + bool _lockedStatus; YACS::ENGINE::ComposedNode *_runNode; std::vector _outputsOfInterest; + YACSEvalYFXGraphGen *_gen; + YACSEvalYFXRunOnlyPatternInternalObserver *_obs; +}; + +class YACSEvalYFXGraphGen +{ +protected: + YACSEvalYFXGraphGen(YACSEvalYFXRunOnlyPattern *boss); + YACSEvalYFXRunOnlyPattern *getBoss() const { return _boss; } +public: + virtual ~YACSEvalYFXGraphGen(); + virtual void generateGraph() = 0; + virtual bool go(const YACSEvalExecParams& params, YACSEvalSession *session) const = 0; + virtual std::vector getResults() const = 0; + bool isLocked() const; + int assignNbOfBranches(); + void resetGeneratedGraph(); + YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const { return _generatedGraph; } + YACS::ENGINE::ForEachLoop *getUndergroundForEach() const { return _FEInGeneratedGraph; } +private: + YACSEvalYFXRunOnlyPattern *_boss; +protected: YACS::ENGINE::Proc *_generatedGraph; YACS::ENGINE::ForEachLoop *_FEInGeneratedGraph; - YACSEvalYFXRunOnlyPatternInternalObserver *_obs; +public: + static const char DFT_PROC_NAME[]; + static const char FIRST_FE_SUBNODE_NAME[]; + static const char GATHER_NODE_NAME[]; +}; + +class YACSEvalYFXGraphGenInteractive : public YACSEvalYFXGraphGen +{ +public: + YACSEvalYFXGraphGenInteractive(YACSEvalYFXRunOnlyPattern *boss):YACSEvalYFXGraphGen(boss) { } + void generateGraph(); + bool go(const YACSEvalExecParams& params, YACSEvalSession *session) const; + std::vector getResults() const; +}; + +class YACSEvalYFXGraphGenCluster : public YACSEvalYFXGraphGen +{ +public: + YACSEvalYFXGraphGenCluster(YACSEvalYFXRunOnlyPattern *boss):YACSEvalYFXGraphGen(boss) { } + void generateGraph(); + bool go(const YACSEvalExecParams& params, YACSEvalSession *session) const; + std::vector getResults() const; +private: + std::string _locSchemaFile; + std::string _jobName; + mutable int _jobid; + mutable std::string _errors; + mutable std::vector< std::vector > _res; }; #endif