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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
shfe1
WindEnergyToolbox
Commits
7b4a9c09
Commit
7b4a9c09
authored
7 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
cluster_resource ok2submit returns number ok2submit
parent
ea84bf7e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/utils/cluster_tools/cluster_resource.py
+11
-9
11 additions, 9 deletions
wetb/utils/cluster_tools/cluster_resource.py
with
11 additions
and
9 deletions
wetb/utils/cluster_tools/cluster_resource.py
+
11
−
9
View file @
7b4a9c09
...
@@ -12,7 +12,6 @@ import threading
...
@@ -12,7 +12,6 @@ import threading
from
wetb.utils.cluster_tools
import
pbswrap
from
wetb.utils.cluster_tools
import
pbswrap
def
unix_path
(
path
,
cwd
=
None
,
fail_on_missing
=
False
):
def
unix_path
(
path
,
cwd
=
None
,
fail_on_missing
=
False
):
"""
Convert case insensitive filename into unix case sensitive filename
"""
Convert case insensitive filename into unix case sensitive filename
...
@@ -73,17 +72,20 @@ class Resource(object):
...
@@ -73,17 +72,20 @@ class Resource(object):
def
ok2submit
(
self
):
def
ok2submit
(
self
):
"""
Always ok to have min_cpu cpus and ok to have more if there are min_free free cpus
"""
"""
Always ok to have min_cpu cpus and ok to have more if there are min_free free cpus
"""
try
:
try
:
print
(
"
ok2submit
"
)
#
print ("ok2submit")
total
,
free
,
user
=
self
.
check_resources
()
total
,
free
,
user
=
self
.
check_resources
()
print
(
"
ok2submit
"
,
total
,
free
,
user
)
user
=
max
(
user
,
self
.
acquired
)
user_max
=
max
((
self
.
min_cpu
-
user
),
self
.
cpu_free
-
self
.
min_free
)
#print ("ok2submit", total, free, user, user_max)
return
user_max
except
:
except
:
return
False
return
False
if
user
<
self
.
min_cpu
:
#
if user < self.min_cpu:
return
True
#
return True
elif
free
>
self
.
min_free
:
#
elif free > self.min_free:
return
True
#
return True
else
:
#
else:
return
False
#
return False
def
acquire
(
self
):
def
acquire
(
self
):
with
self
.
resource_lock
:
with
self
.
resource_lock
:
...
...
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