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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
e06c313d
Commit
e06c313d
authored
10 years ago
by
Maxime Graulich
Browse files
Options
Downloads
Patches
Plain Diff
ONELAB2: add missing functions for pend.py
parent
04de5599
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/onelab2/python/onelab2.py
+45
-3
45 additions, 3 deletions
contrib/onelab2/python/onelab2.py
with
45 additions
and
3 deletions
contrib/onelab2/python/onelab2.py
+
45
−
3
View file @
e06c313d
...
...
@@ -58,7 +58,7 @@ def path(dirname, inp):
class
_parameter
()
:
_membersbase
=
[
(
'
name
'
,
'
string
'
),
(
'
label
'
,
'
string
'
,
''
),
(
'
help
'
,
'
string
'
,
''
),
(
'
neverChanged
'
,
'
bool
'
,
0
),
(
'
visible
'
,
'
bool
'
,
1
),
(
'
readOnly
'
,
'
bool
'
,
0
),
(
'
readOnly
'
,
'
bool
'
,
0
),
(
'
neverChanged
'
,
'
bool
'
,
0
),
(
'
visible
'
,
'
bool
'
,
1
),
(
'
attributes
'
,
(
'
dict
'
,
'
string
'
,
'
string
'
),
{}),
(
'
clients
'
,
(
'
dict
'
,
'
string
'
,
'
bool
'
),
{})
]
...
...
@@ -251,6 +251,11 @@ class client :
else
:
return
None
def
_defineParameter
(
self
,
p
)
:
if
not
self
.
socket
:
return
p
.
value
self
.
_send
(
self
.
_ONELAB_UPDATE
,
p
.
tobytes
())
return
p
.
value
def
_getParameter
(
self
,
param
,
warn_if_not_found
=
True
)
:
def
extract_attr
(
b
):
...
...
@@ -270,6 +275,18 @@ class client :
elif
ptype
==
0x0A
and
warn_if_not_found
:
print
(
'
Unknown parameter %s
'
%
(
param
.
name
))
def
defineNumber
(
self
,
name
,
**
param
):
if
'
labels
'
in
param
:
param
[
"
choices
"
]
=
param
[
"
labels
"
].
keys
()
p
=
_parameter
(
'
number
'
,
name
=
name
,
**
param
)
value
=
self
.
_defineParameter
(
p
)
return
value
def
defineString
(
self
,
name
,
**
param
):
p
=
_parameter
(
'
string
'
,
name
=
name
,
**
param
)
value
=
self
.
_defineParameter
(
p
)
return
value
def
getString
(
self
,
name
,
warn_if_not_found
=
True
):
param
=
_parameter
(
'
string
'
,
name
=
name
)
self
.
_getParameter
(
param
,
warn_if_not_found
)
...
...
@@ -313,6 +330,11 @@ class client :
def
sendDebug
(
self
,
msg
)
:
self
.
_sendMessage
(
msg
+
'
\0
'
,
99
)
def
mergeFile
(
self
,
filename
)
:
if
not
self
.
socket
or
not
filename
:
return
self
.
_send
(
self
.
_ONELAB_UPDATE
,
struct
.
pack
(
"
!HH
"
,
0x0D
,
len
(
filename
))
+
filename
)
def
waitOnSubClient
(
self
,
name
):
if
not
self
.
socket
:
return
...
...
@@ -362,7 +384,10 @@ class client :
self
.
addr
=
sys
.
argv
[
i
+
2
]
self
.
_createSocket
()
self
.
_send
(
self
.
_ONELAB_START
,
struct
.
pack
(
'
!HH
'
,
0x04
,
len
(
self
.
name
))
+
self
.
name
)
self
.
_receive
()
# wait for the server to reply
(
t
,
msg
)
=
self
.
_receive
()
# wait for the server to reply
if
t
!=
self
.
_ONELAB_START
:
print
(
"
unable to connect the server
"
)
exit
(
1
)
self
.
_clearbuffer
()
self
.
action
=
"
compute
"
# default (subclients have no client.Action defined)
self
.
action
=
self
.
getString
(
self
.
name
+
'
/Action
'
,
False
)
...
...
@@ -384,6 +409,23 @@ class client :
self
.
socket
.
close
()
self
.
socket
=
None
def
getPath
(
self
,
inp
=
''
)
:
return
path
(
self
.
wdir
,
inp
)
def
fileExists
(
self
,
p
)
:
return
os
.
path
.
exists
(
p
)
def
checkFile
(
self
,
p
)
:
if
not
self
.
fileExists
(
p
):
self
.
sendError
(
'
path error: %s
'
%
(
p
))
exit
(
0
)
return
True
def
checkPath
(
self
,
inp
=
''
)
:
p
=
path
(
self
.
wdir
,
inp
)
self
.
checkFile
(
p
)
return
p
def
__del__
(
self
):
self
.
finalize
()
...
...
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