summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-01-16 16:02:11 +0000
committerLars Wirzenius <liw@liw.fi>2021-01-16 16:02:11 +0000
commitdc7fd9e24ed488af27b2e5b067652f3ba244bc3d (patch)
treea6fa8bd9e6101466f8e50adb1970a61a7c178309
parent5837d8a8c56cd06a71696ab1152e92d7c1464c57 (diff)
parentdc241ec8d5bbc88d1a4290d832b98b3a3969e3cc (diff)
downloadobnam2-dc7fd9e24ed488af27b2e5b067652f3ba244bc3d.tar.gz
Merge branch 'backupinfo' into 'main'
feat: backup run now ends with a summary See merge request larswirzenius/obnam!65
-rw-r--r--src/backup_progress.rs1
-rw-r--r--src/cmd/backup.rs13
-rw-r--r--subplot/client.py3
3 files changed, 13 insertions, 4 deletions
diff --git a/src/backup_progress.rs b/src/backup_progress.rs
index d65f104..6c1d3e6 100644
--- a/src/backup_progress.rs
+++ b/src/backup_progress.rs
@@ -41,5 +41,6 @@ impl BackupProgress {
pub fn finish(&self) {
self.progress.set_length(self.progress.position());
+ self.progress.finish_and_clear();
}
}
diff --git a/src/cmd/backup.rs b/src/cmd/backup.rs
index 398a8aa..da7298f 100644
--- a/src/cmd/backup.rs
+++ b/src/cmd/backup.rs
@@ -3,9 +3,12 @@ use crate::client::ClientConfig;
use crate::fsiter::FsIterator;
use crate::generation::NascentGeneration;
use log::info;
+use std::time::SystemTime;
use tempfile::NamedTempFile;
pub fn backup(config: &ClientConfig, buffer_size: usize) -> anyhow::Result<()> {
+ let runtime = SystemTime::now();
+
let run = BackupRun::new(config, buffer_size)?;
// Create a named temporary file. We don't meed the open file
@@ -25,7 +28,7 @@ pub fn backup(config: &ClientConfig, buffer_size: usize) -> anyhow::Result<()> {
};
let genlist = run.client().list_generations()?;
- {
+ let file_count = {
let iter = FsIterator::new(&config.root);
let mut new = NascentGeneration::create(&newname)?;
@@ -43,12 +46,16 @@ pub fn backup(config: &ClientConfig, buffer_size: usize) -> anyhow::Result<()> {
}
}
run.progress().finish();
- }
+ new.file_count()
+ };
// Upload the SQLite file, i.e., the named temporary file, which
// still exists, since we persisted it above.
let gen_id = run.client().upload_generation(&newname, buffer_size)?;
- println!("gen id: {}", gen_id);
+ println!("status: OK");
+ println!("duration: {}", runtime.elapsed()?.as_secs());
+ println!("file-count: {}", file_count);
+ println!("generation-id: {}", gen_id);
// Delete the temporary file.q
std::fs::remove_file(&newname)?;
diff --git a/subplot/client.py b/subplot/client.py
index 53c7f6e..d450b4c 100644
--- a/subplot/client.py
+++ b/subplot/client.py
@@ -1,3 +1,4 @@
+import logging
import os
import yaml
@@ -63,7 +64,7 @@ def capture_generation_id(ctx, varname=None):
stdout = runcmd_get_stdout(ctx)
gen_id = "unknown"
for line in stdout.splitlines():
- if line.startswith("gen id:"):
+ if line.startswith("generation-id:"):
gen_id = line.split()[-1]
v = ctx.get("vars", {})