Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
fef6c036
Commit
fef6c036
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Jobs: Časové parametry jobů jsou nastavitelné
parent
3c704983
No related branches found
No related tags found
1 merge request
!9
WIP: Zárodek uživatelské části webu a submitování
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
etc/config.py.example
+6
-0
6 additions, 0 deletions
etc/config.py.example
mo/jobs/__init__.py
+2
-1
2 additions, 1 deletion
mo/jobs/__init__.py
mo/web/__init__.py
+1
-1
1 addition, 1 deletion
mo/web/__init__.py
with
9 additions
and
2 deletions
etc/config.py.example
+
6
−
0
View file @
fef6c036
...
...
@@ -24,3 +24,9 @@ MAX_CONTENT_LENGTH = 16777216
# Adresář, do kterého ukládáme data (pro vývoj relativní, pro instalaci absolutní)
DATA_DIR = 'data'
# Jak často se má provádět periodická kontrola dávek [s]
JOB_GC_PERIOD = 60
# Za jak dlouho expiruje dokončený job [min]
JOB_EXPIRATION = 5
This diff is collapsed.
Click to expand it.
mo/jobs/__init__.py
+
2
−
1
View file @
fef6c036
...
...
@@ -7,6 +7,7 @@ from sqlalchemy import or_
from
typing
import
Optional
,
Dict
,
Callable
import
mo
import
mo.config
as
config
import
mo.db
as
db
import
mo.util
from
mo.util
import
logger
...
...
@@ -117,7 +118,7 @@ class TheJob:
return
job
.
finished_at
=
mo
.
util
.
get_now
()
job
.
expires_at
=
job
.
finished_at
+
timedelta
(
minutes
=
5
)
# FIXME
job
.
expires_at
=
job
.
finished_at
+
timedelta
(
minutes
=
config
.
JOB_EXPIRATION
)
sess
.
commit
()
...
...
This diff is collapsed.
Click to expand it.
mo/web/__init__.py
+
1
−
1
View file @
fef6c036
...
...
@@ -96,7 +96,7 @@ try:
# Čas od času se probudíme a projdeme joby pro případ, že by se ztratil signál.
# Také při tom expirujeme zastaralé joby.
@timer
(
120
,
target
=
'
mule
'
)
@timer
(
config
.
JOB_GC_PERIOD
,
target
=
'
mule
'
)
def
mule_timer
(
signum
):
app
.
logger
.
debug
(
'
Mule: Timer tick
'
)
with
app
.
app_context
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment