Changes between Version 4 and Version 5 of TorqueExamples
- Timestamp:
- 09/15/10 10:45:29 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TorqueExamples
v4 v5 21 21 == sara_nodes.py == 22 22 23 [source:trunk/examples/sara_nodes.py sara_nodes] i a an utility that we use to set nodes offline/online. We use this instead of ''pbsnodes -N''. It can be best described with anexamples. 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: 24 24 {{{ 25 25 sara_nodes … … 71 71 * remark 72 72 73 the format of field tag sis:73 the format of field tag is: 74 74 * % : 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 gebruiken76 * T ussen de ( en ) specificeer je een veldnaam77 * s = hiermee specificeer je dat het gaat om een stringwaarde75 * * : 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 78 78 79 De tags op een rijtje 79 A list of field tags: 80 80 * %*(node)s 81 81 * %*(state)s … … 87 87 88 88 89 Door sara_nodes --help uit te voeren kan je ook de overige opties bekijken. 89 ==== Sara_nodes as python module ==== 90 90 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 91 You can also use {{sara_nodes}} as python module in your own python programs, see example: 95 92 {{{ 96 93 import sara_nodes … … 100 97 101 98 try: 102 # De nodes met een reden offline zetten103 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' ) 104 101 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 106 103 obj_sara_nodes.pbs_change_state_offline( nodenames, 'Onderhoud', 1221 ) 107 104 108 # De nodes down zetten105 # Clear the nodes 109 106 obj_sara_nodes.pbs_change_state_down( nodenames ) 110 107 111 # De note clearen, de state NIET108 # Clear the note 112 109 obj_sara_nodes.pbs_change_note_clear( nodenames ) 113 110 114 # Note ticket wijzigen/toevoegen, verwijderen gebruik 'c' als waarde111 # Change the ticket number 115 112 obj_sara_nodes.pbs_change_note_ticket( nodenames, 1221 ) 116 113 117 # Note aanpassen, bij deze optie wordt de vorige note overschreven118 obj_sara_nodes.pbs_change_note( nodenames, ' een nieuwe omschrijving' )114 # Change the note 115 obj_sara_nodes.pbs_change_note( nodenames, 'New Bios' ) 119 116 120 # Note aanpassen, bij deze optie wordt de vorige note overschreven, ook nieuwe ticket nummer121 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 ) 122 119 123 120 except sara_nodes.sara_nodesException, msg: