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
ed056ea1
Commit
ed056ea1
authored
7 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Added nlfix option to query to disable newline substitution
parent
f5e1df0e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
db.py
+2
-2
2 additions, 2 deletions
db.py
jobs.py
+1
-1
1 addition, 1 deletion
jobs.py
with
3 additions
and
3 deletions
db.py
+
2
−
2
View file @
ed056ea1
...
@@ -84,7 +84,7 @@ elif config['DB_ENGINE'] == 'mysql':
...
@@ -84,7 +84,7 @@ elif config['DB_ENGINE'] == 'mysql':
db
.
close
()
db
.
close
()
return
res
return
res
def
query
(
operation
,
*
params
,
delim
=
"
sep
"
):
def
query
(
operation
,
*
params
,
delim
=
"
sep
"
,
nlfix
=
True
):
operation
,
params
=
fix_query
(
operation
,
params
)
operation
,
params
=
fix_query
(
operation
,
params
)
cur
=
get_dbcursor
()
cur
=
get_dbcursor
()
cur
.
execute
(
operation
,
params
)
cur
.
execute
(
operation
,
params
)
...
@@ -106,7 +106,7 @@ def query(operation, *params, delim="sep"):
...
@@ -106,7 +106,7 @@ def query(operation, *params, delim="sep"):
if
name
==
delim
:
if
name
==
delim
:
ptr
=
res
[
-
1
][
col
]
=
{}
ptr
=
res
[
-
1
][
col
]
=
{}
continue
continue
if
type
(
col
)
==
str
:
if
type
(
col
)
==
str
and
nlfix
:
col
=
col
.
replace
(
'
\\
n
'
,
'
\n
'
).
replace
(
'
\\
r
'
,
'
\r
'
)
col
=
col
.
replace
(
'
\\
n
'
,
'
\n
'
).
replace
(
'
\\
r
'
,
'
\r
'
)
ptr
[
name
]
=
col
ptr
[
name
]
=
col
return
res
return
res
...
...
This diff is collapsed.
Click to expand it.
jobs.py
+
1
−
1
View file @
ed056ea1
...
@@ -106,7 +106,7 @@ def jobs_ping(id):
...
@@ -106,7 +106,7 @@ def jobs_ping(id):
query
(
'
UPDATE jobs SET time_finished = ?, status = ?, state =
"
finished
"
where id = ?
'
,
datetime
.
now
(),
status
,
id
)
query
(
'
UPDATE jobs SET time_finished = ?, status = ?, state =
"
finished
"
where id = ?
'
,
datetime
.
now
(),
status
,
id
)
else
:
else
:
query
(
'
UPDATE jobs SET worker = ?, last_ping = ?, status = ?, state = ? where id = ?
'
,
hostname
,
datetime
.
now
(),
status
,
state
,
id
)
query
(
'
UPDATE jobs SET worker = ?, last_ping = ?, status = ?, state = ? where id = ?
'
,
hostname
,
datetime
.
now
(),
status
,
state
,
id
)
job
=
query
(
'
SELECT * FROM jobs WHERE id = ?
'
,
id
)[
0
]
job
=
query
(
'
SELECT * FROM jobs WHERE id = ?
'
,
id
,
nlfix
=
False
)[
0
]
for
func
in
job_handlers
.
get
(
job
[
'
type
'
],
{}).
get
(
state
,
[]):
for
func
in
job_handlers
.
get
(
job
[
'
type
'
],
{}).
get
(
state
,
[]):
try
:
try
:
func
(
id
,
job
[
'
type
'
],
json
.
loads
(
job
[
'
data
'
]),
state
,
json
.
loads
(
job
[
'
status
'
]))
func
(
id
,
job
[
'
type
'
],
json
.
loads
(
job
[
'
data
'
]),
state
,
json
.
loads
(
job
[
'
status
'
]))
...
...
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