Changes between Version 4 and Version 5 of TorqueExamples


Ignore:
Timestamp:
09/15/10 10:45:29 (14 years ago)
Author:
bas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TorqueExamples

    v4 v5  
    2121== sara_nodes.py ==
    2222
    23 [source:trunk/examples/sara_nodes.py sara_nodes] ia an utility that we use to set nodes offline/online. We use this instead of ''pbsnodes -N''. It can be best described with an examples. When it is executed without command line arguments:
     23[source:trunk/examples/sara_nodes.py sara_nodes] is an utility that we use to set nodes offline/online. We use this instead of ''pbsnodes -N''. It can be best described with some examples. When it is executed without command line arguments:
    2424{{{
    2525sara_nodes
     
    7171  * remark
    7272
    73 the format of field tags is:
     73the format of field tag is:
    7474 * % : Start if the field tag
    75  * * : The length of the string. If the string is less then the value it will be   de hoeveelheid tekens in een string, als de waarde kleiner is dan * dan opvullen met spaties, * == betekend de standaard waarde gebruiken
    76  * Tussen de ( en ) specificeer je een veldnaam
    77  * s = hiermee specificeer je dat het gaat om een stringwaarde
     75 * * : The length of the string. If the string is less then the value it will be pads spaces on the right. * == Use the default value specified in the source.
     76 * The field name must be specified between {{{ () }}}
     77 * s : To specify it ia a string value
    7878
    79 De tags op een rijtje
     79A list of field tags:
    8080  * %*(node)s
    8181  * %*(state)s
     
    8787
    8888
    89 Door sara_nodes --help uit te voeren kan je ook de overige opties bekijken.
     89==== Sara_nodes as python module ====
    9090
    91 ==== Sara_nodes als python module ====
    92 Buiten dat je [source:trunk/torque/utils/sara_nodes.py sara_nodes] als programma kan gebruiken is hij ook te gebruiken als module. Dit betekend dat je eenvoudig in je bestaande Python programma's de status van een node kan aanpassen naar down of offline.
    93 
    94 
     91You can also use {{sara_nodes}} as python module in your own python programs, see example:
    9592{{{
    9693import sara_nodes
     
    10097       
    10198try:
    102   # De nodes met een reden offline zetten
    103   obj_sara_nodes.pbs_change_state_offline( nodenames, 'Onderhoud' )
     99  # Set the specified nodes offline
     100  obj_sara_nodes.pbs_change_state_offline( nodenames, 'Maintenance' )
    104101
    105   # De nodes met een reden offline zetten, plus een ticket nummer meegeven (in dit geval nr 1221)
     102  # Set the specified nodes offline and attach a ticket number
    106103  obj_sara_nodes.pbs_change_state_offline( nodenames, 'Onderhoud', 1221 )
    107104
    108   # De nodes down zetten
     105  # Clear the nodes
    109106  obj_sara_nodes.pbs_change_state_down( nodenames )
    110107
    111   # De note clearen, de state NIET
     108  # Clear the note
    112109  obj_sara_nodes.pbs_change_note_clear( nodenames )
    113110
    114   # Note ticket wijzigen/toevoegen, verwijderen gebruik 'c' als waarde
     111  # Change the ticket number
    115112  obj_sara_nodes.pbs_change_note_ticket( nodenames, 1221 )
    116113
    117   # Note aanpassen, bij deze optie wordt de vorige note overschreven
    118   obj_sara_nodes.pbs_change_note( nodenames, 'een nieuwe omschrijving' )
     114  # Change the note
     115  obj_sara_nodes.pbs_change_note( nodenames, 'New Bios' )
    119116
    120   # Note aanpassen, bij deze optie wordt de vorige note overschreven, ook nieuwe ticket nummer
    121   obj_sara_nodes.pbs_change_note( nodenames, 'een nieuwe omschrijving' 1221 )
     117  # Chnage the note and ticket number
     118  obj_sara_nodes.pbs_change_note( nodenames, 'New Bios' 1221 )
    122119
    123120except sara_nodes.sara_nodesException, msg: