Commit 28e5ff4b authored by Georges Racinet's avatar Georges Racinet 🌳
Browse files

Heptapod: added start/end logging for backups

On HDK instances, the backup restoration is often really long,
it's worthwile to know it has started and is still ongoing.

In cases one launches the tests and comes back later, it is also
useful to notice how long it took (time to purge repositories/ and
run `rake dev:setup` to start afresh)

Also, an immediate log that the restoration failed does not hurt.
parent 10f27300c0d5
Pipeline #18230 failed with stage
in 25 minutes and 21 seconds
......@@ -466,7 +466,12 @@ class Heptapod:
"""
if clean_previous:
self.remove_all_backups()
start = time.time()
logger.info("Starting backup task")
self.rake('gitlab:backup:create')
elapsed = time.time() - start
logger.info("Backup task finished in %d seconds (%.1f minutes)",
elapsed, elapsed / 60)
@contextlib.contextmanager
def backup_restore(self):
......@@ -479,13 +484,20 @@ class Heptapod:
"""
try:
self.gitlab_ctl('stop', services=self.RAILS_SERVICES)
start = time.time()
logger.info("Starting backup restoration")
self.rake('gitlab:backup:restore', 'force=yes')
elapsed = time.time() - start
logger.info("Backup restoration finished in %d seconds (%.1f minutes)."
"Now restarting Rails.",
elapsed, elapsed / 60)
self.gitlab_ctl('start', services=self.RAILS_SERVICES)
self.wait_startup()
yield
except Exception:
logger.error("Backup restoration failed")
# these are idempotent
self.gitlab_ctl('start', services=self.RAILS_SERVICES)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment