From 3e727711ed16e214359d01eb7101e973ff4b721f Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 23 Jul 2015 11:33:14 +0000
Subject: [PATCH] Make RunOnelabClient work also when Gmsh is a non-local
 ONELAB client (i.e., same as a Python subclient)

---
 Common/GmshMessage.cpp            | 10 ++++++++--
 Common/gmshLocalNetworkClient.cpp |  4 ++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index e883fded65..75f561b754 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -1281,8 +1281,14 @@ void Msg::ImportPhysicalsAsOnelabRegions()
 void Msg::RunOnelabClient(const std::string &name, const std::string &command)
 {
 #if defined(HAVE_ONELAB) && !defined(HAVE_ONELAB2)
-  gmshLocalNetworkClient client(name, command, "", true);
-  client.run();
+  onelab::remoteNetworkClient *c = dynamic_cast<onelab::remoteNetworkClient*>(_onelabClient);
+  if(c){
+    c->runSubClient(name, command);
+  }
+  else{
+    gmshLocalNetworkClient client(name, command, "", true);
+    client.run();
+  }
 #endif
 }
 
diff --git a/Common/gmshLocalNetworkClient.cpp b/Common/gmshLocalNetworkClient.cpp
index ef92f8471a..da5f06feb1 100644
--- a/Common/gmshLocalNetworkClient.cpp
+++ b/Common/gmshLocalNetworkClient.cpp
@@ -378,6 +378,10 @@ bool gmshLocalNetworkClient::receiveMessage(gmshLocalNetworkClient *master)
         new gmshLocalNetworkClient(clientName, command, "", true);
       onelabGmshServer *server = new onelabGmshServer(subClient);
       subClient->setPid(0);
+      onelab::string o(subClient->getName() + "/Action", "compute");
+      o.setVisible(false);
+      o.setNeverChanged(true);
+      onelab::server::instance()->set(o);
       int sock = server->LaunchClient();
       if(sock < 0){ // could not establish the connection: aborting
         server->Shutdown();
-- 
GitLab