Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#42 closed defect (fixed)

remove php5 function and add seperate databases per cluster

Reported by: bastiaans Owned by: bastiaans
Priority: normal Milestone: 0.3
Component: web Version: 0.2
Keywords: Cc:
Estimated Number of Hours:



I have a question about a special configuration of jobmonarch. We have
two clusters each with one joblist which store data on two databases on
a unique postgresql server. We want to display the data stored on jobs
from each cluster take place in their dedicated pages. In other way, we
don't want to use one database for two clusters and displayed the jobs
done on the cluster X on the jobarchive's page of the cluster Y.  is it

For informations :
- We have test jobmonarch (svn) with PHP4 and  it's ok while the
variable $SORTBY_HOSTNAME is not defined. If it is defined the function
*stripos()* miss in PHP4, it is a PHP5 function :
- Joblist and jobarchive seem ok with python 2.3 on a PIII and an
opteron 64 bits by 'seem' i think we haven't found any problem or bug.

Thanks you in advance for your answer,


Alexis MICHON                  CNRS, France
IBCP, Institut de Biologie et Chimie des Proteines
Mail :
Tel :

Change History (28)

comment:1 Changed 16 years ago by alexis.michon@…


I took some minutes for programming this function, here is my patch:

--- tmp/libtoga.php	2007-07-08 19:08:05.000000000 +0200
+++ libtoga.php	2007-11-19 08:53:37.000000000 +0100
@@ -131,13 +131,28 @@
 	function TarchDbase( $ip = null, $dbase = null ) {
+		global $CLUSTER_CONFS, $confcluster, $clustername;
+	        foreach( $CLUSTER_CONFS as $confcluster => $conffile )
+		{
+//			printf( "cf %s cc %s\n", $clustername, $confcluster);
+//			printf( "cf %s cc %s\n", strtolower( trim(clustername)), trim($confcluster) );
+			if( strtolower( trim($clustername) ) == strtolower(trim($confcluster)) )
+			{
+//				printf( "cf %s cc %s\n", $conffile, $confcluster);
+				include_once $conffile;
+			}
+		}
+//		printf (" Job_archive_dbase : %s\n", $JOB_ARCHIVE_DBASE);
 		$db_fields = explode( '/', $JOB_ARCHIVE_DBASE );
 		$this->ip = $db_fields[0];
 		$this->dbase = $db_fields[1];
 		$this->conn = null;
 	function connect() {
@@ -193,7 +208,7 @@
 			$count_result = $this->queryDbase( $count_query );
 			$this->resultcount = (int) $count_result[0][count];
-			$select_query = "SELECT " . $select_result_idname . " " . $query . " ORDER BY job_id LIMIT " . $SEARCH_RESULT_LIMIT;
+			$select_query = "SELECT " . $select_result_idname . " " . $query . " ORDER BY job_id desc LIMIT " . $SEARCH_RESULT_LIMIT;
 		$ids = $this->queryDbase( $select_query );

And i found a code to use stripos with php4:

/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available at through the world-wide-web at                           |
// |                                  |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Aidan Lister <>                                |
// +----------------------------------------------------------------------+
// $Id: stripos.php,v 2005/06/19 05:21:33 bitweaver Exp $

 * Replace stripos()
 * @category    PHP
 * @package     PHP_Compat
 * @link
 * @author      Aidan Lister <>
 * @version     $Revision: $
 * @since       PHP 5
 * @require     PHP 4.0.1 (trigger_error)
if (!function_exists('stripos'))
    function stripos ($haystack, $needle, $offset = null)
        if (!is_scalar($haystack)) {
            trigger_error('stripos() expects parameter 1 to be string, ' . gettype($haystack) . ' given', E_USER_WARNING);
            return false;

        if (!is_scalar($needle)) {
            trigger_error('stripos() needle is not a string or an integer.', E_USER_WARNING);
            return false;

        if (!is_null($offset) && !is_numeric($offset)) {
            trigger_error('stripos() expects parameter 3 to be long, ' . gettype($offset) . ' given', E_USER_WARNING);
            return false;

        // Manipulate the string if there is an offset                   
        $fix = 0;
        if (!is_null($offset))
            if ($offset > 0)
                $haystack = substr($haystack, $offset, strlen($haystack) - $offset);
                $fix = $offset;

        $segments = explode (strtolower($needle), strtolower($haystack), 2);
        $position = strlen($segments[0]) + $fix;

        return $position;

This function seems working. But after some tests i don't understand the parameter $SORTBY_HOSTNAME. How does it work?

Thanks you

comment:2 Changed 16 years ago by bastiaans

  • Cc alexis.michon@… added
  • Owner changed from somebody to bastiaans
  • Status changed from new to assigned

Thanks for your patch on multiple databases!

I have a question though, how do you save to two different databases in jobarchived? Your patch seems to fix it on the web frontend, so I assume after this patch you simply specify specify JOB_ARCHIVE_DBASE in your cluster-specific CLUSTER_CONFS? Saving to different databases on the backend in jobarchived already works for you? How do you do that, you run 2 jobarchived's one for each database/cluster?

Seems a great patch I'll have a look at it and commit it in the source.

SORTBY_HOSTNAME allows you to specify how the 'big clusterimage' is drawn. In stead of placing nodes randomly, you can specify a value for X and Y from the hostname.

For example for our Lisa cluster of 800 nodes, the hostname of machines is: gb-r<rack>n<node>. We have 36 racks with a average of 20 nodes per rack. So if you specify SORTBY_HOSTNAME = gb-r{x}n{y}, the frontend will use the racknr as X coordinate and nodenr as Y coordinate from the hostname of each node. This way you can draw your 'big clusterimage' just like it is divided physicaly on you computerfloor. So if you want to click the first node in the first rack, it will be drawn in the clusterimage as the top node in the first column. While all nodes from rack 2 are drawn in the second column, etc. Does that clarify it for you?


  • Ramon

comment:3 Changed 16 years ago by bastiaans

committed in changeset r454.

comment:4 Changed 16 years ago by alexis.michon@…

I use 2 jobarchived. One for each cluster/db. Yes, I use the cluster-specific way to configure this and my patch is only for the web frontend.

Thanks you for the explaining, it's more clear now.

Friendships, Alexis

comment:5 Changed 16 years ago by bastiaans

  • Resolution set to fixed
  • Status changed from assigned to closed

Ok cheers, I'll close the ticket, your patch is committed.

comment:12 Changed 16 years ago by bastiaans

  • Cc alexis.michon@… removed
  • Resolution set to fixed
  • Status changed from reopened to closed

comment:14 Changed 16 years ago by buy viagra online

comment:27 Changed 15 years ago by anonymous

This leadership position gives us the opportunity to work with all of our clients to guarantee that your door will meet your exact needs. After we gather specifications and ideas from you, our award winning designers will create your door guaranteeing that the final product is both technically accurate and beautiful. Once this is done our designers pass it over to our manufacturing facility. There, your wrought iron door will be created by skilled artisans, giving you a one-of-a-kind finished product, with its own copyright and trademark to guarantee your doors authenticity. This process is what makes each of our doors unique, and makes your door a true work of art. If you think that a wrought iron door might be the perfect way to finish your home or business, please visit our portfolio to see our full line of wrought iron door grills. When you are done please visit us at one of our showrooms or request more information by filling out our online form.

comment:28 Changed 15 years ago by Imperia

Greeting. Never does the human soul appear so strong and noble as when it foregoes revenge and dares to forgive an injury. I am from Brunei and learning to write in English, tell me right I wrote the following sentence: "Video blog ask a ninja says it signs a deal with blog network federated media for big contract."

With respect :p, Imperia.

Note: See TracTickets for help on using tickets.