Netrender AWK statistics script

Un poco tarde pero les dejo un script que hice con AWK para generar estadísticas del netrender.

#!/usr/bin/awk -f
#v002# neSRI - Netrender Statistic Reporting Interface
#
# The goal is to generate report from html job file seen in netrender
#       $2      $3      $4      $5
#       frame   status  time    server
BEGIN {
        print " --- Begin neSRI script v002---";
        RS="<tr>";
        FS="<td>";
        OFS="";
}
{
        if ( NF == 8 ) {
                gsub(/<\/td>/,"");
                if ( $3 == "Done" ) {
                        doneframes++;
                        gsub(/s<td>/,"<td>");
                        ttime +=$4;
                }else{
                        if ( $3 == "Queued") {
                                queueframes++;
                        }
                }
        }
}
END {
        print " --- Report --- ";
        if ( doneframes == 0 ) {
                print "No frames done yet, skipping all report!";
        }else{
                print "Doneframes: "doneframes;
                #Donetime part
                if ( ttime >= 60 ) {
                        if ( ttime >= 3600 ) {
                                if ( ttime >= 86400) {
                                        print "Donetime: "ttime/86400" days";
                                }else{
                                        print "Donetime: "ttime/3600" hours";
                                }
                        }else{
                                print "Donetime: "ttime/60" min";
                        }
                }else{
                        print "Donetime: "ttime" sec";
                }
                #Average part
                avg=ttime/doneframes;
                if ( avg >= 60 ) {
                        if ( avg >= 3600 ) {
                                if ( avg >= 86400 ) {
                                        print "Average: "ttime/doneframes/86400" days per frame";
                                }else{
                                        print "Average: "ttime/doneframes/3600" hours per frame";
                                }
                        }else{
                                print "Average: "ttime/doneframes/60" min per frame";
                        }
                }else{
                        print "Average: "ttime/doneframes" sec";
                }
                #Queue part
                if ( queueframes != 0 ) {
                queue=avg*queueframes;
                        if ( queue >= 60 ) {
                                if ( queue >= 3600 ) {
                                        if ( queue >= 86400 ) {
                                                print "Expecting to complete "queueframes" frames in "queue/86400" days";
                                        }else{
                                                print "Expecting to complete "queueframes" frames in "queue/3600" hours";
                                        }
                                }else{
                                        print "Expecting to complete "queueframes" frames in "queue/60" min";
                                }
                        }else{
                                print "Expecting to complete "queueframes" frames in "queue" sec";
                        }
                }
        }
}

Lo que hacemos es descargar el archivo .html del trabajo en curso o finalizado y aplicando el script calcular cuanto demorara el trabajo completo.

Primero un wget http://server.com:8000/html/job10
Luego corremos el script: ./script.awk job10
Y finalmente veremos algo así en la salida:

— Begin neSRI script v002—
— Report —
Doneframes: 480
Donetime: 6.59729 days
Average: 19.7919 min per frame
Expecting to complete 61 frames in 20.1217 hours

Pueden encontrarlo también en el foro de blenderartists.org

Deja un comentario

Para proteger el blog de SPAM, le pedimos que complete la tarea:WordPress CAPTCHA