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
5c4528b1
Commit
5c4528b1
authored
May 03, 2024
by
Erly Villaroel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Timeout
parent
acead9c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
CodeResponseEnum.py
app/main/engine/enum/CodeResponseEnum.py
+1
-0
Process.py
app/main/engine/service/Process.py
+14
-1
No files found.
app/main/engine/enum/CodeResponseEnum.py
View file @
5c4528b1
...
@@ -11,3 +11,4 @@ class CodeResponseEnum(Enum):
...
@@ -11,3 +11,4 @@ class CodeResponseEnum(Enum):
OUTPUT_ERROR
=
606
OUTPUT_ERROR
=
606
EMPTY_DATASET
=
607
EMPTY_DATASET
=
607
ERROR
=
609
ERROR
=
609
TIMEOUT_ERROR
=
800
app/main/engine/service/Process.py
View file @
5c4528b1
...
@@ -2,7 +2,7 @@ from typing import Dict, Any
...
@@ -2,7 +2,7 @@ from typing import Dict, Any
import
time
import
time
import
traceback
as
traceback_lib
import
traceback
as
traceback_lib
import
importlib
import
importlib
from
threading
import
Timer
from
config
import
Config
as
cfg
from
config
import
Config
as
cfg
from
app.main.engine.util.Timezone
import
Timezone
from
app.main.engine.util.Timezone
import
Timezone
from
app.main.engine.util.Utils
import
Utils
from
app.main.engine.util.Utils
import
Utils
...
@@ -11,6 +11,11 @@ from app.main.engine.enum.CodeResponseEnum import CodeResponseEnum
...
@@ -11,6 +11,11 @@ from app.main.engine.enum.CodeResponseEnum import CodeResponseEnum
from
app.main.engine.database.Database
import
Database
from
app.main.engine.database.Database
import
Database
def
timeout_function
():
raise
TimeoutError
(
"Timeout occurred"
)
class
Process
:
class
Process
:
def
__init__
(
self
,
app
,
descriptor
:
Dict
[
str
,
Any
])
->
None
:
def
__init__
(
self
,
app
,
descriptor
:
Dict
[
str
,
Any
])
->
None
:
self
.
app
=
app
self
.
app
=
app
...
@@ -21,7 +26,11 @@ class Process:
...
@@ -21,7 +26,11 @@ class Process:
def
run
(
self
)
->
Dict
[
str
,
Any
]:
def
run
(
self
)
->
Dict
[
str
,
Any
]:
status
,
status_description
=
StatusEnum
.
OK
,
""
status
,
status_description
=
StatusEnum
.
OK
,
""
input_time
=
self
.
descriptor
[
"config-params"
][
"max-timeout-per-combinations"
]
t
=
Timer
(
input_time
,
timeout_function
)
t
.
start
()
try
:
try
:
# Obteniendo la conexión a la BD
# Obteniendo la conexión a la BD
db_params
=
cfg
.
db_params
db_params
=
cfg
.
db_params
source
=
Database
(
self
.
app
,
db_params
)
source
=
Database
(
self
.
app
,
db_params
)
...
@@ -75,9 +84,13 @@ class Process:
...
@@ -75,9 +84,13 @@ class Process:
except
ReferenceError
as
e
:
except
ReferenceError
as
e
:
self
.
app
.
logger
.
error
(
f
"Error validando parámetros del descriptor. {e}"
)
self
.
app
.
logger
.
error
(
f
"Error validando parámetros del descriptor. {e}"
)
status
,
status_description
=
CodeResponseEnum
.
PARAMETERS_ERROR
,
str
(
e
)
status
,
status_description
=
CodeResponseEnum
.
PARAMETERS_ERROR
,
str
(
e
)
except
TimeoutError
as
e
:
self
.
app
.
logger
.
error
(
f
"Error validando parámetros del descriptor. {e}"
)
status
,
status_description
=
CodeResponseEnum
.
TIMEOUT_ERROR
,
str
(
e
)
except
Exception
as
e
:
except
Exception
as
e
:
traceback_lib
.
print_exc
()
traceback_lib
.
print_exc
()
self
.
app
.
logger
.
error
(
f
"Error procesando engine. {e}"
)
self
.
app
.
logger
.
error
(
f
"Error procesando engine. {e}"
)
status
,
status_description
=
StatusEnum
.
ERROR
,
str
(
e
)
status
,
status_description
=
StatusEnum
.
ERROR
,
str
(
e
)
finally
:
finally
:
t
.
cancel
()
return
self
.
utils
.
create_response
(
status
,
status_description
)
return
self
.
utils
.
create_response
(
status
,
status_description
)
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