Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
beat
beat.core
Commits
c023dfa4
There was a problem fetching the pipeline summary.
Commit
c023dfa4
authored
8 years ago
by
Philip ABBET
Browse files
Options
Downloads
Patches
Plain Diff
Fix the execution in a container
parent
14af44b4
No related branches found
No related tags found
1 merge request
!14
Add support to serve databases from a docker container
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beat/core/dbexecution.py
+4
-7
4 additions, 7 deletions
beat/core/dbexecution.py
beat/core/scripts/databases_provider.py
+4
-3
4 additions, 3 deletions
beat/core/scripts/databases_provider.py
with
8 additions
and
10 deletions
beat/core/dbexecution.py
+
4
−
7
View file @
c023dfa4
...
@@ -114,10 +114,8 @@ class DBExecutor(object):
...
@@ -114,10 +114,8 @@ class DBExecutor(object):
self
.
input_list
=
None
self
.
input_list
=
None
self
.
data_sources
=
[]
self
.
data_sources
=
[]
self
.
handler
=
None
self
.
handler
=
None
# runs validation if required
self
.
errors
=
[]
self
.
errors
=
[]
self
.
data
=
data
self
.
data
=
None
# temporary caches, if the user has not set them, for performance
# temporary caches, if the user has not set them, for performance
database_cache
=
database_cache
if
database_cache
is
not
None
else
{}
database_cache
=
database_cache
if
database_cache
is
not
None
else
{}
...
@@ -137,7 +135,7 @@ class DBExecutor(object):
...
@@ -137,7 +135,7 @@ class DBExecutor(object):
self
.
input_list
=
None
self
.
input_list
=
None
self
.
data_sources
=
[]
self
.
data_sources
=
[]
if
not
isinstance
(
data
,
dict
):
#user has passed a file
pointer
if
not
isinstance
(
data
,
dict
):
#user has passed a file
name
if
not
os
.
path
.
exists
(
data
):
if
not
os
.
path
.
exists
(
data
):
self
.
errors
.
append
(
'
File not found: %s
'
%
data
)
self
.
errors
.
append
(
'
File not found: %s
'
%
data
)
return
return
...
@@ -254,9 +252,8 @@ class DBExecutor(object):
...
@@ -254,9 +252,8 @@ class DBExecutor(object):
)
)
self
.
input_list
.
add
(
group
)
self
.
input_list
.
add
(
group
)
input_conf
=
self
.
data
[
'
inputs
'
][
name
]
input_db
=
self
.
databases
[
details
[
'
database
'
]]
input_db
=
self
.
databases
[
input_conf
[
'
database
'
]]
input_dataformat_name
=
input_db
.
set
(
details
[
'
protocol
'
],
details
[
'
set
'
])[
'
outputs
'
][
details
[
'
output
'
]]
input_dataformat_name
=
input_db
.
set
(
input_conf
[
'
protocol
'
],
input_conf
[
'
set
'
])[
'
outputs
'
][
name
]
group
.
add
(
inputs
.
Input
(
name
,
self
.
dataformat_cache
[
input_dataformat_name
],
data_source
))
group
.
add
(
inputs
.
Input
(
name
,
self
.
dataformat_cache
[
input_dataformat_name
],
data_source
))
...
...
This diff is collapsed.
Click to expand it.
beat/core/scripts/databases_provider.py
+
4
−
3
View file @
c023dfa4
...
@@ -132,7 +132,8 @@ def main():
...
@@ -132,7 +132,8 @@ def main():
database_cache
=
{}
database_cache
=
{}
try
:
try
:
dbexecutor
=
DBExecutor
(
args
[
'
<dir>
'
],
'
configuration.json
'
,
dbexecutor
=
DBExecutor
(
os
.
path
.
join
(
args
[
'
<dir>
'
],
'
prefix
'
),
os
.
path
.
join
(
args
[
'
<dir>
'
],
'
configuration.json
'
),
dataformat_cache
,
database_cache
)
dataformat_cache
,
database_cache
)
except
(
MemoryError
):
except
(
MemoryError
):
raise
raise
...
@@ -141,7 +142,7 @@ def main():
...
@@ -141,7 +142,7 @@ def main():
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
tb
=
traceback
.
extract_tb
(
exc_traceback
)
tb
=
traceback
.
extract_tb
(
exc_traceback
)
s
=
''
.
join
(
traceback
.
format_list
(
tb
[
4
:]))
#exclude this file
s
=
''
.
join
(
traceback
.
format_list
(
tb
[
4
:]))
#exclude this file
s
=
s
.
replace
(
args
[
'
<dir>
'
]).
strip
()
s
=
s
.
replace
(
args
[
'
<dir>
'
]
,
''
).
strip
()
raise
UserError
(
"
%s%s: %s
"
%
(
s
,
type
(
e
).
__name__
,
e
))
raise
UserError
(
"
%s%s: %s
"
%
(
s
,
type
(
e
).
__name__
,
e
))
# Execute the code
# Execute the code
...
@@ -156,7 +157,7 @@ def main():
...
@@ -156,7 +157,7 @@ def main():
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
exc_type
,
exc_value
,
exc_traceback
=
sys
.
exc_info
()
tb
=
traceback
.
extract_tb
(
exc_traceback
)
tb
=
traceback
.
extract_tb
(
exc_traceback
)
s
=
''
.
join
(
traceback
.
format_list
(
tb
[
4
:]))
s
=
''
.
join
(
traceback
.
format_list
(
tb
[
4
:]))
s
=
s
.
replace
(
args
[
'
<dir>
'
]).
strip
()
s
=
s
.
replace
(
args
[
'
<dir>
'
]
,
''
).
strip
()
raise
UserError
(
"
%s%s: %s
"
%
(
s
,
type
(
e
).
__name__
,
e
))
raise
UserError
(
"
%s%s: %s
"
%
(
s
,
type
(
e
).
__name__
,
e
))
except
UserError
as
e
:
except
UserError
as
e
:
...
...
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