21#include "SALOME_LifeCycleCORBA.hxx"
23#include "SALOME_Launcher.hxx"
37#include "KernelBasis.hxx"
48 DEBTRACE(
"GuiExecutor::GuiExecutor");
54 _procRef = YACS_ORB::ProcExec::_nil();
69 KERNEL::getLauncherSA();
76 DEBTRACE(
"GuiExecutor::~GuiExecutor");
81 DEBTRACE(
"GuiExecutor::closeContext");
87 DEBTRACE(
"GuiExecutor::runDataflow " << initialize);
101 SALOME_LifeCycleCORBA lcc(&namingService);
102 ostringstream containerName;
103 containerName <<
"localhost/YACSContainer";
104 Engines::EngineComponent_var
comp = lcc.FindOrLoad_Component(containerName.str().c_str(),
"YACS" );
117 _procRef->resumeCurrentBreakPoint();
155 DEBTRACE(
"Runtime error: execution from the loaded state failed")
163 DEBTRACE(
"GuiExecutor::checkEndOfDataFlow");
168 DEBTRACE(
"Runtime error: connection lost on a running scheme");
174 DEBTRACE(
"Remote Execution Already running...");
188 DEBTRACE(
"GuiExecutor::killDataflow");
195 DEBTRACE(
"GuiExecutor::suspendDataflow");
202 DEBTRACE(
"GuiExecutor::resumeDataflow");
206 _procRef->resumeCurrentBreakPoint();
212 DEBTRACE(
"GuiExecutor::stopDataflow");
219 DEBTRACE(
"GuiExecutor::resetDataflow");
238 DEBTRACE(
"GuiExecutor::setStepByStepMode");
246 DEBTRACE(
"GuiExecutor::setContinueMode");
254 DEBTRACE(
"GuiExecutor::setBreakpointMode");
262 DEBTRACE(
"GuiExecutor::setStopOnError " << aMode);
266 _procRef->setStopOnError(aMode, (getenv(
"TEMP") +
string(
"\\dumpStateOnError_") + getenv(
"USER") +
string(
".xml")).c_str());
268 _procRef->setStopOnError(aMode, (
string(
"/tmp/dumpStateOnError_") + getenv(
"USER") +
string(
".xml")).c_str());
276 DEBTRACE(
"GuiExecutor::unsetStopOnError");
287 DEBTRACE(
"GuiExecutor::saveState " << xmlFile);
291 !(CORBA::is_nil(
_procRef)) && StartFinish ) {
292 if ( !
_procRef->saveState(xmlFile.c_str()) ) {
293 string what =
"Impossible to open file for writing: " + xmlFile;
301 DEBTRACE(
"GuiExecutor::setLoadStateFile " << xmlFile);
308 DEBTRACE(
"GuiExecutor::getCurrentExecMode");
320 DEBTRACE(
"GuiExecutor::getExecutorState");
322 return _procRef->getExecutorState();
332 DEBTRACE(
"GuiExecutor::setBreakpointList");
350 DEBTRACE(
"addBreakpoint " << breakpoint);
367 DEBTRACE(
"removeBreakpoint " << breakpoint);
374 DEBTRACE(
"GuiExecutor::setNextStepList");
378 listOfNextStep.length(nextStepList.size());
380 for (list<string>::iterator it = nextStepList.begin(); it != nextStepList.end(); ++it)
381 listOfNextStep[
i++] = (*it).c_str();
382 _procRef->setStepsToExecute(listOfNextStep);
388 DEBTRACE(
"GuiExecutor::registerStatusObservers");
391 DEBTRACE(
"Runtime error (yacsgui): Lost connection on YACS executor");
405 for ( std::list<Node*>::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ )
417 DEBTRACE(
"GuiExecutor::setEngineRef");
423 DEBTRACE(
"GuiExecutor::getErrorDetails");
427 return _procRef->getErrorDetails(engineId);
434 DEBTRACE(
"GuiExecutor::getErrorReport");
438 return _procRef->getErrorReport(engineId);
445 DEBTRACE(
"GuiExecutor::getContainerLog");
449 Engines::Container_var cont=
_engineRef->GetContainerRef();
450 CORBA::String_var logname = cont->logfilename();
453 std::string::size_type pos = msg.find(
":");
454 msg=msg.substr(pos+1);
461 DEBTRACE(
"GuiExecutor::getContainerLog(YACS::ENGINE::Node* node)");
466 CORBA::String_var logname =
_procRef->getContainerLog(engineId);
468 std::string::size_type pos = msg.find(
":");
469 msg=msg.substr(pos+1);
484 DEBTRACE(
"GuiExecutor::setInPortValue");
489 std::string nodeName;
495 std::string msg =
_procRef->setInPortValue(nodeName.c_str(), port->
getName().c_str(), value.c_str());
502 if (!yev)
return false;
511 if (
event ==
"executor")
513 int execState =
_procRef->getExecutorState();
514 list<string> nextSteps;
517 YACS_ORB::stringArray_var nstp =
_procRef->getTasksToLoad();
518 for (CORBA::ULong
i=0;
i<nstp->length();
i++)
519 nextSteps.push_back(nstp[
i].in());
536 if (
event ==
"progress") {
537 std::string progress =
_procRef->getNodeProgress(numid);
544 list<InputPort*>::iterator iti = inports.begin();
545 for ( ; iti != inports.end(); ++iti)
547 string val =
_procRef->getInPortValue(numid, (*iti)->getName().c_str());
548 DEBTRACE(
"node " << snode->
getName() <<
" inport " << (*iti)->getName()
549 <<
" value " << val);
556 list<OutputPort*>::iterator ito = outports.begin();
557 for ( ; ito != outports.end(); ++ito)
559 string val =
_procRef->getOutPortValue(numid, (*ito)->getName().c_str());
560 DEBTRACE(
"node " << snode->
getName() <<
" outport " << (*ito)->getName()
561 <<
" value " << val);
583 listOfBreakPoints[
i++] = (*it).c_str();
584 _procRef->setListOfBreakPoints(listOfBreakPoints);
595 for ( std::list<Node*>::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ ){
597 numid = (*it)->getNumId();
604 list<InputPort*>::iterator iti = inports.begin();
605 for ( ; iti != inports.end(); ++iti)
614 list<OutputPort*>::iterator ito = outports.begin();
615 for ( ; ito != outports.end(); ++ito)
629 if(jobState!=
"RUNNING")
void display(CORBA::Any *data)
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Base class for all composed nodes.
std::string getChildName(const Node *node) const
virtual std::list< Node * > getAllRecursiveConstituents()
Idem getAllRecursiveNodes, but this node is NOT included.
ComposedNode * getRootNode() const
std::string getName() const
Base class for all nodes.
virtual ComposedNode * getRootNode() const
const std::string & getName() const
virtual std::list< OutputPort * > getLocalOutputPorts() const =0
virtual std::list< InputPort * > getLocalInputPorts() const =0
virtual YACS::StatesForNode getEffectiveState() const
Return the node state in the context of its father.
int getNumId()
return node instance identifiant, unique for each node instance
Base class for all schema objects.
std::string getInPortValue(int nodeNumId, std::string portName)
std::string getOutPortValue(int nodeNumId, std::string portName)
YACS::StatesForNode getNodeState(int numId)
CORBA::ORB_ptr getOrb() const
QAction * _breakpointsModeAct
std::map< YACS::ENGINE::DataPort *, YACS::HMI::SubjectDataPort * > _mapOfSubjectDataPort
std::map< int, YACS::HMI::SubjectNode * > _mapOfExecSubjectNode
YACS::HMI::SubjectProc * getSubjectProc()
void setEngineRef(YACS_ORB::YACS_Gen_ptr ref)
std::string getErrorReport(YACS::ENGINE::Node *node)
std::string getContainerLog()
void startResumeDataflow(bool initialize=false)
YACS::ExecutorState updateSchema(std::string jobState)
YACS_ORB::ProcExec_var _procRef
virtual bool event(QEvent *e)
void registerStatusObservers()
bool checkEndOfDataflow(bool display=true)
void removeBreakpoint(std::string breakpoint)
void setLoadStateFile(std::string xmlFile)
void saveState(const std::string &xmlFile)
void addBreakpoint(std::string breakpoint)
YACS_ORB::Observer_var _observerRef
YACS::ENGINE::Proc * _proc
YACS::ExecutionMode _execMode
void setStopOnError(bool aMode)
std::string _loadStateFile
void setInPortValue(YACS::ENGINE::DataPort *port, std::string value)
YACS_ORB::YACS_Gen_var _engineRef
void setBreakpointList(std::list< std::string > breakpointList)
std::string getErrorDetails(YACS::ENGINE::Node *node)
YACS_ORB::executionMode getCurrentExecMode()
void setNextStepList(std::list< std::string > nextStepList)
std::list< std::string > _breakpointList
void SetImpl(GuiExecutor *impl)
void SetRemoteProc(YACS_ORB::ProcExec_ptr engineProc)
int getEngineId(int guiId)
std::map< int, int > _engineToGuiMap
static QtGuiContext * getQtCurrent()
YACS::HMI::GenericGui * getGMain()
void setExecValue(std::string value)
virtual std::string getName()
virtual void update(GuiEvent event, int type, Subject *son)
virtual YACS::ENGINE::Node * getNode()
virtual void update(GuiEvent event, int type, Subject *son)
virtual void setProgress(std::string newProgress)
std::pair< int, std::string > getYACSEvent() const
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()
sequence< string > stringArray
def ref(target, callback=None)