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
Titouan Soulard
slapos.core
Commits
66aa4d59
Commit
66aa4d59
authored
Jun 20, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapgrid: exception handling cleanup
parent
a9be8240
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
47 deletions
+24
-47
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+22
-44
slapos/slap/slap.py
slapos/slap/slap.py
+2
-3
No files found.
slapos/grid/slapgrid.py
View file @
66aa4d59
...
...
@@ -445,14 +445,12 @@ class Slapgrid(object):
except
(
SystemExit
,
KeyboardInterrupt
):
raise
except
Exception
:
self
.
logger
.
error
(
'Problem while reporting error, continuing:
\
n
%s'
%
traceback
.
format_exc
())
self
.
logger
.
exception
(
'Problem while reporting error, continuing:'
)
# For everything else: log it, send it, continue.
except
Exception
:
exc
=
traceback
.
format_exc
()
self
.
logger
.
error
(
exc
)
software_release
.
error
(
exc
,
logger
=
self
.
logger
)
self
.
logger
.
exception
(
''
)
software_release
.
error
(
traceback
.
format_exc
(),
logger
=
self
.
logger
)
clean_run
=
False
else
:
if
state
==
'available'
:
...
...
@@ -464,7 +462,7 @@ class Slapgrid(object):
try
:
software_release
.
destroyed
()
except
(
NotFoundError
,
ServerError
):
print
traceback
.
format_exc
(
)
self
.
logger
.
exception
(
''
)
self
.
logger
.
info
(
'Finished software releases.'
)
# Return success value
...
...
@@ -583,7 +581,7 @@ class Slapgrid(object):
periodicity
=
int
(
open
(
periodicity_path
).
read
())
except
ValueError
:
os
.
remove
(
periodicity_path
)
self
.
logger
.
e
rror
(
traceback
.
format_exc
()
)
self
.
logger
.
e
xception
(
''
)
# Check if timestamp from server is more recent than local one.
# If not: it's not worth processing this partition (nothing has
...
...
@@ -609,7 +607,7 @@ class Slapgrid(object):
os
.
remove
(
timestamp_path
)
except
ValueError
:
os
.
remove
(
timestamp_path
)
self
.
logger
.
e
rror
(
traceback
.
format_exc
()
)
self
.
logger
.
e
xception
(
''
)
self
.
logger
.
info
(
' Software URL: %s'
%
software_url
)
self
.
logger
.
info
(
' Software path: %s'
%
software_path
)
...
...
@@ -708,26 +706,17 @@ class Slapgrid(object):
computer_partition
.
error
(
traceback
.
format_exc
(),
logger
=
self
.
logger
)
raise
# Buildout failed: send log but don't print it to output (already done)
except
BuildoutFailedError
as
exc
:
try
:
computer_partition
.
error
(
exc
,
logger
=
self
.
logger
)
except
(
SystemExit
,
KeyboardInterrupt
):
raise
except
Exception
:
self
.
logger
.
error
(
'Problem during reporting error, continuing:
\
n
%s'
%
traceback
.
format_exc
())
# For everything else: log it, send it, continue.
except
Exception
as
exc
:
self
.
logger
.
error
(
traceback
.
format_exc
())
# if Buildout failed: send log but don't print it to output (already done)
if
not
isinstance
(
exc
,
BuildoutFailedError
):
# For everything else: log it, send it, continue.
self
.
logger
.
exception
(
''
)
try
:
computer_partition
.
error
(
exc
,
logger
=
self
.
logger
)
except
(
SystemExit
,
KeyboardInterrupt
):
raise
except
Exception
:
self
.
logger
.
error
(
'Problem during reporting error, continuing:
\
n
%s'
%
traceback
.
format_exc
())
self
.
logger
.
exception
(
'Problem while reporting error, continuing:'
)
return
filtered_computer_partition_list
...
...
@@ -773,31 +762,20 @@ class Slapgrid(object):
except
(
SystemExit
,
KeyboardInterrupt
):
raise
except
Exception
:
self
.
logger
.
error
(
'Problem during reporting error, continuing:
\
n
%s'
%
traceback
.
format_exc
())
self
.
logger
.
exception
(
'Problem while reporting error, continuing:'
)
# Buildout failed: send log but don't print it to output (already done)
except
BuildoutFailedError
as
exc
:
clean_run
=
False
try
:
computer_partition
.
error
(
exc
,
logger
=
self
.
logger
)
except
(
SystemExit
,
KeyboardInterrupt
):
raise
except
Exception
:
self
.
logger
.
error
(
'Problem during reporting error, continuing:
\
n
%s'
%
traceback
.
format_exc
())
# For everything else: log it, send it, continue.
except
Exception
as
exc
:
clean_run
=
False
self
.
logger
.
error
(
traceback
.
format_exc
())
# if Buildout failed: send log but don't print it to output (already done)
if
not
isinstance
(
exc
,
BuildoutFailedError
):
# For everything else: log it, send it, continue.
self
.
logger
.
exception
(
''
)
try
:
computer_partition
.
error
(
exc
,
logger
=
self
.
logger
)
except
(
SystemExit
,
KeyboardInterrupt
):
raise
except
Exception
:
self
.
logger
.
error
(
'Problem during reporting error, continuing:
\
n
%s'
%
traceback
.
format_exc
())
self
.
logger
.
exception
(
'Problem while reporting error, continuing:'
)
self
.
logger
.
info
(
'Finished computer partitions.'
)
...
...
@@ -966,8 +944,8 @@ class Slapgrid(object):
computer_partition
.
error
(
'
\
n
'
.
join
(
failed_script_list
),
logger
=
self
.
logger
)
# Whatever happens, don't stop processing other instances
except
Exception
:
self
.
logger
.
info
(
'Cannot run usage script(s) for %r: %s
'
%
(
computer_partition
.
getId
(),
traceback
.
format_exc
()
))
self
.
logger
.
exception
(
'Cannot run usage script(s) for %r:
'
%
computer_partition
.
getId
(
))
#Now we loop through the different computer partitions to report
report_usage_issue_cp_list
=
[]
...
...
@@ -1013,8 +991,8 @@ class Slapgrid(object):
# Whatever happens, don't stop processing other instances
except
Exception
:
self
.
logger
.
info
(
'Cannot run usage script(s) for %r: %s
'
%
(
computer_partition
.
getId
(),
traceback
.
format_exc
()
))
self
.
logger
.
exception
(
'Cannot run usage script(s) for %r:
'
%
computer_partition
.
getId
(
))
for
computer_partition_usage
in
computer_partition_usage_list
:
self
.
logger
.
info
(
'computer_partition_usage_list: %s - %s'
%
...
...
@@ -1088,9 +1066,9 @@ class Slapgrid(object):
raise
except
Exception
:
clean_run
=
False
self
.
logger
.
exception
(
''
)
exc
=
traceback
.
format_exc
()
computer_partition
.
error
(
exc
,
logger
=
self
.
logger
)
self
.
logger
.
error
(
exc
)
try
:
computer_partition
.
destroyed
()
except
NotFoundError
:
...
...
slapos/slap/slap.py
View file @
66aa4d59
...
...
@@ -39,7 +39,6 @@ import logging
import
re
import
socket
import
ssl
import
traceback
import
urllib
import
urlparse
...
...
@@ -160,7 +159,7 @@ class SoftwareRelease(SlapDocument):
'computer_id'
:
self
.
getComputerId
(),
'error_log'
:
error_log
})
except
Exception
:
(
logger
or
fallback_logger
).
e
rror
(
traceback
.
format_exc
()
)
(
logger
or
fallback_logger
).
e
xception
(
''
)
def
available
(
self
):
self
.
_connection_helper
.
POST
(
'/availableSoftwareRelease'
,
{
...
...
@@ -448,7 +447,7 @@ class ComputerPartition(SlapRequester):
'computer_partition_id'
:
self
.
getId
(),
'error_log'
:
error_log
})
except
Exception
:
(
logger
or
fallback_logger
).
e
rror
(
traceback
.
format_exc
()
)
(
logger
or
fallback_logger
).
e
xception
(
''
)
def
bang
(
self
,
message
):
self
.
_connection_helper
.
POST
(
'/softwareInstanceBang'
,
{
...
...
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