Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CSS-Engine-Python-Cusca
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Proyectos-Innovacion-2024
CSS-Engine-Python-Cusca
Commits
18e7ce35
Commit
18e7ce35
authored
May 05, 2024
by
Erly Villaroel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
timeout
parent
6fa897ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
main.py
app/main/engine/blueprint/main.py
+19
-3
No files found.
app/main/engine/blueprint/main.py
View file @
18e7ce35
...
...
@@ -6,7 +6,7 @@ from flask import request, jsonify
from
config
import
Config
as
cfg
from
app.main.engine.enum.StatusEnum
import
StatusEnum
from
app.main.engine.service.EngineService
import
EngineService
from
wrapt_timeout_decorator
import
*
class
MainController
:
...
...
@@ -33,9 +33,25 @@ class MainController:
try
:
self
.
executions
+=
1
descriptor
=
request
.
get_json
()
service
=
EngineService
(
self
.
app
,
descriptor
,
self
.
executions
,
self
.
max_executions
)
response
=
service
.
run
()
tiempo_limite
=
descriptor
[
"config-params"
][
"max-timeout-per-combinations"
]
@
timeout
(
tiempo_limite
)
def
procesamiento
():
response
=
{}
try
:
response
=
EngineService
(
self
.
app
,
descriptor
,
self
.
executions
,
self
.
max_executions
)
.
run
()
except
Exception
as
e
:
response
[
"statusCode"
]
=
StatusEnum
.
ERROR
.
name
response
[
"error"
]
=
{
"message"
:
""
,
"detail"
:
str
(
e
)}
raise
TimeoutError
(
f
"Tiempo límite de ejecución superado{e}"
)
finally
:
return
response
response
=
procesamiento
()
self
.
app
.
logger
.
info
(
response
)
except
TimeoutError
as
e
:
self
.
app
.
logger
.
error
(
f
"Error al superar timeout. {e}"
)
response
[
"statusCode"
]
=
StatusEnum
.
ERROR
.
name
response
[
"error"
]
=
{
"message"
:
""
,
"detail"
:
str
(
e
)}
except
Exception
as
e
:
self
.
app
.
logger
.
error
(
f
"Error en el envío del parser al servicio. {e}"
)
response
[
"statusCode"
]
=
StatusEnum
.
ERROR
.
name
...
...
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