Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
migration_scripts
Project
Overview
Details
Activity
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
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
serpucga
migration_scripts
Commits
d3ed1927
Commit
d3ed1927
authored
Jul 24, 2019
by
serpucga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beep at failure too
parent
6a15c8d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
pymongoexport_csv.py
pymongoexport_csv.py
+6
-2
No files found.
pymongoexport_csv.py
View file @
d3ed1927
...
...
@@ -35,6 +35,8 @@ else:
logger
=
logging
.
getLogger
(
__name__
)
# Initialize some variables
duration
=
1
freq
=
440
script_dir
=
os
.
path
.
dirname
(
__file__
)
output_dir
=
os
.
path
.
join
(
script_dir
,
"pymongodump"
,
args
.
database
)
header_file
=
os
.
path
.
join
(
script_dir
,
"config"
,
"header.txt"
)
...
...
@@ -98,6 +100,7 @@ try:
writer_worker
.
start
()
except
Exception
:
logger
.
error
(
"There was a failure in the filesystem writer"
,
exc_info
=
True
)
os
.
system
(
"play -nq -t alsa synth {} sine {}"
.
format
(
duration
,
freq
))
sys
.
exit
(
1
)
# Launch pool of workers to perform the format conversion
...
...
@@ -107,10 +110,12 @@ try:
except
utils
.
ExceptionAtPage
as
exc
:
logger
.
error
(
"Error detected at page {}"
.
format
(
exc
.
error_page
))
task_queue
.
put
((
exc
.
error_page
,
"ERROR"
))
os
.
system
(
"play -nq -t alsa synth {} sine {}"
.
format
(
duration
,
freq
))
sys
.
exit
(
1
)
except
(
Exception
,
KeyboardInterrupt
):
logger
.
error
(
"Error detected"
,
exc_info
=
True
)
task_queue
.
put
((
-
2
,
"ERROR"
))
os
.
system
(
"play -nq -t alsa synth {} sine {}"
.
format
(
duration
,
freq
))
sys
.
exit
(
1
)
task_queue
.
put
((
-
1
,
"END"
))
...
...
@@ -124,6 +129,7 @@ try:
except
(
Exception
,
KeyboardInterrupt
):
logger
.
error
(
"The collection was converted correctly to CSV, but something"
+
" failed when generating the metadata file"
,
exc_info
=
True
)
os
.
system
(
"play -nq -t alsa synth {} sine {}"
.
format
(
duration
,
freq
))
sys
.
exit
(
1
)
if
globals
.
timing
:
logger
.
critical
(
...
...
@@ -133,7 +139,5 @@ if globals.timing:
"Total execution time: {}s"
.
format
(
time
.
time
()
-
time0
))
duration
=
1
freq
=
440
os
.
system
(
"play -nq -t alsa synth {} sine {}"
.
format
(
duration
,
freq
))
logger
.
info
(
"Conversion completed successfully!!"
)
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