pre_acquire_node_script.groovy 722 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Connecting to the ResourceManager API
rmapi.connect()

// Getting NS configuration settings
def retCode = 0
def nodeSourceName = variables.get("NS_name")
def flag = false
def count = 0

while (!flag) {
    try {
        if (rmapi.getNodeSourcePingFrequency(nodeSourceName)) {
            println " Node source ready !"
        }
        flag = true
    } catch (Exception e) {
        if (count > 25) {
            println "NodeSource is still not reachable after " + count + " seconds. Aborting."
            System.exit(1)
        }
        println "NodeSource is not yet reachable, time spent: " + count
        sleep(5000)
        count += 5
    }
}

// Disconnecting from the ResourceManager API
rmapi.disconnect()