From e879915357fd950eaf1c53701c74ec3679673070 Mon Sep 17 00:00:00 2001 From: Trey Blancher Date: Wed, 21 Dec 2022 12:49:11 -0500 Subject: [PATCH] Updated Rust program caveats --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1a69731..5e6d6b3 100644 --- a/README.md +++ b/README.md @@ -136,13 +136,17 @@ You can use this to review Clarizen, and make sure all time is input correctly. ``` ## Caveats about Rust programs -The Rust programs have similar designs to the older Python and Bash scripts, but Rust is less forgiving regarding errors in the supplied logs (see format above). Namely, if you have too many Begin timestamps, or too many End timestamps, the Rust `timetracker`, `doprocess`, and `chug` programs will panic. They should give a hint as to why they panic, but there is automatic Rust output that may not make it obvious that there's a problem. For instance, with too many Begin timestamps, you'll see an error like the following: +The Rust programs have similar designs to the older Python and Bash scripts, but Rust is less forgiving regarding errors in the supplied logs (see format above). Namely, if you have log entries without a category, or try to use more than one category (`[In Square Brackets]`) in a single entry, Rust `timetracker`, `doprocess`, and `chug` programs will panic and error out. They should give a hint as to why they panic, but there is automatic Rust output that may not make it obvious what the problem is. Due to a recent update to the timelogging library code, too many Begin or End timestamps should be correctly identified. The programs still panic, but they give you an indication on what the problem is. For instance, with too many Begin timestamps, you'll see an error like the following: ``` -thread 'main' panicked at 'Somehow, not a vector!', timelogging/src/lib.rs:88:60 +thread 'main' panicked at 'ERROR: Missing more than one End', timelogging/src/lib.rs:97:21 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` -Unfortunately this doesn't tell you that you have a Begin without a corresponding End timestamp. Too many End timestamps unfortunately has a similar cryptic error. You'll need to review the log to ensure this doesn't happen. You can use the older Python or Bash scripts to help you find the culprit, if you need to. - +Similarly, if you have too many End timestamps, you'll get an error that looks like this: +``` +thread 'main' panicked at 'ERROR: Missing a Begin', timelogging/src/lib.rs:101:21 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +``` +For correct operation, there should be an equal number of Begin and End timestamps. If you're in the middle of a task, the last End is optional, if it's the first entry of that task it will be the minimum duration (0.08 hours). # Older Python and Bash scripts, for comparison ## timetracker.py usage The timetracker.py script is the basis, it tallies the time for each task and then outputs a report on how much each task takes to complete. It takes as its argument one or more text files, the log files in the format above. It should only report one line item per task, regardless of how many times it appears in the log. Each task should have a category/tag in square brackets, the behavior of `do_process.sh` (see below) is now undefined if the tag is left out.