Skip to content

Commit dedf986

Browse files
Start uploader earlier, also use .exception() instead of plain-raise
1 parent 1012e34 commit dedf986

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

mongodb_consistent_backup/Common/DB.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ def connection(self):
7272
return self._conn
7373

7474
def close(self):
75-
if self._conn:
75+
if self._conn:
7676
return self._conn.close()

mongodb_consistent_backup/Main.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def run(self):
157157
try:
158158
self.notify = Notify(self.config)
159159
except Exception, e:
160-
raise e
160+
self.exception("Problem starting notifier! Error: %s" % e)
161161

162162
# Setup the archiver
163163
try:
@@ -166,7 +166,17 @@ def run(self):
166166
self.backup_root_directory,
167167
)
168168
except Exception, e:
169-
raise e
169+
self.exception("Problem starting archiver! Error: %s" % e)
170+
171+
# Setup the uploader
172+
try:
173+
self.upload = Upload(
174+
self.config,
175+
self.backup_root_directory,
176+
self.backup_root_subdirectory
177+
)
178+
except Exception, e:
179+
self.exception("Problem starting uploader! Error: %s" % e)
170180

171181
if not self.is_sharded:
172182
logging.info("Running backup of %s:%s in replset mode" % (self.config.host, self.config.port))
@@ -293,11 +303,6 @@ def run(self):
293303

294304
# upload backup
295305
try:
296-
self.upload = Upload(
297-
self.config,
298-
self.backup_root_directory,
299-
self.backup_root_subdirectory
300-
)
301306
self.upload.upload()
302307
except Exception, e:
303308
self.exception("Problem performing upload of backup! Error: %s" % e)

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ if [ -d ${srcdir} ]; then
9797
if [ ! -d ${pexdir} ]; then
9898
mkdir -p ${pexdir}
9999
else
100-
rm -f ${pexdir}/build/mongodb_consistent_backup-*
100+
rm -f ${pexdir}/build/mongodb_consistent_backup-*.whl
101101
fi
102102
[ ! -d ${bindir} ] && mkdir -p ${bindir}
103103
${venvdir}/bin/python2.7 ${venvdir}/bin/pex -o ${output_file} -m ${mod_name} -r ${require_file} --pex-root=${pexdir} ${builddir}

0 commit comments

Comments
 (0)