Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.core
Commits
671d052c
Commit
671d052c
authored
Aug 09, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the promise checking into processComputerPartion function
parent
90d113c0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
28 deletions
+37
-28
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+37
-28
No files found.
slapos/grid/slapgrid.py
View file @
671d052c
...
@@ -461,6 +461,43 @@ class Slapgrid(object):
...
@@ -461,6 +461,43 @@ class Slapgrid(object):
exception
=
traceback
.
format_exc
()
exception
=
traceback
.
format_exc
()
logger
.
error
(
exception
)
logger
.
error
(
exception
)
computer_partition
.
error
(
exception
)
computer_partition
.
error
(
exception
)
# Promises
instance_path
=
os
.
path
.
join
(
self
.
instance_root
,
computer_partition
.
getId
())
uid
,
gid
=
None
,
None
stat_info
=
os
.
stat
(
instance_path
)
#stat sys call to get statistics informations
uid
=
stat_info
.
st_uid
gid
=
stat_info
.
st_gid
# Get the list of promises
promise_dir
=
os
.
join
(
instance_path
,
'etc'
,
'promise'
)
commands_to_run
=
os
.
listdir
(
promise_dir
)
cwd
=
instance_path
# Check whether every promise is kept
for
process_handler
,
command
in
\
self
.
_runCommandAsUserAndYieldPopen
(
commands_to_run
,
(
uid
,
gid
),
cwd
):
time
.
sleep
(
self
.
promise_timeout
)
promise
=
os
.
path
.
basename
(
command
)
if
process_handler
.
poll
()
is
None
:
process_handler
.
kill
()
computer_partition
.
error
(
"The promise %r timed out"
%
promise
)
elif
process_handler
.
returncode
!=
0
:
stderr
=
process_handler
.
communicate
()[
1
]
if
stderr
is
None
:
stderr
=
'No error output from %r.'
%
promise
computer_partition
.
error
(
stderr
)
logger
.
info
(
"Finished computer partitions..."
)
logger
.
info
(
"Finished computer partitions..."
)
return
clean_run
return
clean_run
...
@@ -561,34 +598,6 @@ class Slapgrid(object):
...
@@ -561,34 +598,6 @@ class Slapgrid(object):
if
len
(
failed_script_list
):
if
len
(
failed_script_list
):
computer_partition
.
error
(
'
\
n
'
.
join
(
failed_script_list
))
computer_partition
.
error
(
'
\
n
'
.
join
(
failed_script_list
))
#
# Checking if the promises are kept
#
# Get the list of promises
promise_dir
=
os
.
join
(
instance_path
,
'etc'
,
'promise'
)
commands_to_run
=
os
.
listdir
(
promise_dir
)
cwd
=
instance_path
# Check whether every promise is kept
for
process_handler
,
command
in
\
self
.
_runCommandAsUserAndYieldPopen
(
commands_to_run
,
(
uid
,
gid
),
cwd
):
time
.
sleep
(
self
.
promise_timeout
)
promise
=
os
.
path
.
basename
(
command
)
if
process_handler
.
poll
()
is
None
:
process_handler
.
kill
()
computer_partition
.
error
(
"The promise %r timed out"
%
promise
)
elif
process_handler
.
returncode
!=
0
:
stderr
=
process_handler
.
communicate
()[
1
]
if
stderr
is
None
:
stderr
=
'No error output from %r.'
%
promise
computer_partition
.
error
(
stderr
)
#Now we loop through the different computer partitions to ggetId()et reports
#Now we loop through the different computer partitions to ggetId()et reports
report_usage_issue_cp_list
=
[]
report_usage_issue_cp_list
=
[]
for
computer_partition
in
slap_computer_usage
.
getComputerPartitionList
():
for
computer_partition
in
slap_computer_usage
.
getComputerPartitionList
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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