Skip to content
Snippets Groups Projects
Commit f8ff53b7 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better OnelabRun

parent 385025d9
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#if defined(HAVE_ONELAB) #if defined(HAVE_ONELAB)
#include "onelab.h" #include "onelab.h"
#include "gmshLocalNetworkClient.h"
#endif #endif
#if defined(HAVE_PETSC) #if defined(HAVE_PETSC)
...@@ -862,6 +863,7 @@ static void _setStandardOptions(onelab::parameter *p, ...@@ -862,6 +863,7 @@ static void _setStandardOptions(onelab::parameter *p,
// numbers // numbers
if(fopt.count("Visible")) p->setVisible(fopt["Visible"][0] ? true : false); if(fopt.count("Visible")) p->setVisible(fopt["Visible"][0] ? true : false);
if(fopt.count("ReadOnly")) p->setReadOnly(fopt["ReadOnly"][0] ? true : false); if(fopt.count("ReadOnly")) p->setReadOnly(fopt["ReadOnly"][0] ? true : false);
if(fopt.count("NeverChanged")) p->setNeverChanged(fopt["NeverChanged"][0] ? true : false);
if(fopt.count("ReadOnlyRange")) if(fopt.count("ReadOnlyRange"))
p->setAttribute("ReadOnlyRange", fopt["ReadOnlyRange"][0] ? "1" : "0"); p->setAttribute("ReadOnlyRange", fopt["ReadOnlyRange"][0] ? "1" : "0");
if(fopt.count("AutoCheck")) if(fopt.count("AutoCheck"))
...@@ -1083,19 +1085,32 @@ void Msg::ImportPhysicalsAsOnelabRegions() ...@@ -1083,19 +1085,32 @@ void Msg::ImportPhysicalsAsOnelabRegions()
#endif #endif
} }
void Msg::RunOnelabClient(const std::string &name) void Msg::RunOnelabClient(const std::string &name, const std::string &command)
{ {
#if defined(HAVE_ONELAB) #if defined(HAVE_ONELAB)
onelab::server::citer it = onelab::server::instance()->findClient(name); onelab::server::citer it = onelab::server::instance()->findClient(name);
if(it == onelab::server::instance()->lastClient()){ onelab::client *client = 0;
Msg::Error("Unknown ONELAB client `%s'", name.c_str()); if(it != onelab::server::instance()->lastClient()){
return; client = it->second;
}
else{
if(command.empty()){
Msg::Error("Unknown ONELAB client `%s'", name.c_str());
return;
}
onelab::string o(name + "/Action", "initialize");
o.setVisible(false);
o.setNeverChanged(true);
onelab::server::instance()->set(o);
Msg::Info("Creating new ONELAB client `%s' (%s)", name.c_str(), command.c_str());
client = new gmshLocalNetworkClient(name, command);
client->run();
} }
onelab::string o(name + "/Action", "compute"); onelab::string o(name + "/Action", "compute");
o.setVisible(false); o.setVisible(false);
o.setNeverChanged(true); o.setNeverChanged(true);
onelab::server::instance()->set(o); onelab::server::instance()->set(o);
it->second->run(); client->run();
#endif #endif
} }
......
...@@ -113,7 +113,7 @@ class Msg { ...@@ -113,7 +113,7 @@ class Msg {
std::map<std::string, std::vector<double> > &fopt, std::map<std::string, std::vector<double> > &fopt,
std::map<std::string, std::vector<std::string> > &copt); std::map<std::string, std::vector<std::string> > &copt);
static void UndefineOnelabParameter(const std::string &name); static void UndefineOnelabParameter(const std::string &name);
static void RunOnelabClient(const std::string &name); static void RunOnelabClient(const std::string &name, const std::string &command="");
static void ImportPhysicalsAsOnelabRegions(); static void ImportPhysicalsAsOnelabRegions();
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment