Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flowspy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itminedu
flowspy
Commits
c6ca7d43
Commit
c6ca7d43
authored
Aug 07, 2014
by
Leonidas Poulopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include celery task exceptions in proxy
parent
891ae881
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
utils/proxy.py
utils/proxy.py
+26
-0
No files found.
utils/proxy.py
View file @
c6ca7d43
...
...
@@ -24,6 +24,7 @@ from django.conf import settings
import
logging
from
django.core.cache
import
cache
import
os
from
celery.exceptions
import
TimeLimitExceeded
,
SoftTimeLimitExceeded
cwd
=
os
.
getcwd
()
...
...
@@ -204,6 +205,14 @@ class Applier(object):
logger
.
info
(
"Successfully edited @ %s"
%
self
.
device
)
if
not
edit_is_successful
:
raise
Exception
()
except
SoftTimeLimitExceeded
:
cause
=
"Task timeout"
logger
.
error
(
cause
)
return
False
,
cause
except
TimeLimitExceeded
:
cause
=
"Task timeout"
logger
.
error
(
cause
)
return
False
,
cause
except
Exception
as
e
:
cause
=
"Caught edit exception: %s %s"
%
(
e
,
reason
)
cause
=
cause
.
replace
(
'
\n
'
,
''
)
...
...
@@ -221,11 +230,20 @@ class Applier(object):
logger
.
info
(
"Successfully confirmed committed @ %s"
%
self
.
device
)
if
not
settings
.
COMMIT
:
return
True
,
"Successfully confirmed committed"
except
SoftTimeLimitExceeded
:
cause
=
"Task timeout"
logger
.
error
(
cause
)
return
False
,
cause
except
TimeLimitExceeded
:
cause
=
"Task timeout"
logger
.
error
(
cause
)
return
False
,
cause
except
Exception
as
e
:
cause
=
"Caught commit confirmed exception: %s %s"
%
(
e
,
reason
)
cause
=
cause
.
replace
(
'
\n
'
,
''
)
logger
.
error
(
cause
)
return
False
,
cause
if
settings
.
COMMIT
:
if
edit_is_successful
and
commit_confirmed_is_successful
:
try
:
...
...
@@ -242,6 +260,14 @@ class Applier(object):
else
:
logger
.
info
(
"Successfully cached device configuration"
)
return
True
,
"Successfully committed"
except
SoftTimeLimitExceeded
:
cause
=
"Task timeout"
logger
.
error
(
cause
)
return
False
,
cause
except
TimeLimitExceeded
:
cause
=
"Task timeout"
logger
.
error
(
cause
)
return
False
,
cause
except
Exception
as
e
:
cause
=
"Caught commit exception: %s %s"
%
(
e
,
reason
)
cause
=
cause
.
replace
(
'
\n
'
,
''
)
...
...
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