<commit_before><?php
/*#################################################################################################

Copyright 2009 The Trustees of Indiana University

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing permissions and limitations under the
License.

#################################################################################################*/

class RgbdiitreeController extends RgController
{
    public static function default_title() { return "BDII Treemap"; }
    public static function default_url($query) { return ""; }

    public function load()
    {
        parent::load();

        $dirty_type = @$_REQUEST["bdiitree_type"];
        switch($dirty_type)
        {
        default:
        case "total_jobs":
            $sub_title = "Number of Jobs";
            $key = "TotalJobs";
            break;
        case "free_cpus":
            $sub_title = "Number of Free CPUs";
            $key = "FreeCPUs";
            break;
        case "estimated_response_time":
            $sub_title = "Estimated Response Time";
            $key = "EstimatedResponseTime";
            break;
        case "waiting_jobs":
            $sub_title = "Number of Waiting Jobs";
            $key = "WaitingJobs";
            break;
        case "running_jobs":
            $sub_title = "Number of Running Jobs";
            $key = "RunningJobs";
            break;
        case "free_job_slots":
            $sub_title = "Number of Free Job Slots";
            $key = "FreeJobSlots";
            break;
        }

        $model = new BDII();
        $rgs = $model->get();

        $model = new ResourceGroup();
        $oim_rgs = $model->getindex();

        $this->view->total_area = 0;
        $this->view->key = $key;
        $this->view->sub_title = $sub_title;
        $this->view->rgs = array();
        foreach($this->rgs as $rgid=>$rg) {
            //filter ones that passed mysql query for resource group
            if(isset($rgs[$rgid])) {
                $bdii_rg = $rgs[$rgid];
                $rg_view = array();

                //has resources information?
                if(isset($bdii_rg->resources)) {
                    //for each resource..
                    foreach($bdii_rg->resources as $rid=>$resource) {
                        //filter ones that passed mysql query for resource
                        if(isset($rg[$rid])) {
                            //aggregate data for each services
                            $agg = new Aggregator();
                            foreach($resource["services"] as $service) {
                                $service = $service->Service;
                                $servicename = $service->ServiceName;
                                //for each job manager entries...
                                foreach($service->JobManagers as $jobmanager) {
                                    $jobmanager = $jobmanager->JobManager;
                                    $serviceuri = $jobmanager->ServiceUri;
                                    $glueinfo = $jobmanager->GlueInfo;
                                    $agg->sum("TotalJobs", $glueinfo->GlueCEStateTotalJobs);
                                    $agg->sum("FreeCPUs", $glueinfo->GlueCEStateFreeCPUs);
                                    $agg->sum("EstimatedResponseTime", $glueinfo->GlueCEStateEstimatedResponseTime);
                                    $agg->sum("WaitingJobs", $glueinfo->GlueCEStateWaitingJobs);
                                    $agg->sum("RunningJobs", $glueinfo->GlueCEStateRunningJobs);
                                    $agg->sum("FreeJobSlots", $glueinfo->GlueCEStateFreeJobSlots);
                                }
                            }
                            $rg_view[$rid] = array("info"=>$rg[$rid], "agg"=>$agg);
                            $this->view->total_area += $agg->get($key);
                        } 
                    }
                }
                $this->view->rgs[$rgid] = array("info"=>$oim_rgs[$rgid][0], "resources"=>$rg_view);

/*
                $bdii = $rg->bdii;
                $this->view->rgs[$rgid] = $bdii;
                foreach($bdii->aggregates as $aggregate) {
                }
*/
            } else {
                elog("Can't find information for resource group $rgid");<commit_msg>updated bdii datastructure aggregator to match what we have now in bdii XML<commit_after><?php
/*#################################################################################################

Copyright 2009 The Trustees of Indiana University

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing permissions and limitations under the
License.

#################################################################################################*/

class RgbdiitreeController extends RgController
{
    public static function default_title() { return "BDII Treemap"; }
    public static function default_url($query) { return ""; }

    public function load()
    {
        parent::load();

        $dirty_type = @$_REQUEST["bdiitree_type"];
        switch($dirty_type)
        {
        default:
        case "total_jobs":
            $sub_title = "Number of Jobs";
            $key = "TotalJobs";
            break;
        case "free_cpus":
            $sub_title = "Number of Free CPUs";
            $key = "FreeCPUs";
            break;
        case "estimated_response_time":
            $sub_title = "Estimated Response Time";
            $key = "EstimatedResponseTime";
            break;
        case "waiting_jobs":
            $sub_title = "Number of Waiting Jobs";
            $key = "WaitingJobs";
            break;
        case "running_jobs":
            $sub_title = "Number of Running Jobs";
            $key = "RunningJobs";
            break;
        case "free_job_slots":
            $sub_title = "Number of Free Job Slots";
            $key = "FreeJobSlots";
            break;
        }

        $model = new BDII();
        $rgs = $model->get();

        $model = new ResourceGroup();
        $oim_rgs = $model->getindex();

        $this->view->total_area = 0;
        $this->view->key = $key;
        $this->view->sub_title = $sub_title;
        $this->view->rgs = array();
        foreach($this->rgs as $rgid=>$rg) {
            //filter ones that passed mysql query for resource group
            if(isset($rgs[$rgid])) {
                $bdii_rg = $rgs[$rgid];
                $rg_view = array();

                //has resources information?
                if(isset($bdii_rg->resources)) {
                    //for each resource..
                    foreach($bdii_rg->resources as $rid=>$resource) {
                        //filter ones that passed mysql query for resource
                        if(isset($rg[$rid])) {
                            //aggregate data for each services
                            $agg = new Aggregator();
                            foreach($resource["services"] as $service) {
                                $service = $service->Service;
                                $servicename = $service->ServiceName;
                                //$serviceuri = $service->ServiceUri;

                                //for each queue
                                if($service->Queues === null) continue;
                                foreach($service->Queues as $queue) {
                                    $queue = $queue->Queue;
                                    $state = $queue->State;
                                    $agg->sum("TotalJobs", $state->GlueCEStateTotalJobs);
                                    $agg->sum("FreeCPUs", $state->GlueCEStateFreeCPUs);
                                    $agg->sum("EstimatedResponseTime", $state->GlueCEStateEstimatedResponseTime);
                                    $agg->sum("WaitingJobs", $state->GlueCEStateWaitingJobs);
                                    $agg->sum("RunningJobs", $state->GlueCEStateRunningJobs);
                                    $agg->sum("FreeJobSlots", $state->GlueCEStateFreeJobSlots);
                                }
                            }
                            $rg_view[$rid] = array("info"=>$rg[$rid], "agg"=>$agg);
                            $this->view->total_area += $agg->get($key);
                        } 
                    }
                }
                $this->view->rgs[$rgid] = array("info"=>$oim_rgs[$rgid][0], "resources"=>$rg_view);

/*
                $bdii = $rg->bdii;
                $this->view->rgs[$rgid] = $bdii;
                foreach($bdii->aggregates as $aggregate) {
                }
*/
            } else {
                elog("Can't find information for resource group $rgid");
{'fraction_non_alphanumeric': 0.15031927143305768, 'fraction_numerical': 0.0020935831675913327, 'mean_word_length': 1.5710441334768568, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 96, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 17, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4135966', 'n_tokens_mistral': 2481, 'n_tokens_neox': 2346, 'n_words': 586}