Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
WindEnergyToolbox
Commits
b945c610
Commit
b945c610
authored
8 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
hostname to parse_qstat_n1
parent
0158283f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/utils/cluster_tools/cluster_resource.py
+3
-5
3 additions, 5 deletions
wetb/utils/cluster_tools/cluster_resource.py
wetb/utils/cluster_tools/pbswrap.py
+10
-16
10 additions, 16 deletions
wetb/utils/cluster_tools/pbswrap.py
with
13 additions
and
21 deletions
wetb/utils/cluster_tools/cluster_resource.py
+
3
−
5
View file @
b945c610
...
@@ -62,7 +62,7 @@ class SSHPBSClusterResource(Resource, SSHClient):
...
@@ -62,7 +62,7 @@ class SSHPBSClusterResource(Resource, SSHClient):
pbsnodes
,
nodes
=
pbswrap
.
parse_pbsnode_lall
(
output
.
split
(
"
\n
"
))
pbsnodes
,
nodes
=
pbswrap
.
parse_pbsnode_lall
(
output
.
split
(
"
\n
"
))
_
,
output
,
_
=
self
.
execute
(
'
qstat -n1
'
)
_
,
output
,
_
=
self
.
execute
(
'
qstat -n1
'
)
users
,
host
,
nodesload
=
pbswrap
.
parse_qstat_n1
(
output
.
split
(
"
\n
"
))
users
,
host
,
nodesload
=
pbswrap
.
parse_qstat_n1
(
output
.
split
(
"
\n
"
)
,
self
.
host
)
# if the user does not have any jobs, this will not exist
# if the user does not have any jobs, this will not exist
...
@@ -76,10 +76,8 @@ class SSHPBSClusterResource(Resource, SSHClient):
...
@@ -76,10 +76,8 @@ class SSHPBSClusterResource(Resource, SSHClient):
return
nodeSum
[
'
used_cpu
'
]
+
cpu_free
,
cpu_free
,
cpu_user
return
nodeSum
[
'
used_cpu
'
]
+
cpu_free
,
cpu_free
,
cpu_user
except
Exception
as
e
:
except
Exception
as
e
:
if
str
(
e
)
==
"
Password not set
"
:
raise
EnvironmentError
(
str
(
e
))
raise
EnvironmentError
(
str
(
e
))
else
:
raise
EnvironmentError
(
"
check resources failed
"
)
def
jobids
(
self
,
jobname_prefix
):
def
jobids
(
self
,
jobname_prefix
):
_
,
output
,
_
=
self
.
execute
(
'
qstat -u %s
'
%
self
.
username
)
_
,
output
,
_
=
self
.
execute
(
'
qstat -u %s
'
%
self
.
username
)
...
...
This diff is collapsed.
Click to expand it.
wetb/utils/cluster_tools/pbswrap.py
+
10
−
16
View file @
b945c610
...
@@ -176,7 +176,7 @@ def parse_pbsnode_lall(output):
...
@@ -176,7 +176,7 @@ def parse_pbsnode_lall(output):
return
pbsnodes
,
nodes
return
pbsnodes
,
nodes
def
parse_qstat_n1
(
output
):
def
parse_qstat_n1
(
output
,
hostname
=
None
):
"""
"""
Parse the output of qstat -n1
Parse the output of qstat -n1
"""
"""
...
@@ -188,26 +188,22 @@ def parse_qstat_n1(output):
...
@@ -188,26 +188,22 @@ def parse_qstat_n1(output):
host
=
{}
host
=
{}
users
=
{}
users
=
{}
# get the hostname
# get the hostname
hostname
=
socket
.
gethostname
()
if
hostname
is
None
:
if
hostname
[:
5
]
==
'
g-000
'
:
hostname
=
socket
.
gethostname
()
host
[
'
name
'
]
=
'
gorm
'
if
'
jess
'
in
hostname
:
host
[
'
cpu_per_node
'
]
=
12
else
:
# 272 nodes are 2 x 10 core (twenty) processors
host
[
'
name
'
]
=
'
jess
'
host
[
'
name
'
]
=
'
jess
'
#total_nodes = 80
host
[
'
cpu_per_node
'
]
=
20
host
[
'
cpu_per_node
'
]
=
20
else
:
host
[
'
name
'
]
=
'
gorm
'
host
[
'
cpu_per_node
'
]
=
12
# take the available nodes in nr_nodes: it excludes the ones
# take the available nodes in nr_nodes: it excludes the ones
# who are down
# who are down
#queue['_total_cpu_'] = cpu_node*nr_nodes
#queue['_total_cpu_'] = cpu_node*nr_nodes
ii
=
0
for
line
in
output
[
5
:]:
for
line
in
output
:
if
len
(
line
.
strip
())
==
0
:
# first 5 are not relevant
if
ii
<
5
:
ii
+=
1
continue
continue
items
=
line
.
split
()
items
=
line
.
split
()
queue
=
items
[
2
]
queue
=
items
[
2
]
...
@@ -268,8 +264,6 @@ def parse_qstat_n1(output):
...
@@ -268,8 +264,6 @@ def parse_qstat_n1(output):
except
KeyError
:
except
KeyError
:
nodesload
[
node
]
=
[
userid
]
nodesload
[
node
]
=
[
userid
]
ii
+=
1
return
users
,
host
,
nodesload
return
users
,
host
,
nodesload
# FIXME: counts diffferent compared to launch.py....
# FIXME: counts diffferent compared to launch.py....
...
...
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