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
7b4a9c09
There was a problem fetching the pipeline summary.
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
Branches containing commit
No related tags found
Tags containing commit
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
+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
from
wetb.utils.cluster_tools
import
pbswrap
def
unix_path
(
path
,
cwd
=
None
,
fail_on_missing
=
False
):
"""
Convert case insensitive filename into unix case sensitive filename
...
...
@@ -73,17 +72,20 @@ class Resource(object):
def
ok2submit
(
self
):
"""
Always ok to have min_cpu cpus and ok to have more if there are min_free free cpus
"""
try
:
print
(
"
ok2submit
"
)
#
print ("ok2submit")
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
:
return
False
if
user
<
self
.
min_cpu
:
return
True
elif
free
>
self
.
min_free
:
return
True
else
:
return
False
#
if user < self.min_cpu:
#
return True
#
elif free > self.min_free:
#
return True
#
else:
#
return False
def
acquire
(
self
):
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