Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Roman Karwacik
website
Commits
3bfa3abe
Commit
3bfa3abe
authored
7 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Moved handler registration to server.py to reduce module dependencies
parent
0f151bec
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
edit.py
+0
-12
0 additions, 12 deletions
edit.py
jobs.py
+0
-19
0 additions, 19 deletions
jobs.py
server.py
+33
-2
33 additions, 2 deletions
server.py
with
33 additions
and
33 deletions
edit.py
+
0
−
12
View file @
3bfa3abe
...
...
@@ -119,18 +119,6 @@ def getfielddescription(path):
desc
=
'
<br>
'
+
desc
return
desc
edit_handlers
=
{}
def
edit_handler
(
*
tables
,
field
=
None
):
def
wrapper
(
func
):
for
table
in
tables
:
if
table
not
in
edit_handlers
:
edit_handlers
[
table
]
=
{}
if
field
not
in
edit_handlers
[
table
]:
edit_handlers
[
table
][
field
]
=
[]
edit_handlers
[
table
][
field
].
append
(
func
)
return
func
return
wrapper
@app.route
(
'
/internal/edit
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@mod_required
@csrf_protect
...
...
This diff is collapsed.
Click to expand it.
jobs.py
+
0
−
19
View file @
3bfa3abe
...
...
@@ -99,25 +99,6 @@ def jobs_worker_ping(hostname):
query
(
'
REPLACE INTO worker (hostname, last_ping) values (?, ?)
'
,
hostname
,
datetime
.
now
())
return
'
OK
'
,
200
job_handlers
=
{}
def
job_handler
(
*
types
,
state
=
'
finished
'
):
def
wrapper
(
func
):
for
jobtype
in
types
:
if
jobtype
not
in
job_handlers
:
job_handlers
[
jobtype
]
=
{}
if
jobtype
not
in
job_handlers
[
jobtype
]:
job_handlers
[
jobtype
][
state
]
=
[]
job_handlers
[
jobtype
][
state
].
append
(
func
)
return
func
return
wrapper
def
schedule_job
(
jobtype
,
data
=
None
,
priority
=
0
):
if
not
data
:
data
=
{}
modify
(
'
INSERT INTO jobs (type, priority, data, time_created) VALUES (?, ?, ?, ?)
'
,
jobtype
,
priority
,
json
.
dumps
(
data
,
default
=
date_json_handler
),
datetime
.
now
())
@app.route
(
'
/internal/jobs/api/job/<int:id>/ping
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@jobs_api_token_required
def
jobs_ping
(
id
):
...
...
This diff is collapsed.
Click to expand it.
server.py
+
33
−
2
View file @
3bfa3abe
...
...
@@ -461,14 +461,45 @@ def dbstatus():
clusters
[
cluster
].
append
(
host
)
return
render_template
(
'
dbstatus.html
'
,
clusters
=
clusters
,
statuses
=
status
,
vars
=
variables
),
200
from
edit
import
edit_handler
job_handlers
=
{}
def
job_handler
(
*
types
,
state
=
'
finished
'
):
def
wrapper
(
func
):
for
jobtype
in
types
:
if
jobtype
not
in
job_handlers
:
job_handlers
[
jobtype
]
=
{}
if
jobtype
not
in
job_handlers
[
jobtype
]:
job_handlers
[
jobtype
][
state
]
=
[]
job_handlers
[
jobtype
][
state
].
append
(
func
)
return
func
return
wrapper
def
schedule_job
(
jobtype
,
data
=
None
,
priority
=
0
):
if
not
data
:
data
=
{}
modify
(
'
INSERT INTO jobs (type, priority, data, time_created) VALUES (?, ?, ?, ?)
'
,
jobtype
,
priority
,
json
.
dumps
(
data
,
default
=
date_json_handler
),
datetime
.
now
())
edit_handlers
=
{}
def
edit_handler
(
*
tables
,
field
=
None
):
def
wrapper
(
func
):
for
table
in
tables
:
if
table
not
in
edit_handlers
:
edit_handlers
[
table
]
=
{}
if
field
not
in
edit_handlers
[
table
]:
edit_handlers
[
table
][
field
]
=
[]
edit_handlers
[
table
][
field
].
append
(
func
)
return
func
return
wrapper
import
edit
import
feeds
import
importer
import
stats
if
'
ICAL_URL
'
in
config
:
import
meetings
import
l2pauth
from
jobs
import
job_handler
,
schedule_job
import
jobs
import
sorter
import
encoding
import
timetable
...
...
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