fix:add query node interface by nodeName
This commit is contained in:
parent
d757a4ba66
commit
7ad5d1f562
|
@ -1,34 +1,18 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
|
|
||||||
node_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/nodeinfo"
|
node_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/nodeinfo"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) < 2 {
|
/* name := os.Args[1]
|
||||||
fmt.Printf("Please specify node name\n")
|
fmt.Println(string(name))*/
|
||||||
return
|
node_list := node_info.Get_node_info("localhost")
|
||||||
}
|
fmt.Println(string(node_list.Record_count))
|
||||||
name := os.Args[1]
|
|
||||||
|
|
||||||
node_list := node_info.Get_node_info(name)
|
|
||||||
if node_list.Error_code != 0 {
|
|
||||||
msg := slurm.GetErrorString(node_list.Error_code)
|
|
||||||
fmt.Printf("Error: %s\n", msg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fmt.Printf("Found %d nodes \n", node_list.Record_count)
|
|
||||||
|
|
||||||
/* a little bit nicer*/
|
|
||||||
fmt.Printf("name\t State\t\t\t Reason\t\t Tres\n")
|
|
||||||
fmt.Printf("________________________________________\n")
|
|
||||||
for i := range node_list.Node_list {
|
for i := range node_list.Node_list {
|
||||||
node := node_list.Node_list[i]
|
node := node_list.Node_list[i]
|
||||||
fmt.Printf("%s\t %s\t %s\n", node.Node_hostname, node_info.State_to_string(node.Node_state), node.Reason)
|
fmt.Printf("%s\t %s\t %s\n", node.Node_hostname, node_info.State_to_string(node.Node_state), node.Reason)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue