-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Right now the log file is dumped to the terminal, leaving it up to the user to store the log in some appropriate location.
But the log contains valuable info for forensic analysis, most notably the precise version of flyem-snapshot being used.
We should tee the log to the output directory (snapshot directory) as part of the setup during main.py, or offer a wrapper script to the user that creates the snapshot directory and executes flyem-snapshot in combination with tee to write the file.
Something like the untested pseudo-code shown below, but nicer. Maybe we should implement it in Python instead of bash.
Alternatively, maybe we should implement this logic directly into flyem_snapshot.main() instead of creating a wrapper script. That would have the benefit of allowing us to put certain parameters (such as the scp destination`) directly into the config file if desired.
#!/bin/bash
set -e
set -x
CONFIG=$1
NEO4J_DEST=$2
OUTPUT_DIR=$(flyem-snapshot --print-output-directory -c $CONFIG)
mkdir -p ${OUTPUT_DIR}/logs
TIMESTAMP=$(date +%Y-%m-%d.%H%M%S.log)
flyem-snapshot -c $CONFIG | tee logs/${TIMESTAMP}-snapshot.log
ingest-neuprint-snapshot-using-apptainer $OUTPUT_DIR | tee -a logs/${TIMESTAMP}-build-db.log
scp -r $OUTPUT_DIR/neo4j/data $NEO4J_DEST