Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
machinejobfeatures
mjf-scripts
Commits
0ded0726
Commit
0ded0726
authored
Mar 01, 2016
by
Andrew McNab
Browse files
Fix bug found by John Hill
parent
0314fc71
Changes
1
Hide whitespace changes
Inline
Side-by-side
prologue.user
View file @
0ded0726
...
...
@@ -67,22 +67,6 @@ open(jobfeaturesDir + '/job_id', 'w').write(job_id)
jobfeatures
=
{}
jobfeatures
[
'allocated_cpu'
]
=
1
try
:
hs06
=
float
(
open
(
'/etc/machinefeatures/hs06'
,
'r'
).
readline
())
except
:
hs06
=
None
try
:
total_cpu
=
int
(
open
(
'/etc/machinefeatures/total_cpu'
,
'r'
).
readline
())
except
:
total_cpu
=
None
if
hs06
and
total_cpu
:
# Simple pro-rata allocation of total hs06 depending on processors for this job
hs06_job
=
(
jobfeatures
[
'allocated_cpu'
]
*
hs06
)
/
total_cpu
else
:
hs06_job
=
None
jobstart_secs
=
int
(
time
.
time
())
open
(
jobfeaturesDir
+
'/jobstart_secs'
,
'w'
).
write
(
str
(
jobstart_secs
))
...
...
@@ -136,19 +120,7 @@ try:
except
:
fromSysconfig
=
''
# hs06_job is a float so special handling
if
'hs06_job='
in
fromRun
+
fromSysconfig
:
try
:
matchObject
=
re
.
search
(
"hs06_job=([0-9.]*)"
,
fromSysconfig
+
fromRun
)
hs06_job
=
float
(
matchObject
.
group
(
1
))
except
:
pass
if
hs06_job
:
# Has been defined here or before
open
(
jobfeaturesDir
+
'/hs06_job'
,
'w'
).
write
(
'%.2f'
%
hs06_job
)
# The rest are integers so handle with a list
# These are all integers so handle with a list
for
key
in
[
'allocated_cpu'
,
'wall_limit_secs'
,
'cpu_limit_secs'
,
'max_rss_bytes'
,
'max_swap_bytes'
,
'scratch_limit_bytes'
]:
...
...
@@ -162,3 +134,32 @@ for key in ['allocated_cpu', 'wall_limit_secs', 'cpu_limit_secs',
if
key
in
jobfeatures
:
open
(
jobfeaturesDir
+
'/'
+
key
,
'w'
).
write
(
str
(
jobfeatures
[
key
]))
# Try to get/calculate hs06_job
hs06_job
=
None
if
'hs06_job='
in
fromRun
+
fromSysconfig
:
try
:
matchObject
=
re
.
search
(
"hs06_job=([0-9.]*)"
,
fromSysconfig
+
fromRun
)
hs06_job
=
float
(
matchObject
.
group
(
1
))
except
:
pass
if
not
hs06_job
:
try
:
hs06
=
float
(
open
(
'/etc/machinefeatures/hs06'
,
'r'
).
readline
())
except
:
hs06
=
None
try
:
total_cpu
=
int
(
open
(
'/etc/machinefeatures/total_cpu'
,
'r'
).
readline
())
except
:
total_cpu
=
None
if
hs06
and
total_cpu
:
# Simple pro-rata allocation of total hs06 depending on processors for this job
hs06_job
=
(
jobfeatures
[
'allocated_cpu'
]
*
hs06
)
/
total_cpu
if
hs06_job
:
# We got it from somewhere
open
(
jobfeaturesDir
+
'/hs06_job'
,
'w'
).
write
(
'%.2f'
%
hs06_job
)
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment