Skip to content

Updated gadi report#8

Draft
fredjaya wants to merge 4 commits intomasterfrom
updated_gadi_report
Draft

Updated gadi report#8
fredjaya wants to merge 4 commits intomasterfrom
updated_gadi_report

Conversation

@fredjaya
Copy link
Copy Markdown
Member

No description provided.

@fredjaya
Copy link
Copy Markdown
Member Author

Patch with some QoL changes

diff --git a/Scripts/gadi_resource_usage.sh b/Scripts/gadi_resource_usage.sh
index 16f0005..6a88fa6 100755
--- a/Scripts/gadi_resource_usage.sh
+++ b/Scripts/gadi_resource_usage.sh
@@ -5,7 +5,7 @@ module load nextflow
 RUN_NAME="$1"
 
 if [ -z "$RUN_NAME" ]; then
-    echo "No run name supplied. Exiting."
+    echo "No run name supplied. Supply a run name by running nextflow log. Exiting."
     exit 1
 fi
 
@@ -27,7 +27,7 @@ SEARCH_PARAMS=()
 
 nextflow log -f hash,name "$RUN_NAME" > "$TMPOUT"
 
-while read HASH NAME; do
+while read -r HASH _NAME; do
     if $FIRST; then
         SEARCH_PARAMS+=("-path" "*/${HASH}*")
         FIRST=false
@@ -39,7 +39,7 @@ done < "$TMPOUT"
 echo -e "Job_name\tHash\tLog_path\tExit_status\tService_units\tNCPUs_requested\tCPU_time_used\tMemory_requested\tMemory_used\tWalltime_requested\tWalltime_used\tJobFS_requested\tJobFS_used" > "$OUTPUT"
 
 find work -type f \( "${SEARCH_PARAMS[@]}" \) -name ".command.log" | \
-    while read LOG; do
+    while read -r LOG; do
         HASH="${LOG:5:9}"
         JOBNAME=$(grep -m 1 -F "$HASH" "${TMPOUT}" | cut -f 2- )
         awk -v OFS="\t" -v logfile="$LOG" -v hash="$HASH" -v jobname="$JOBNAME" '
@@ -72,7 +72,8 @@ find work -type f \( "${SEARCH_PARAMS[@]}" \) -name ".command.log" | \
         }
         END {
             print jobname, hash, logfile, exit_status, service_units, ncpus_requested, cpu_time_used, memory_requested, memory_used, walltime_requested, walltime_used, jobfs_requested, jobfs_used
-        }' $LOG
+        }' "$LOG"
     done >> "${OUTPUT}"
 
-rm "${TMPOUT}"
\ No newline at end of file
+echo -e "\nSaved to ${OUTPUT}"
+rm "${TMPOUT}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants