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
b4d2c0ec
There was a problem fetching the pipeline summary.
Commit
b4d2c0ec
authored
8 years ago
by
mads
Browse files
Options
Downloads
Patches
Plain Diff
moved import psutil
parent
5744ca66
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/utils/cluster_tools/cluster_resource.py
+4
-4
4 additions, 4 deletions
wetb/utils/cluster_tools/cluster_resource.py
with
4 additions
and
4 deletions
wetb/utils/cluster_tools/cluster_resource.py
+
4
−
4
View file @
b4d2c0ec
...
...
@@ -6,12 +6,10 @@ Created on 04/04/2016
import
multiprocessing
import
threading
import
psutil
from
wetb.utils.cluster_tools
import
pbswrap
from
wetb.utils.cluster_tools.ssh_client
import
SSHClient
,
SharedSSHClient
from
_collections
import
deque
import
time
class
Resource
(
object
):
...
...
@@ -102,6 +100,7 @@ class LocalResource(Resource):
self
.
host
=
'
Localhost
'
def
check_resources
(
self
):
import
psutil
def
name
(
i
):
try
:
return
psutil
.
Process
(
i
).
name
()
...
...
@@ -111,4 +110,5 @@ class LocalResource(Resource):
no_cpu
=
multiprocessing
.
cpu_count
()
cpu_free
=
(
1
-
psutil
.
cpu_percent
(.
5
)
/
100
)
*
no_cpu
no_current_process
=
len
([
i
for
i
in
psutil
.
pids
()
if
name
(
i
).
lower
().
startswith
(
self
.
process_name
.
lower
())])
return
no_cpu
,
cpu_free
,
self
.
acquired
used
=
max
(
self
.
acquired
,
no_cpu
-
cpu_free
,
no_current_process
)
return
no_cpu
,
cpu_free
,
used
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