Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
cac833c9
Commit
cac833c9
authored
12 years ago
by
Francois Henrotte
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
4156ea56
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
contrib/onelab/OnelabClients.cpp
+17
-48
17 additions, 48 deletions
contrib/onelab/OnelabClients.cpp
contrib/onelab/OnelabClients.h
+1
-1
1 addition, 1 deletion
contrib/onelab/OnelabClients.h
contrib/onelab/OnelabParser.cpp
+3
-13
3 additions, 13 deletions
contrib/onelab/OnelabParser.cpp
with
21 additions
and
62 deletions
contrib/onelab/OnelabClients.cpp
+
17
−
48
View file @
cac833c9
...
...
@@ -18,40 +18,6 @@ class onelabMetaModelServer : public GmshServer{
:
GmshServer
(),
_client
(
client
)
{}
~
onelabMetaModelServer
(){}
// int NonBlockingSystemCall(const char *command)
// {
// #if defined(WIN32)
// STARTUPINFO suInfo;
// PROCESS_INFORMATION prInfo;
// memset(&suInfo, 0, sizeof(suInfo));
// suInfo.cb = sizeof(suInfo);
// std::string cmd(command);
// OLMsg::Info("Calling <%s>", cmd.c_str());
// // DETACHED_PROCESS removes the console (useful if the program to launch is
// // a console-mode exe)
// CreateProcess(NULL,(char *)cmd.c_str(), NULL, NULL, FALSE,
// NORMAL_PRIORITY_CLASS|DETACHED_PROCESS, NULL, NULL,
// &suInfo, &prInfo);
// return 0;
// #else
// if(!system(NULL)) {
// OLMsg::Error("Could not find /bin/sh: aborting system call");
// return 1;
// }
// std::string cmd(command);
// size_t pos;
// if((pos=cmd.find("incomp_ssh ")) != std::string::npos){
// cmd.assign(cmd.substr(pos+7)); // remove "incomp_"
// cmd.append(" & '");
// }
// else
// cmd.append(" & ");
// OLMsg::Info("Calling <%s>", cmd.c_str());
// return system(cmd.c_str());
// #endif
// }// non blocking
int
NonBlockingSystemCall
(
const
char
*
str
){
return
SystemCall
(
str
);
}
int
NonBlockingWait
(
int
socket
,
double
waitint
,
double
timeout
)
{
...
...
@@ -397,15 +363,11 @@ const bool localSolverClient::getList(const std::string type, std::vector<std::s
return
false
;
}
/*
si cmd est un path, vérifier la présence du fichier
sinon faire un which (n'existe pas sous WIN)
*/
bool
localSolverClient
::
checkCommandLine
(){
bool
success
=
true
;
OLMsg
::
Info
(
"Check command line <%s> for client <%s>"
,
getCommandLine
().
c_str
(),
getName
().
c_str
());
if
(
!
isActive
())
return
true
;
if
(
!
isActive
())
return
success
;
if
(
getCommandLine
().
empty
()){
if
(
OLMsg
::
hasGmsh
)
{
...
...
@@ -421,36 +383,41 @@ bool localSolverClient::checkCommandLine(){
}
}
else
{
if
(
isNative
()){
if
(
isNative
()){
// check done by initializing of the client
setAction
(
"initialize"
);
if
(
!
run
()){
// initializes native clients, false otherwise
OLMsg
::
Error
(
"Invalid commandline <%s> for client <%s>"
,
FixExecPath
(
getCommandLine
()).
c_str
(),
getName
().
c_str
());
return
false
;
success
=
false
;
}
}
else
{
else
{
// check whether the executable exists as a file
std
::
string
cmd
,
commandLine
;
char
cbuf
[
1024
];
FILE
*
fp
;
commandLine
.
assign
(
FixExecPath
(
getCommandLine
()));
#if !defined(WIN32)
// resolve a possible link or alias
cmd
.
assign
(
"which "
+
commandLine
);
fp
=
POPEN
(
cmd
.
c_str
(),
"r"
);
if
(
fgets
(
cbuf
,
1024
,
fp
)
==
NULL
){
OLMsg
::
Error
(
"The executable <%s> does not exist"
,
commandLine
.
c_str
());
PCLOSE
(
fp
);
return
false
;
success
=
false
;
}
else
commandLine
.
assign
(
cbuf
);
commandLine
.
assign
(
sanitizeString
(
cbuf
,
"
\n
"
)
);
PCLOSE
(
fp
);
#endif
return
checkIfPresent
(
sanitizeString
(
commandLine
,
"
\n
"
)
);
success
=
checkIfPresent
(
commandLine
);
}
}
return
true
;
if
(
success
)
OLMsg
::
SetOnelabString
(
getName
()
+
"/CommandLine"
,
getCommandLine
(),
false
);
else
setCommandLine
(
""
);
return
success
;
}
bool
localSolverClient
::
buildRmCommand
(
std
::
string
&
cmd
){
...
...
@@ -1051,6 +1018,7 @@ void RemoteEncapsulatedClient::compute(){
// ONELAB additional TOOLS (no access to server in tools)
// options for 'onelab_client'
/*
int getOptions(int argc, char *argv[], parseMode &todo, std::string &commandLine, std::string &caseName, std::string &clientName, std::string &sockName){
commandLine=argv[0];
...
...
@@ -1097,6 +1065,7 @@ int getOptions(int argc, char *argv[], parseMode &todo, std::string &commandLine
}
return(1);
}
*/
std
::
string
itoa
(
const
int
i
){
std
::
ostringstream
tmp
;
...
...
This diff is collapsed.
Click to expand it.
contrib/onelab/OnelabClients.h
+
1
−
1
View file @
cac833c9
...
...
@@ -33,7 +33,7 @@ static std::string whichCmd("which ");
#endif
// TOOLS
int
getOptions
(
int
argc
,
char
*
argv
[],
parseMode
&
todo
,
std
::
string
&
commandLine
,
std
::
string
&
caseName
,
std
::
string
&
clientName
,
std
::
string
&
sockName
);
//
int getOptions(int argc, char *argv[], parseMode &todo, std::string &commandLine, std::string &caseName, std::string &clientName, std::string &sockName);
std
::
string
itoa
(
const
int
i
);
std
::
string
ftoa
(
const
double
x
);
bool
checkIfPresent
(
std
::
string
fileName
);
...
...
This diff is collapsed.
Click to expand it.
contrib/onelab/OnelabParser.cpp
+
3
−
13
View file @
cac833c9
...
...
@@ -1345,7 +1345,7 @@ void MetaModel::client_sentence(const std::string &name,
onelab
::
string
str
;
str
.
setName
(
name
+
"/CommandLine"
);
str
.
setKind
(
"file"
);
str
.
setVisible
(
cmdl
.
empty
());
//
str.setVisible(cmdl.empty());
str
.
setAttribute
(
"Highlight"
,
"Ivory"
);
set
(
str
);
}
...
...
@@ -1483,7 +1483,7 @@ void MetaModel::client_sentence(const std::string &name,
}
}
}
else
if
(
isTodo
(
COMPUTE
)){
else
if
(
isTodo
(
COMPUTE
)
&&
!
OLMsg
::
GetErrorCount
()
){
std
::
vector
<
std
::
string
>
choices
;
for
(
unsigned
int
i
=
0
;
i
<
arguments
.
size
();
i
++
){
std
::
string
str
=
resolveGetVal
(
arguments
[
i
]);
...
...
@@ -1498,20 +1498,10 @@ void MetaModel::client_sentence(const std::string &name,
OLMsg
::
Error
(
"Wrong number of arguments <%d> for <%s>"
,
arguments
.
size
(),
action
.
c_str
());
}
// else if(!action.compare("check")){
// localSolverClient *c;
// if((c=findClientByName(name))){
// c->checkCommandLine();
// c->analyze();
// }
// else
// OLMsg::Error("Unknown client <%s>", name.c_str());
// }
else
if
(
!
action
.
compare
(
"alwaysCompute"
)){
if
(
isTodo
(
ANALYZE
)){
localSolverClient
*
c
;
if
((
c
=
findClientByName
(
name
))){
//c->checkCommandLine();
c
->
compute
();
onelab
::
server
::
instance
()
->
setChanged
(
false
,
c
->
getName
());
}
...
...
@@ -1520,7 +1510,7 @@ void MetaModel::client_sentence(const std::string &name,
}
}
else
if
(
!
action
.
compare
(
"merge"
)){
if
(
isTodo
(
COMPUTE
)){
if
(
isTodo
(
COMPUTE
)
&&
!
OLMsg
::
GetErrorCount
()
){
std
::
vector
<
std
::
string
>
choices
;
for
(
unsigned
int
i
=
0
;
i
<
arguments
.
size
();
i
++
){
choices
.
push_back
(
resolveGetVal
(
arguments
[
i
]));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment