- Timestamp:
- Apr 3, 2019, 1:34:04 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/night_report.pl (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/night_report.pl
r40651 r40666 16 16 'report' => \$report, # Formatted for ps-obs report 17 17 'very-verbose' => \$verbose2, # Print to stdout 18 'chunks' => \$chunks, # give information on the current status of the chunks 18 19 ) or pod2usage( 2 ); 19 20 … … 76 77 # my $query = "SELECT Nvisit, count(*) FROM"; 77 78 # $query .= " ("; 78 # $query .= " SELECT object, filter, chunk, count(*) as Nvisit FROM";79 #$query .= " (";80 my $query= "SELECT object, filter, comment, 'S', substr(comment, 1, position(' ' in comment)) as chunk, 'E'";79 my $query = " SELECT object, filter, chunk, count(*) as Nvisit FROM"; 80 $query .= " ("; 81 $query .= "SELECT object, filter, comment, 'S', substr(comment, 1, position(' ' in comment)) as chunk, 'E'"; 81 82 $query .= " FROM rawExp"; 82 83 $query .= " LEFT JOIN chipRun using (exp_id)"; … … 91 92 $query .= " AND (camProcessedExp.quality IS NULL or camProcessedExp.quality = 0)"; 92 93 # $query .= " GROUP BY comment, filter, substr(comment, 1, position(' ' in comment))"; 93 #$query .= " ) AS tableChunks GROUP BY object, filter, chunk";94 $query .= " ) AS tableChunks GROUP BY object, filter, chunk"; 94 95 # $query .= " ) AS tableVisits GROUP BY Nvisit"; 95 96 … … 392 393 $diffExpect = 0; 393 394 while (@row = $result->fetchrow_array()) { 394 #printf "%8s %15s : ", $row[0], $row[1]; # c, count(*)395 printf "%8s %15s : ", $row[0], $row[1]; # c, count(*) 395 396 if ($row[0] == 1) { 396 397 if ($row[1] == 1) { $verb = "tuple has"; } else { $verb = "tuples have"; } … … 464 465 # my $result = &mysql_select (""); 465 466 my $query = ""; 466 $query .= " SELECT exp_name, object, filter, substr(comment, 1, position(' ' in comment)) as chunk";467 $query .= " SELECT 'EXAMPLE', exp_name, object, filter, substr(comment, 1, position(' ' in comment)) as chunk"; 467 468 $query .= " FROM rawExp"; 468 469 $query .= " LEFT JOIN chipRun using (exp_id)"; … … 491 492 $query .= " WHERE data_group like '%$dataGroupDate'"; 492 493 $query .= " AND label NOT LIKE '%WS.nigh%'"; 494 $query .= " AND label NOT LIKE 'goto_cleaned'"; 493 495 $query .= " GROUP BY label, state"; 494 496 … … 519 521 $query .= " WHERE data_group LIKE '%$dataGroupDate%'"; 520 522 $query .= " AND label NOT LIKE '%WS.nigh%'"; 523 $query .= " AND label NOT LIKE 'goto_cleaned'"; 521 524 $query .= " AND (quality IS NULL OR quality = 0)"; 522 525 $query .= " GROUP BY label, state, diff_id"; … … 542 545 $query .= " WHERE data_group LIKE '%$dataGroupDate'"; 543 546 $query .= " AND diffRun.label NOT LIKE '%WS.nigh%'"; 547 $query .= " AND diffRun.label NOT LIKE 'goto_cleaned'"; 544 548 $query .= " GROUP BY diffRun.label, publishRun.state"; 545 549 … … 762 766 } 763 767 768 # count the number of chunks, and their status: 769 if ($verbose or $chunks) { 770 print "Current status of SS chunks:\n"; 771 772 #This is a long query, but it efficiently gathers all the necessary information 773 my $query = "SELECT groupchunk.chunk,groupchunk.Nquad_firstvisit,group4.Nquad_fourvisits,groupdiff.Ndiffs FROM"; 774 $query .= " ("; 775 $query .= " SELECT dateobs,comment,substr(comment, 1, position(' ' in comment)) AS chunk,count(*) AS Nquad_firstvisit"; 776 $query .= " FROM rawExp"; 777 $query .= " WHERE dateobs LIKE '$date%' AND obs_mode LIKE '%SS%'"; 778 $query .= " AND obs_mode LIKE '%SS%' AND obs_mode NOT LIKE 'ENGINEERING'"; 779 $query .= " AND comment LIKE '%visit 1%'"; 780 $query .= " GROUP BY chunk"; 781 $query .= " ) AS groupchunk"; 782 $query .= " LEFT JOIN"; 783 $query .= " ("; 784 $query .= " SELECT groupobj.chunk,count(*) AS Nquad_fourvisits FROM "; 785 $query .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(*) AS Nvisits"; 786 $query .= " FROM rawExp"; 787 $query .= " WHERE obs_mode LIKE '%' AND dateobs LIKE '$date%' AND obs_mode like '%SS%'"; 788 $query .= " AND obs_mode NOT LIKE 'ENGINEERING' AND comment LIKE '%visit%'"; 789 $query .= " GROUP BY object, filter, chunk"; 790 $query .= " ) AS groupobj"; 791 $query .= " WHERE groupobj.Nvisits = 4 "; 792 $query .= " GROUP BY groupobj.chunk"; 793 $query .= " ) AS group4"; 794 $query .= " on groupchunk.chunk=group4.chunk"; 795 $query .= " LEFT JOIN"; 796 $query .= " ("; 797 $query .= " SELECT substr(expall.comment, 1, position(' ' in expall.comment)) AS chunk,count(*) AS Ndiffs FROM "; 798 $query .= " (SELECT exp_name,comment,dateobs"; 799 $query .= " FROM rawExp "; 800 $query .= " WHERE dateobs LIKE '$date%' AND obs_mode LIKE '%SS%' AND obs_mode NOT LIKE 'ENGINEERING'"; 801 $query .= " ) AS expall "; 802 $query .= " LEFT JOIN"; 803 $query .= " (SELECT * FROM "; 804 $query .= " ("; 805 $query .= " (SELECT exp_name FROM "; 806 $query .= " diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp1=warp_id)"; 807 $query .= " JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)"; 808 $query .= " WHERE rawExp.dateobs LIKE '$date%' AND diffRun.reduction LIKE 'SWEETSPOT'"; 809 $query .= " AND stack2 IS NULL AND diffRun.diff_id=stage_id"; 810 $query .= " ) "; 811 $query .= " UNION "; 812 $query .= " (SELECT exp_name FROM"; 813 $query .= " diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp2=warp_id)"; 814 $query .= " JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)"; 815 $query .= " WHERE rawExp.dateobs LIKE '$date%' AND diffRun.reduction LIKE 'SWEETSPOT'"; 816 $query .= " AND stack2 IS NULL AND diffRun.diff_id=stage_id"; 817 $query .= " )"; 818 $query .= " ) AS diffgather "; 819 $query .= " GROUP BY diffgather.exp_name"; 820 $query .= " ) AS exppub"; 821 $query .= " ON expall.exp_name=exppub.exp_name"; 822 $query .= " WHERE exppub.exp_name=expall.exp_name"; 823 $query .= " GROUP BY chunk "; 824 $query .= " ) AS groupdiff"; 825 $query .= " ON groupchunk.chunk=groupdiff.chunk"; 826 827 my $result = &mysql_select ($query); 828 829 printf "%23s | %23s | %23s | %23s |\n", "chunk", "Nquad_firstvisit done", "Nquad_fourvisits done", "Ndiffs done"; 830 while (@row = $result->fetchrow_array()) { 831 if ($row[1] ne $row[2]) { 832 if ($row[3] ne ($row[1]*4)) {printf "%23s | %23s | %23s | %19s%4s | %23s\n", $row[0], $row[1], $row[2], $row[3], "/? ", "chunk not finished";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 833 if ($row[3] eq ($row[1]*4)) {printf "%23s | %23s | %23s | %19s%4s | %23s\n", $row[0], $row[1], $row[2], $row[3], "/? ", "chunk done";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 834 } 835 if ($row[1] eq $row[2]) { 836 if ($row[3] ne ($row[1]*4)) {printf "%23s | %23s | %23s | %19s%1s%3s | %23s\n", $row[0], $row[1], $row[2], $row[3],"/",$row[1]*4, "chunk not finished";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 837 if ($row[3] eq ($row[1]*4)) {printf "%23s | %23s | %23s | %19s%1s%3s | %23s\n", $row[0], $row[1], $row[2], $row[3],"/",$row[1]*4, "chunk done";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 838 } 839 } 840 841 print "\n"; 842 } 843 764 844 exit 0; 765 845
Note:
See TracChangeset
for help on using the changeset viewer.
