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
Lu Xu
slapos.core
Commits
edc9d216
Commit
edc9d216
authored
May 05, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slapos.grid] Place instance logs on instance side.
parent
e468b364
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
54 deletions
+74
-54
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+74
-54
No files found.
slapos/grid/slapgrid.py
View file @
edc9d216
...
@@ -39,6 +39,7 @@ import tempfile
...
@@ -39,6 +39,7 @@ import tempfile
import
time
import
time
import
traceback
import
traceback
import
warnings
import
warnings
import
logging
if
sys
.
version_info
<
(
2
,
6
):
if
sys
.
version_info
<
(
2
,
6
):
warnings
.
warn
(
'Used python version (%s) is old and has problems with'
warnings
.
warn
(
'Used python version (%s) is old and has problems with'
...
@@ -48,6 +49,7 @@ from lxml import etree
...
@@ -48,6 +49,7 @@ from lxml import etree
from
slapos.slap.slap
import
NotFoundError
from
slapos.slap.slap
import
NotFoundError
from
slapos.slap.slap
import
ServerError
from
slapos.slap.slap
import
ServerError
from
slapos.util
import
mkdir_p
,
chownDirectory
from
slapos.grid.exception
import
BuildoutFailedError
from
slapos.grid.exception
import
BuildoutFailedError
from
slapos.grid.SlapObject
import
Software
,
Partition
from
slapos.grid.SlapObject
import
Software
,
Partition
from
slapos.grid.svcbackend
import
launchSupervisord
from
slapos.grid.svcbackend
import
launchSupervisord
...
@@ -606,6 +608,23 @@ class Slapgrid(object):
...
@@ -606,6 +608,23 @@ class Slapgrid(object):
os
.
remove
(
timestamp_path
)
os
.
remove
(
timestamp_path
)
self
.
logger
.
exception
(
''
)
self
.
logger
.
exception
(
''
)
# Include Partition Logging
log_folder_path
=
"%s/.slapgrid/log"
%
instance_path
mkdir_p
(
log_folder_path
)
partition_file_handler
=
logging
.
FileHandler
(
filename
=
"%s/instance.log"
%
(
log_folder_path
)
)
stat_info
=
os
.
stat
(
instance_path
)
chownDirectory
(
"%s/.slapgrid"
%
instance_path
,
uid
=
stat_info
.
st_uid
,
gid
=
stat_info
.
st_gid
)
formatter
=
logging
.
Formatter
(
'[%(asctime)s] %(levelname)-8s %(name)s %(message)s'
)
partition_file_handler
.
setFormatter
(
formatter
)
self
.
logger
.
addHandler
(
partition_file_handler
)
try
:
self
.
logger
.
info
(
'Processing Computer Partition %s.'
%
computer_partition_id
)
self
.
logger
.
info
(
'Processing Computer Partition %s.'
%
computer_partition_id
)
self
.
logger
.
info
(
' Software URL: %s'
%
software_url
)
self
.
logger
.
info
(
' Software URL: %s'
%
software_url
)
self
.
logger
.
info
(
' Software path: %s'
%
software_path
)
self
.
logger
.
info
(
' Software path: %s'
%
software_path
)
...
@@ -626,7 +645,6 @@ class Slapgrid(object):
...
@@ -626,7 +645,6 @@ class Slapgrid(object):
certificate_repository_path
=
self
.
certificate_repository_path
,
certificate_repository_path
=
self
.
certificate_repository_path
,
buildout
=
self
.
buildout
,
buildout
=
self
.
buildout
,
logger
=
self
.
logger
)
logger
=
self
.
logger
)
computer_partition_state
=
computer_partition
.
getState
()
computer_partition_state
=
computer_partition
.
getState
()
# XXX this line breaks 37 tests
# XXX this line breaks 37 tests
...
@@ -663,6 +681,8 @@ class Slapgrid(object):
...
@@ -663,6 +681,8 @@ class Slapgrid(object):
(
computer_partition_id
,
computer_partition_state
)
(
computer_partition_id
,
computer_partition_state
)
computer_partition
.
error
(
error_string
,
logger
=
self
.
logger
)
computer_partition
.
error
(
error_string
,
logger
=
self
.
logger
)
raise
NotImplementedError
(
error_string
)
raise
NotImplementedError
(
error_string
)
finally
:
self
.
logger
.
removeHandler
(
partition_file_handler
)
# If partition has been successfully processed, write timestamp
# If partition has been successfully processed, write timestamp
if
timestamp
:
if
timestamp
:
...
...
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