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
Labels
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
2fe8f2c7
Commit
2fe8f2c7
authored
Jun 14, 2018
by
Guillaume Hervier
Committed by
Rafael Monnerat
Jul 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapgrid: Add tear down methods to IManager interface
parent
edcb9762
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
0 deletions
+65
-0
slapos/format.py
slapos/format.py
+3
-0
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+13
-0
slapos/manager/cpuset.py
slapos/manager/cpuset.py
+10
-0
slapos/manager/interface.py
slapos/manager/interface.py
+18
-0
slapos/manager/prerm.py
slapos/manager/prerm.py
+21
-0
No files found.
slapos/format.py
View file @
2fe8f2c7
...
...
@@ -668,6 +668,9 @@ class Computer(object):
except
IndexError
:
pass
for
manager
in
self
.
_manager_list
:
manager
.
formatTearDown
(
self
)
class
Partition
(
object
):
"""Represent a computer partition."""
...
...
slapos/grid/slapgrid.py
View file @
2fe8f2c7
...
...
@@ -580,6 +580,10 @@ stderr_logfile_backups=1
self
.
logger
.
info
(
'Destroying %r...'
%
software_release_uri
)
software
.
destroy
()
self
.
logger
.
info
(
'Destroyed %r.'
%
software_release_uri
)
# call manager for every software release
for
manager
in
self
.
_manager_list
:
manager
.
softwareTearDown
(
software
)
# Send log before exiting
except
(
SystemExit
,
KeyboardInterrupt
):
software_release
.
error
(
traceback
.
format_exc
(),
logger
=
self
.
logger
)
...
...
@@ -1037,6 +1041,11 @@ stderr_logfile_backups=1
self
.
_checkPromiseAnomaly
(
local_partition
,
computer_partition
)
else
:
self
.
logger
.
debug
(
'Partition already up-to-date. skipping.'
)
# Run manager tear down
for
manager
in
self
.
_manager_list
:
manager
.
instanceTearDown
(
local_partition
)
return
else
:
# Periodicity forced processing this partition. Removing
...
...
@@ -1137,6 +1146,10 @@ stderr_logfile_backups=1
else
:
self
.
logger
.
removeHandler
(
partition_file_handler
)
# Run manager tear down
for
manager
in
self
.
_manager_list
:
manager
.
instanceTearDown
(
local_partition
)
# If partition has been successfully processed, write timestamp
if
timestamp
:
open
(
timestamp_path
,
'w'
).
write
(
timestamp
)
...
...
slapos/manager/cpuset.py
View file @
2fe8f2c7
...
...
@@ -36,6 +36,10 @@ class Manager(object):
"""We don't need to mingle with software."""
pass
def
softwareTearDown
(
self
,
software
):
"""We don't need to mingle with software."""
pass
def
format
(
self
,
computer
):
"""Create cgroup folder per-CPU with exclusive access to the CPU.
...
...
@@ -55,6 +59,9 @@ class Manager(object):
with
open
(
cpu_path
+
"/cpuset.mems"
,
"wt"
)
as
fx
:
fx
.
write
(
"0"
)
# it doesn't work without that
def
formatTearDown
(
self
,
computer
):
pass
def
instance
(
self
,
partition
):
"""Control runtime state of the computer."""
...
...
@@ -135,6 +142,9 @@ class Manager(object):
with
open
(
request_file
,
"at"
)
as
fo
:
fo
.
write
(
str
(
request_pid
)
+
"
\
n
"
)
def
instanceTearDown
(
self
):
pass
def
_cpu_folder_list
(
self
):
"""Return list of folders for exclusive cpu cores."""
return
[
os
.
path
.
join
(
self
.
cpuset_path
,
"cpu"
+
str
(
cpu_id
))
...
...
slapos/manager/interface.py
View file @
2fe8f2c7
...
...
@@ -17,18 +17,36 @@ class IManager(Interface):
:param computer: slapos.format.Computer, currently formatted computer
"""
def
formatTearDown
(
computer
):
"""Method called after `slapos node format` phase.
:param computer: slapos.format.Computer, formatted computer
"""
def
software
(
software
):
"""Method called at `slapos node software` phase.
:param software: slapos.grid.SlapObject.Software, currently processed software
"""
def
softwareTearDown
(
software
):
"""Method called after `slapos node software` phase.
:param computer: slapos.grid.SlapObject.Software, processed software
"""
def
instance
(
partition
):
"""Method called at `slapos node instance` phase.
:param partition: slapos.grid.SlapObject.Partition, currently processed partition
"""
def
instanceTearDown
(
partition
):
"""Method called after `slapos node instance` phase.
:param partition: slapos.grid.SlapObject.Partition, processed partition
"""
def
report
(
partition
):
"""Method called at `slapos node report` phase.
...
...
slapos/manager/prerm.py
View file @
2fe8f2c7
...
...
@@ -25,16 +25,37 @@ class Manager(object):
"""
pass
def
formatTearDown
(
self
,
computer
):
"""Method called after `slapos node format` phase.
:param computer: slapos.format.Computer, formatted computer
"""
pass
def
software
(
self
,
software
):
"""Method called at `slapos node software` phase.
"""
pass
def
softwareTearDown
(
self
,
software
):
"""Method called after `slapos node software` phase.
:param computer: slapos.grid.SlapObject.Software, processed software
"""
pass
def
instance
(
self
,
partition
):
"""Method called at `slapos node instance` phase.
"""
pass
def
instanceTearDown
(
self
,
partition
):
"""Method called after `slapos node instance` phase.
:param partition: slapos.grid.SlapObject.Partition, processed partition
"""
pass
def
report
(
self
,
partition
):
"""Method called at `slapos node report` phase."""
...
...
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