<commit_before><?php
#
# Retrieves and parses the XML output from gmond. Results stored
# in global variables: $clusters, $hosts, $hosts_down, $metrics.
# Assumes you have already called get_context.php.
#

# If we are in compare_hosts, views and decompose_graph context we shouldn't attempt
# any connections to the gmetad
if ( in_array($context, $SKIP_GMETAD_CONTEXTS) ) {
   
} else {
   if (! Gmetad($conf['ganglia_ip'], $conf['ganglia_port']) )
      {
         print "<H4>There was an error collecting ganglia data ".
            "(${conf['ganglia_ip']}:${conf['ganglia_port']}): $error</H4>\n";
         exit;
      }
      
      
   # If we have no child data sources, assume something is wrong.
   if (!count($grid) and !count($cluster))
      {
         print "<H4>Ganglia cannot find a data source. Is gmond running?</H4>";
         exit;
      }
   # If we only have one cluster source, suppress MetaCluster output.
   if (count($grid) <= 2 and $context=="meta")
      {
         # Lets look for one cluster (the other is our grid).
         foreach($grid as $source)
            if (isset($source['CLUSTER']) and $source['CLUSTER'])
               {
                  $standalone = 1;
                  $context = "cluster";
                  # Need to refresh data with new context.
                  Gmetad($conf['ganglia_ip'], $conf['ganglia_port']);
                  $clustername = $source['NAME'];
               }
      }

}

?><commit_msg>Fix count check of clusters in $grid<commit_after><?php
#
# Retrieves and parses the XML output from gmond. Results stored
# in global variables: $clusters, $hosts, $hosts_down, $metrics.
# Assumes you have already called get_context.php.
#

# If we are in compare_hosts, views and decompose_graph context we shouldn't attempt
# any connections to the gmetad
if ( in_array($context, $SKIP_GMETAD_CONTEXTS) ) {
   
} else {
   if (! Gmetad($conf['ganglia_ip'], $conf['ganglia_port']) )
      {
         print "<H4>There was an error collecting ganglia data ".
            "(${conf['ganglia_ip']}:${conf['ganglia_port']}): $error</H4>\n";
         exit;
      }
      
      
   # If we have no child data sources, assume something is wrong.
   if (!count($grid) and !count($cluster))
      {
         print "<H4>Ganglia cannot find a data source. Is gmond running?</H4>";
         exit;
      }
   # If we only have one cluster source, suppress MetaCluster output.
   if (count($grid) < 2 and $context=="meta")
      {
         # Lets look for one cluster (the other is our grid).
         foreach($grid as $source)
            if (isset($source['CLUSTER']) and $source['CLUSTER'])
               {
                  $standalone = 1;
                  $context = "cluster";
                  # Need to refresh data with new context.
                  Gmetad($conf['ganglia_ip'], $conf['ganglia_port']);
                  $clustername = $source['NAME'];
               }
      }

}

?>
{'fraction_non_alphanumeric': 0.12771739130434784, 'fraction_numerical': 0.004076086956521739, 'mean_word_length': 2.2685904550499445, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5125747', 'n_tokens_mistral': 892, 'n_tokens_neox': 867, 'n_words': 272}