IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2010, 2:59:14 PM (16 years ago)
Author:
bills
Message:

set hosts for distribution bundles using specialized lists

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/dist.pro

    r27462 r27561  
    9292end
    9393
     94macro get.host.for.component
     95    if ($0 != 3)
     96        echo "USAGE: get.host.for.component (componentID) (varname)"
     97        break
     98    end
     99    local component host varname
     100    $component = $1
     101    $varname = $2
     102    substr $component 0 3 COMP_HEAD
     103    if ("$COMP_HEAD" == "sky")
     104        book getword ipphosts dist_skycell count -var count
     105        local j myValue skyhash
     106        list word -splitbychar . $component
     107        $skyhash = 0
     108        for j 0 $word:n
     109            inthash $word:$j $count -var myValue
     110            $skyhash = $skyhash + $myValue
     111        end
     112        inthash $skyhash $count -var skyhash
     113        sprintf skyname "sky%02d" $skyhash
     114        book getword ipphosts dist_skycell $skyname -var host
     115    else
     116        book getword ipphosts dist_chip $component -var host
     117    end
     118    $$varname = $host
     119end
    94120
    95121macro set.dist.workdir.by.component
    96     # component template default varname
    97     if ($0 != 6)
    98         echo "USAGE: set.workdir.by.component (stage_id) (componentID) (template) (default) (varname)"
     122    if ($0 != 5)
     123        echo "USAGE: set.workdir.by.component (stage_id) (componentID) (template) (varname)"
    99124        break
    100125    end
    101126    local host stage_id component default template varname length start count selector component_id random_number
     127
    102128    $stage_id = $1
    103129    $component = $2
    104130    $template = $3
    105     $default = $4
    106     $varname = $5
     131    $varname = $4
    107132    if ("$template" == "NULL")
    108133        echo "ERROR: WORKDIR template not set."
     
    111136    book getword ipphosts distribution count -var count
    112137    if ("$count" == "NULL")
    113         echo "ERROR: disthosts is empty"
    114         break
    115     end
     138        echo "ERROR: distributin hosts list is empty"
     139        break
     140    end
     141    $host = "foo"
    116142    if ("$component" == "exposure")
    117         $selector = $stage_id
     143        # take last two letters of selector
     144        # treat it as an integer and use modulous of length of distribution hosts
     145        # to compute an index into the host table
     146        strlen $stage_id length
     147        $start = $length - 2
     148        substr $stage_id $start 2 index
     149        $component_id = $index % $count
     150        book getword ipphosts distribution $component_id -var myhost
    118151    else
    119         $selector = $component
    120     end
    121     #echo selector is $selector
    122     # take last two letters of selector
    123     # treat it as an integer and use modulous of length of distribution hosts
    124     # to compute an index into the host table
    125     strlen $selector length
    126     $start = $length - 2
    127     substr $selector $start 2 index
    128     $component_id = $index % $count
    129 
    130     #echo component_id is $component_id
    131 
    132     book getword ipphosts distribution $component_id -var host
    133     if ("$host" == "NULL")
     152        get.host.for.component $component myhost
     153    end
     154
     155    if ("$myhost" == "NULL")
    134156        echo "ERROR: failed to find host for $component"
    135         $host = $default
    136     end
    137 
    138     #echo host is $host
    139 
    140     strsub $template @HOST@ $host -var $varname
     157        break
     158    end
     159
     160    strsub $template @HOST@ $myhost -var $varname
    141161
    142162    #echo template is $template
    143163    #echo outdir is $$varname
    144164end
    145 
    146165
    147166
     
    263282
    264283
    265     set.dist.workdir.by.component $DIST_STAGE_ID $COMPONENT $OUTDIR_TEMPLATE ipp047 OUTDIR
     284    set.dist.workdir.by.component $DIST_STAGE_ID $COMPONENT $OUTDIR_TEMPLATE OUTDIR
    266285    if ("$OUTDIR" == "NULL")
    267286        echo ERROR failed to set workdir for $COMPONENT
Note: See TracChangeset for help on using the changeset viewer.