summary of all bq jobs

后端 未结 2 1875
情歌与酒
情歌与酒 2021-01-03 02:42

Is there a way to list all job id\'s using bq command line tool for a given timeframe? What I need to do is to loop through all Id\'s and find if there is any error.

2条回答
  •  既然无缘
    2021-01-03 03:12

    The following shell script is close to what I need to report.

    #!/bin/sh
    bq ls  -j `bq show | grep ^Project | awk '{print $2}'` | grep "`date +'%d %b'`" | awk '{print $1}' > tosave.txt
    
    for myjob in `cat tosave.txt`
    do
    bq ls  -j `bq show | grep ^Project | awk '{print $2}'` | grep $myjob
    
    bq show --format=prettyjson -j $myjob | grep -C2 "message" | head
    
    done
    

提交回复
热议问题