Changeset 753 for branches/0.4/web/addons/job_monarch/overview.php
- Timestamp:
- 03/26/13 21:38:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/overview.php
r743 r753 23 23 */ 24 24 25 global $GANGLIA_PATH, $clustername, $tpl , $filter, $cluster, $get_metric_string, $cluster_url, $sh;25 global $GANGLIA_PATH, $clustername, $tpl_data, $filter, $cluster, $get_metric_string, $cluster_url, $sh; 26 26 global $hosts_up, $m, $start, $end, $filterorder, $COLUMN_REQUESTED_MEMORY, $COLUMN_QUEUED, $COLUMN_NODES, $hostname, $piefilter; 27 27 global $longtitle, $title, $range; 28 28 29 $tpl->assign( "clustername", $clustername ); 29 include_once "./dwoo/dwooAutoload.php"; 30 31 global $dwoo; 32 33 $tpl = new Dwoo_Template_File("templates/overview.tpl"); 34 $tpl_data = new Dwoo_Data(); 35 36 $tpl_data->assign( "clustername", $clustername ); 30 37 31 38 if( $JOB_ARCHIVE ) 32 39 { 33 $tpl ->assign( "cluster_url", rawurlencode($clustername) );40 $tpl_data->assign( "cluster_url", rawurlencode($clustername) ); 34 41 } 35 42 … … 52 59 { 53 60 54 global $tpl , $filter, $clustername, $piefilter, $data_gatherer, $myxml_data, $filterorder;61 global $tpl_data, $filter, $clustername, $piefilter, $data_gatherer, $myxml_data, $filterorder, $_SESSION; 55 62 56 63 $filter_image_url = ""; 57 64 58 $tpl->gotoBlock( "_ROOT" );59 60 65 foreach( $filter as $filtername => $filtervalue ) 61 66 { 62 $tpl ->assign( $filtername, $filtervalue );67 $tpl_data->assign( $filtername, $filtervalue ); 63 68 64 69 $filter_image_url .= "&$filtername=$filtervalue"; … … 78 83 $ic->draw(); 79 84 80 $tpl->assign( "clusterimage", "./image.php?". session_name() . "=" . session_id() ."&c=".rawurlencode($clustername)."&j_view=big-clusterimage".$filter_image_url ); 81 82 $tpl->newBlock( "node_clustermap" ); 83 $tpl->assign( "node_area_map", $ic->getImagemapArea() ); 84 $tpl->gotoBlock( "_ROOT" ); 85 86 $tpl->assign( "order", $filterorder ); 85 $tpl_data->assign( "clusterimage", "./image.php?". session_name() . "=" . session_id() ."&c=".rawurlencode($clustername)."&j_view=big-clusterimage".$filter_image_url ); 86 87 $tpl_data->assign( "node_clustermap", "yes" ); 88 $tpl_data->assign( "node_area_map", $ic->getImagemapArea() ); 89 90 $tpl_data->assign( "order", $filterorder ); 87 91 88 92 if( array_key_exists( "id", $filter ) ) … … 101 105 $pie = drawPie(); 102 106 103 $tpl ->assign("pie", $pie );107 $tpl_data->assign("pie", $pie ); 104 108 } 105 109 … … 504 508 function makeOverview() 505 509 { 506 global $ jobs, $nodes, $heartbeat, $clustername, $tpl;510 global $dwoo, $tpl, $tpl_data, $jobs, $nodes, $heartbeat, $clustername, $tpl_data; 507 511 global $sortorder, $sortby, $filter, $sh, $hc, $m, $range; 508 512 global $cluster_url, $get_metric_string, $host_url, $metrics; … … 520 524 $metricname = "load_one"; 521 525 522 $tpl ->assign("sortorder", $sortorder );523 $tpl ->assign("sortby", $sortby );526 $tpl_data->assign("sortorder", $sortorder ); 527 $tpl_data->assign("sortby", $sortby ); 524 528 525 529 $sorted_jobs = sortJobs( $jobs, $sortby, $sortorder ); … … 565 569 if( $COLUMN_REQUESTED_MEMORY ) 566 570 { 567 $tpl ->newBlock( "column_header_req_mem" );571 $tpl_data->assign( "column_header_req_mem", "yes" ); 568 572 } 569 573 … … 572 576 if( $COLUMN_NODES ) 573 577 { 574 $tpl ->newBlock( "column_header_nodes" );578 $tpl_data->assign( "column_header_nodes", "yes" ); 575 579 } 576 580 … … 579 583 if( $COLUMN_QUEUED ) 580 584 { 581 $tpl ->newBlock( "column_header_queued" );585 $tpl_data->assign( "column_header_queued", "yes" ); 582 586 } 583 587 … … 609 613 } 610 614 615 $node_list = array(); 611 616 612 617 foreach( $sorted_jobs as $jobid => $sortdec ) … … 711 716 } 712 717 718 713 719 if( $display_job ) 714 720 { 715 $tpl->newBlock( "node" ); 716 $tpl->assign( "clustername", $clustername ); 717 $tpl->assign( "id", $jobid ); 721 $job_loop = array(); 722 $job_loop["clustername"] = $clustername; 723 724 $job_loop["id"] = $jobid; 718 725 719 726 $last_displayed_job = $jobid; 720 727 721 $ tpl->assign( "state", $jobs[$jobid]['status'] );728 $job_loop["state"] = $jobs[$jobid]['status']; 722 729 723 730 $fullstate = ''; … … 732 739 } 733 740 734 $ tpl->assign( "fullstate", $fullstate );741 $job_loop["fullstate"] = $fullstate; 735 742 736 $ tpl->assign( "owner", $jobs[$jobid]['owner'] );737 $ tpl->assign( "queue", $jobs[$jobid]['queue'] );743 $job_loop["owner"] = $jobs[$jobid]['owner']; 744 $job_loop["queue"] = $jobs[$jobid]['queue']; 738 745 739 746 $fulljobname = $jobs[$jobid]['name']; 740 $shortjobname 741 742 $ tpl->assign( "fulljobname", $fulljobname );747 $shortjobname = ''; 748 749 $job_loop["fulljobname"] = $fulljobname; 743 750 744 751 $fulljobname_fields = explode( ' ', $fulljobname ); … … 753 760 if( $capjobname ) 754 761 { 755 $tpl->newBlock( "jobname_hint_start" );756 $ tpl->gotoBlock( "node" );762 //$tpl_data->assign( "jobname_hint_start", "yes" ); 763 $job_loop[ "jobname_hint_start" ] = "yes"; 757 764 758 765 $shortjobname = substr( $fulljobname, 0, 10 ) . '..'; … … 763 770 } 764 771 765 $ tpl->assign( "name", $shortjobname );772 $job_loop["name"] = $shortjobname; 766 773 767 774 if( $capjobname ) 768 775 { 769 $tpl->newBlock( "jobname_hint_end" );770 $ tpl->gotoBlock( "node" );776 //$tpl_data->assign( "jobname_hint_end", "yes" ); 777 $job_loop[ "jobname_hint_end" ] = "yes"; 771 778 } 772 779 773 780 $domain = $jobs[$jobid]['domain']; 774 781 775 $ tpl->assign( "req_cpu", makeTime( timeToEpoch( $jobs[$jobid]['requested_time'] )) );782 $job_loop["req_cpu"] = makeTime( timeToEpoch( $jobs[$jobid]['requested_time'] ) ); 776 783 777 784 if( $COLUMN_REQUESTED_MEMORY ) 778 785 { 779 $tpl->newBlock( "column_req_mem" );780 $ tpl->assign( "req_memory", $jobs[$jobid]['requested_memory'] );781 $ tpl->gotoBlock( "node" );786 //$tpl_data->assign( "column_req_mem", "yes" ); 787 $job_loop[ "column_req_mem" ] = "yes"; 788 $job_loop["req_memory"] = $jobs[$jobid]['requested_memory']; 782 789 } 783 790 … … 785 792 if( $COLUMN_QUEUED ) 786 793 { 787 $tpl->newBlock( "column_queued" );788 $ tpl->assign( "queued", makeDate( $jobs[$jobid]['queued_timestamp'] ) );789 $ tpl->gotoBlock( "node");794 //$tpl_data->assign( "column_queued", "yes" ); 795 $job_loop[ "column_queued" ] = "yes"; 796 $job_loop["queued"] = makeDate( $jobs[$jobid]['queued_timestamp'] ); 790 797 } 791 798 if( $COLUMN_NODES ) 792 799 { 793 $tpl->newBlock( "column_nodes" ); 794 $tpl->gotoBlock( "node" ); 800 //$tpl_data->assign( "column_nodes", "yes" ); 801 $job_loop[ "column_nodes" ] = "yes"; 802 //echo "colum nodes"; 795 803 } 796 804 … … 798 806 $cpus = $nodes * $ppn; 799 807 800 $ tpl->assign( "nodes", $nodes );801 $ tpl->assign( "cpus", $cpus );808 $job_loop["nodes"] = $nodes; 809 $job_loop["cpus"] = $cpus; 802 810 803 811 $start_time= (int) $jobs[$jobid]['start_timestamp']; … … 827 835 if( $COLUMN_NODES ) 828 836 { 829 $tpl->gotoBlock( "column_nodes" ); 837 //$tpl_data->assign( "column_nodes", "yes" ); 838 $job_loop[ "column_nodes" ] = "yes"; 830 839 831 840 $mynodehosts = array(); … … 843 852 $nodes_hostnames = implode( " ", $mynodehosts ); 844 853 845 $tpl->assign( "nodes_hostnames", $nodes_hostnames ); 846 $tpl->gotoBlock( "node" ); 854 $job_loop["nodes_hostnames"] = $nodes_hostnames; 847 855 } 848 856 } … … 854 862 if( $even ) 855 863 { 856 $ tpl->assign( "nodeclass", "even" );864 $job_loop["nodeclass"] = "even"; 857 865 858 866 $even = 0; … … 860 868 else 861 869 { 862 $ tpl->assign( "nodeclass", "odd" );870 $job_loop["nodeclass"] = "odd"; 863 871 864 872 $even = 1; … … 870 878 $job_runningtime = $heartbeat - $start_time; 871 879 872 $tpl->assign( "started", makeDate( $start_time ) ); 873 $tpl->assign( "runningtime", $runningtime ); 874 } 875 } 880 $job_loop["started"] = makeDate( $start_time ); 881 $job_loop["runningtime"] = $runningtime; 882 } 883 $node_list[] = $job_loop; 884 } 885 $tpl_data->assign("node_list", $node_list ); 876 886 } 877 887 } … … 895 905 $rjqj_str .= "</A>"; 896 906 897 $tpl->gotoBlock( "_ROOT" ); 898 899 $tpl->assign( "rjqj_graph", $rjqj_str ); 907 $tpl_data->assign( "rjqj_graph", $rjqj_str ); 900 908 } 901 909 … … 917 925 $free_cpus = ( $free_cpus >= 0 ) ? $free_cpus : 0; 918 926 919 $tpl ->assignGlobal( "avail_nodes", $avail_nodes );920 $tpl ->assignGlobal( "avail_cpus", $avail_cpus );921 922 $tpl ->assignGlobal( "queued_nodes", $queued_nodes );923 $tpl ->assignGlobal( "queued_jobs", $queued_jobs );924 $tpl ->assignGlobal( "queued_cpus", $queued_cpus );927 $tpl_data->assign( "avail_nodes", $avail_nodes ); 928 $tpl_data->assign( "avail_cpus", $avail_cpus ); 929 930 $tpl_data->assign( "queued_nodes", $queued_nodes ); 931 $tpl_data->assign( "queued_jobs", $queued_jobs ); 932 $tpl_data->assign( "queued_cpus", $queued_cpus ); 925 933 926 934 // Only display "Unavailable" in count overview there are any … … 928 936 if( $na_nodes > 0 ) 929 937 { 930 $tpl->newBlock( "na_nodes" ); 931 932 $tpl->assignGlobal( "na_nodes", $na_nodes ); 933 $tpl->assignGlobal( "na_cpus", $na_cpus ); 934 935 $tpl->gotoBlock( "_ROOT" ); 936 } 937 938 $tpl->assignGlobal( "total_nodes", $total_nodes ); 939 $tpl->assignGlobal( "total_jobs", $total_jobs ); 940 $tpl->assignGlobal( "total_cpus", $total_cpus ); 941 942 $tpl->assignGlobal( "running_nodes", $running_nodes ); 943 $tpl->assignGlobal( "running_jobs", $running_jobs ); 944 $tpl->assignGlobal( "running_cpus", $running_cpus ); 945 946 $tpl->assignGlobal( "used_nodes", $used_nodes ); 947 $tpl->assignGlobal( "used_jobs", $used_jobs ); 948 $tpl->assignGlobal( "used_cpus", $used_cpus ); 949 950 $tpl->assignGlobal( "free_nodes", $free_nodes ); 951 $tpl->assignGlobal( "free_cpus", $free_cpus ); 952 953 $tpl->assignGlobal( "view_nodes", $view_nodes ); 954 $tpl->assignGlobal( "view_jobs", $view_jobs ); 955 $tpl->assignGlobal( "view_cpus", $view_cpus ); 956 957 $tpl->assignGlobal( "report_time", makeDate( $heartbeat) ); 938 $tpl_data->assign( "na_nodes", "yes"); 939 940 $tpl_data->assign( "na_nodes", $na_nodes ); 941 $tpl_data->assign( "na_cpus", $na_cpus ); 942 } 943 944 $tpl_data->assign( "total_nodes", $total_nodes ); 945 $tpl_data->assign( "total_jobs", $total_jobs ); 946 $tpl_data->assign( "total_cpus", $total_cpus ); 947 948 $tpl_data->assign( "running_nodes", $running_nodes ); 949 $tpl_data->assign( "running_jobs", $running_jobs ); 950 $tpl_data->assign( "running_cpus", $running_cpus ); 951 952 $tpl_data->assign( "used_nodes", $used_nodes ); 953 $tpl_data->assign( "used_jobs", $used_jobs ); 954 $tpl_data->assign( "used_cpus", $used_cpus ); 955 956 $tpl_data->assign( "free_nodes", $free_nodes ); 957 $tpl_data->assign( "free_cpus", $free_cpus ); 958 959 $tpl_data->assign( "view_nodes", $view_nodes ); 960 $tpl_data->assign( "view_jobs", $view_jobs ); 961 $tpl_data->assign( "view_cpus", $view_cpus ); 962 963 $tpl_data->assign( "report_time", makeDate( $heartbeat) ); 958 964 959 965 if( intval($view_jobs) == 1 and $start_time ) … … 976 982 if( intval($view_jobs) == 1 and $start_time ) 977 983 { 978 $tpl ->newBlock( "showhosts" );984 $tpl_data->assign( "showhosts", "yes" ); 979 985 980 986 # Present a width list … … 995 1001 $cols_menu .= "</SELECT>\n"; 996 1002 997 $tpl ->assign( "metric","$metricname $units" );998 $tpl ->assign( "id", $filter['id'] );1003 $tpl_data->assign( "metric","$metricname $units" ); 1004 $tpl_data->assign( "id", $filter['id'] ); 999 1005 1000 1006 # Host columns menu defined in header.php 1001 $tpl ->assign( "cols_menu", $cols_menu );1007 $tpl_data->assign( "cols_menu", $cols_menu ); 1002 1008 1003 1009 $showhosts = isset($sh) ? $sh : $default_showhosts; 1004 1010 1005 $tpl->assign( "checked$showhosts", "checked" ); 1011 $tpl_data->assign( "checked$showhosts", "checked" ); 1012 1013 $sorted_list = array(); 1006 1014 1007 1015 if( $showhosts ) … … 1096 1104 $i = 1; 1097 1105 1106 $metric_loop = array(); 1098 1107 foreach ( $sorted_hosts as $host=>$value ) 1099 1108 { 1100 $tpl->newBlock( "sorted_list" );1101 1102 1109 $host_url = rawurlencode( $host ); 1103 1110 $cluster_url = rawurlencode( $clustername ); … … 1150 1157 } 1151 1158 1152 $ tpl->assign( "metric_image", $cell );1159 $metric_loop["metric_image"] = $cell; 1153 1160 1154 1161 if(! ($i++ % $hostcols) ) 1155 1162 { 1156 $tpl->assign( "br", "</tr><tr>" ); 1157 } 1158 } 1159 } 1160 } 1163 $metric_loop["br"] = "</tr><tr>"; 1164 } 1165 $sorted_list[] = $metric_loop; 1166 } 1167 $tpl_data->assign("sorted_list", $sorted_list ); 1168 } 1169 } 1170 $dwoo->output($tpl, $tpl_data); 1161 1171 } 1172 1162 1173 ?>
Note: See TracChangeset
for help on using the changeset viewer.