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
89261635
Commit
89261635
authored
11 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
cleanup ; run -> runSubClient
parent
9b600ed9
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/onelab/python/onelab.py
+20
-16
20 additions, 16 deletions
contrib/onelab/python/onelab.py
with
20 additions
and
16 deletions
contrib/onelab/python/onelab.py
+
20
−
16
View file @
89261635
...
...
@@ -52,7 +52,8 @@ class _parameter() :
]
_members
=
{
'
string
'
:
_membersbase
+
[
(
'
value
'
,
'
string
'
,
''
),
(
'
kind
'
,
'
string
'
,
'
generic
'
),
(
'
choices
'
,
(
'
list
'
,
'
string
'
),
[])
(
'
value
'
,
'
string
'
,
''
),
(
'
kind
'
,
'
string
'
,
'
generic
'
),
(
'
choices
'
,
(
'
list
'
,
'
string
'
),
[])
],
'
number
'
:
_membersbase
+
[
(
'
value
'
,
'
float
'
,
0
),
...
...
@@ -151,7 +152,7 @@ class client :
self
.
_createSocket
()
self
.
socket
.
send
(
struct
.
pack
(
'
ii%is
'
%
len
(
m
),
t
,
len
(
m
),
m
))
def
_define
_p
arameter
(
self
,
param
)
:
def
_define
P
arameter
(
self
,
param
)
:
if
not
self
.
socket
:
return
param
.
value
self
.
_send
(
self
.
_GMSH_PARAMETER_QUERY
,
param
.
tochar
())
...
...
@@ -170,7 +171,7 @@ class client :
if
'
value
'
not
in
param
:
#make the parameter readOnly
p
.
readOnly
=
1
p
.
attributes
=
{
'
Highlight
'
:
'
AliceBlue
'
}
value
=
self
.
_define
_p
arameter
(
p
)
value
=
self
.
_define
P
arameter
(
p
)
return
value
def
defineString
(
self
,
name
,
**
param
):
...
...
@@ -178,7 +179,7 @@ class client :
if
'
value
'
not
in
param
:
#make the parameter readOnly
p
.
readOnly
=
1
p
.
attributes
=
{
'
Highlight
'
:
'
AliceBlue
'
}
value
=
self
.
_define
_p
arameter
(
p
)
value
=
self
.
_define
P
arameter
(
p
)
return
value
def
setNumber
(
self
,
name
,
**
param
):
...
...
@@ -217,7 +218,7 @@ class client :
print
(
'
Unknown parameter %s
'
%
(
param
.
name
))
self
.
_send
(
self
.
_GMSH_PARAMETER
,
p
.
tochar
())
def
_get
_p
arameter
(
self
,
param
,
warn_if_not_found
=
True
)
:
def
_get
P
arameter
(
self
,
param
,
warn_if_not_found
=
True
)
:
if
not
self
.
socket
:
return
self
.
_send
(
self
.
_GMSH_PARAMETER_QUERY
,
param
.
tochar
())
...
...
@@ -229,12 +230,12 @@ class client :
def
getNumber
(
self
,
name
,
warn_if_not_found
=
True
):
param
=
_parameter
(
'
number
'
,
name
=
name
)
self
.
_get
_p
arameter
(
param
,
warn_if_not_found
)
self
.
_get
P
arameter
(
param
,
warn_if_not_found
)
return
param
.
value
def
getString
(
self
,
name
,
warn_if_not_found
=
True
):
param
=
_parameter
(
'
string
'
,
name
=
name
)
self
.
_get
_p
arameter
(
param
,
warn_if_not_found
)
self
.
_get
P
arameter
(
param
,
warn_if_not_found
)
return
param
.
value
def
show
(
self
,
name
)
:
...
...
@@ -313,15 +314,15 @@ class client :
s
=
addr
.
split
(
'
:
'
)
self
.
socket
.
connect
((
s
[
0
],
int
(
s
[
1
])))
def
_wait
_on_s
ub
c
lients
(
self
):
def
_wait
OnS
ub
C
lients
(
self
):
if
not
self
.
socket
:
return
while
self
.
N
umSubClients
>
0
:
while
self
.
_n
umSubClients
>
0
:
(
t
,
msg
)
=
self
.
_receive
()
if
t
==
self
.
_GMSH_STOP
:
self
.
N
umSubClients
-=
1
self
.
_n
umSubClients
-=
1
def
run
(
self
,
name
,
command
,
arguments
=
''
):
def
run
SubClient
(
self
,
name
,
command
,
arguments
=
''
):
# create command line
if
self
.
action
==
"
check
"
:
cmd
=
command
...
...
@@ -331,14 +332,17 @@ class client :
return
os
.
system
(
cmd
);
msg
=
[
name
,
cmd
]
self
.
_send
(
self
.
_GMSH_CONNECT
,
'
\0
'
.
join
(
msg
))
self
.
NumSubClients
+=
1
self
.
_wait_on_subclients
()
# makes the subclient blocking
self
.
_numSubClients
+=
1
self
.
_waitOnSubClients
()
# makes the subclient blocking
def
run
(
self
,
name
,
command
,
arguments
=
''
):
self
.
runSubClient
(
name
,
command
,
arguments
)
def
__init__
(
self
):
self
.
socket
=
None
self
.
name
=
""
self
.
addr
=
""
self
.
N
umSubClients
=
0
self
.
_n
umSubClients
=
0
for
i
,
v
in
enumerate
(
sys
.
argv
)
:
if
v
==
'
-onelab
'
:
self
.
name
=
sys
.
argv
[
i
+
1
]
...
...
@@ -353,7 +357,7 @@ class client :
# code aster python interpreter does not call the destructor at exit, it is
# necessary to call finalize() epxlicitely
if
self
.
socket
:
self
.
_wait
_on_s
ub
c
lients
()
self
.
_wait
OnS
ub
C
lients
()
self
.
_send
(
self
.
_GMSH_STOP
,
'
Goodbye!
'
)
self
.
socket
.
close
()
self
.
socket
=
None
...
...
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