Changeset 246


Ignore:
Timestamp:
Oct 26, 2009, 3:37:21 PM (11 years ago)
Author:
zerodeux
Message:

0.5: better logging, adding jobqueue size (aka 'todo')

Location:
jobq
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • jobq/CHANGES

    r245 r246  
     1jobq 0.5
     2
     3        * Better logging, easier to read
     4    * Logging jobqueue size at each job start
     5
    16jobq 0.4
    27
  • jobq/debian/changelog

    r245 r246  
    44
    55 -- Vincent CARON <vcaron@bearstech.com>  Mon, 26 Oct 2009 15:13:31 +0100
     6
     7jobq (0.3-1) stable; urgency=low
     8
     9  * Upstream update.
     10
     11 -- Vincent CARON <vcaron@bearstech.com>  Tue, 20 Oct 2009 00:34:05 +0200
    612
    713jobq (0.2-1) stable; urgency=low
  • jobq/jobq

    r245 r246  
    6060
    6161    while true; do
    62         # Fetch older job file
    63         job=`ls -1rt 2>/dev/null | head -n1`
     62        # Fetch job list in time order, older is first
     63        jobl=`ls -1rt 2>/dev/null`
     64        job=`echo "$jobl" | head -n1`
    6465
    6566        if [ -n "$job" ]; then
    66             cmd=`cat $job`         # content of job file, the command to run
    67             job=`basename "$job"`  # job ID
    68             jobt=`stat -c%Y $job`  # job submission time
    69             rm $job                # remove the job, it _will_ be run in a few lines
     67            cmd=`cat $job`              # content of job file, the command to run
     68            job=`basename "$job"`       # job ID
     69            jobt=`stat -c%Y $job`       # job submission time
     70            todo=`echo "$jobl" |wc -l`  # job queue size
     71            rm $job                     # remove the job, it _will_ be run in a few lines
     72            todo=$(( $todo - 1 ))
    7073
    7174            # Run job in a subshell, capture stdin+stderr, send to syslog
    72             export jobt
     75            export jobt todo
    7376            (
    7477                t0=`date +%s`
    7578                late=$(( $t0 - $jobt ))
    76                 echo "starting (delay=$late sec): $cmd"
     79                echo "start (delay:$late sec, todo:$todo): $cmd"
    7780                eval $cmd 2>&1
    7881                ret=$?
    7982                dt=$(( `date +%s` - $t0 ))
    80                 echo "done (exit=$ret, time=$dt sec)"
     83                echo "done (time:$dt sec, exit:$ret)"
    8184            ) | logger -t "job[$job]"
    8285        else
Note: See TracChangeset for help on using the changeset viewer.