add slurm adaptor
This commit is contained in:
parent
5fe90fefb4
commit
d77969659e
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import "slurm/extra"
|
||||
import "fmt"
|
||||
import "os"
|
||||
import "strconv"
|
||||
|
||||
func main() {
|
||||
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Printf("Please specify Job ID\n")
|
||||
return
|
||||
}
|
||||
id, _ := strconv.Atoi(os.Args[1])
|
||||
fmt.Printf("try to cancel %d\n", id)
|
||||
err := extra.Cancel_job(uint32(id))
|
||||
if err != nil {
|
||||
fmt.Printf(err.Error())
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package main
|
||||
|
||||
import "slurm/extra"
|
||||
import "fmt"
|
||||
import "os"
|
||||
import "strconv"
|
||||
|
||||
func main() {
|
||||
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Printf("Please specify Job ID\n")
|
||||
return
|
||||
}
|
||||
id, _ := strconv.Atoi(os.Args[1])
|
||||
|
||||
jobs, err := extra.Get_job_info_accounting(uint32(id))
|
||||
if err != nil {
|
||||
fmt.Printf(err.Error())
|
||||
return
|
||||
}
|
||||
fmt.Printf("JobId\tuser\taccount\tstate\t\tJobName\n")
|
||||
for i := range jobs {
|
||||
fmt.Printf("%d\t%s\t%s\t%s\t%s\n", jobs[i].JobId, jobs[i].User, jobs[i].Account, jobs[i].State, jobs[i].JobName)
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package main
|
||||
|
||||
import "slurm/jobinfo"
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
job_list := job_info.Get_all_jobs()
|
||||
fmt.Printf("Found %d jobs \n", job_list.Record_count)
|
||||
/* a little bit nicer */
|
||||
fmt.Printf("Id\tName\t\tPartion\tUser\tRuntime\tStatus\t\t(Reason)\tNodes\tPriority\n")
|
||||
fmt.Printf("________________________________________________________________________________________________\n")
|
||||
for i := range job_list.Job_list {
|
||||
job := job_list.Job_list[i]
|
||||
fmt.Printf("%d\t%s\t%s\t %s\t%s\t%s\t%s\t%d\n",
|
||||
job.Job_id, job.Name, job.Partition, job_info.Get_job_runtime(job).String(), job.Job_stateS,
|
||||
job_info.Reason_to_string(job.State_reason), job.Nodes, job.Priority)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
node_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/nodeinfo"
|
||||
)
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
node_list := node_info.Get_all_nodes()
|
||||
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 {
|
||||
node := node_list.Node_list[i]
|
||||
fmt.Printf("%s\t %s\t %s\t \n", node.Node_hostname, node_info.State_to_string(node.Node_state), node.Reason)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import "slurm"
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
|
||||
version := int(0)
|
||||
var config slurm.Ctl_conf
|
||||
version = slurm.Version()
|
||||
fmt.Printf("Version is %s\n", slurm.VersionString(version))
|
||||
config = slurm.GetConfig()
|
||||
slurm.Print_Ctl_conf(config)
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
|
||||
)
|
||||
import "slurm"
|
||||
import "fmt"
|
||||
import "os"
|
||||
import "strconv"
|
||||
|
||||
func main() {
|
||||
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Printf("Please specify Job ID\n")
|
||||
return
|
||||
}
|
||||
id, _ := strconv.Atoi(os.Args[1])
|
||||
job_list := job_info.Get_job(uint32(id))
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
for i := range job_list.Job_list {
|
||||
job_info.Print_Job_info(job_list.Job_list[i])
|
||||
}
|
||||
fmt.Printf("Id\tName\t\tPartion\tUser\tRuntime\tStatus\t\t(Reason)\tNodes\tPriority\n")
|
||||
fmt.Printf("________________________________________________________________________________________________\n")
|
||||
for i := range job_list.Job_list {
|
||||
job := job_list.Job_list[i]
|
||||
fmt.Printf("%d\t%s\t%s %s\t%s\t%s\t%s\t%d\n",
|
||||
job.Job_id, job.Name, job.Partition, job_info.Get_job_runtime(job).String(), job.Job_stateS,
|
||||
job_info.Reason_to_string(job.State_reason), job.Nodes, job.Priority)
|
||||
}
|
||||
|
||||
end_time := job_info.Get_job_endtime(uint32(id))
|
||||
fmt.Printf("End-Time: %s\n", end_time)
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package main
|
||||
|
||||
import "slurm/nodeinfo"
|
||||
import "slurm"
|
||||
import "fmt"
|
||||
import "os"
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Printf("Please specify node name\n")
|
||||
return
|
||||
}
|
||||
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 {
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
partition_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/partitioninfo"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
partition_list := partition_info.Get_partitions()
|
||||
fmt.Printf("Found %d partions \n", partition_list.Record_count)
|
||||
|
||||
/* a little bit nicer */
|
||||
fmt.Printf("Name\t Nodes\t\t\t Max_time(min)\t\t Tres\n")
|
||||
fmt.Printf("________________________________________\n")
|
||||
for i := range partition_list.Partition_list {
|
||||
partition := partition_list.Partition_list[i]
|
||||
fmt.Printf("%s\t %s\t %d\t %d\n", partition.Name, partition.Nodes, partition.Max_time, partition.Node_inx)
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package main
|
||||
|
||||
import "slurm/jobinfo"
|
||||
import "slurm"
|
||||
import "fmt"
|
||||
import "os"
|
||||
|
||||
func main() {
|
||||
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Printf("Please specify username\n")
|
||||
return
|
||||
}
|
||||
name := os.Args[1]
|
||||
job_list := job_info.Get_user_jobs(name)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
fmt.Printf("Id\tName\t\tPartion\tUser\tRuntime\tStatus\t\t(Reason)\tNodes\tPriority\n")
|
||||
fmt.Printf("________________________________________________________________________________________________\n")
|
||||
for i := range job_list.Job_list {
|
||||
job := job_list.Job_list[i]
|
||||
fmt.Printf("%d\t%s\t%s %s\t%s\t%s\t%s\t%d\n",
|
||||
job.Job_id, job.Name, job.Partition, job_info.Get_job_runtime(job).String(), job.Job_stateS,
|
||||
job_info.Reason_to_string(job.State_reason), job.Nodes, job.Priority)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
# Submission of jobs
|
||||
This folder shows in a few more examples of how jobs can be submitted in Slurm. Some examples use containers.
|
||||
Attention: The parameters for job names and partitions probably have to be adjusted!
|
||||
|
||||
# Simple Jobs
|
||||
|
||||
## submit_job.go
|
||||
In this example, a simple bash-Jobs is submitted. The used partition is *long* (adapt probably).
|
||||
```
|
||||
job_desc.Partition="long"
|
||||
```
|
||||
|
||||
The job sets two environment variables and executes a
|
||||
```
|
||||
hostname
|
||||
env | grep SLUM
|
||||
```
|
||||
On a single node of the cluster (single task job).
|
||||
The application does not wait until the hob is completed, but dirctly returns.
|
||||
The (std) output is written to
|
||||
out-jobid.txt, the std- error to err-jobid.txt
|
||||
|
||||
```
|
||||
job_desc.Std_out = ("./out-%j.txt")
|
||||
job_desc.Std_err = ("./err-%j.txt")
|
||||
````
|
||||
|
||||
|
||||
## update_job.go
|
||||
This example allows to update the qos and the partition a job is running on. This can help to move the job to another queue with another partition.
|
||||
Note to users: In theory, the API allows the update of the number of nodes and the tasks per node. However, since this is only allowed by root or a slurm admin, we do not include an example here.
|
||||
Synthax
|
||||
```
|
||||
./update_job JobId qos partition
|
||||
```
|
||||
(Note: This requires that the Job with the Id JobID is already submitted and in a pending state)
|
||||
|
||||
|
||||
# Container jobs
|
||||
|
||||
The following examples all submit a job that starts singulrity containers.
|
||||
These containers, if they do not exist, are created. However, problems can arise if the user does not have sudo permissions..
|
||||
|
||||
## The containers
|
||||
|
||||
The first container is an MPI container. This is used by and `submit_mpi_containier.go` and `submit_mpi_and_update.go`. The definition is stored in `mpi_container.def`
|
||||
It can also be created with the command
|
||||
|
||||
```
|
||||
sudo singularity build mpi_container.img mpi_container.def
|
||||
```
|
||||
|
||||
The program mpi_pingppong (source code enclosed: `mpi_pingpong.c` ) is built into the container. It performs a ping-pong test between two processes.
|
||||
|
||||
This container uses the hybrid model, which assumes that MPI is installed on the cluter (to start the job) and installs it in the container itself. Works with OpenMPI.
|
||||
|
||||
The second container is an openmp container, including a sample OpenMP programm openmp_example (source code: ` openmp_example.c`).
|
||||
It can also be created with the command:
|
||||
|
||||
```
|
||||
sudo singularity build openmp_container.img openmp_container.def
|
||||
```
|
||||
|
||||
This container is used bei `submit_openmp_container.go`.
|
||||
|
||||
|
||||
## submit_mpi_containier.go
|
||||
Submits a mpi-container job to the cluster. It runs to Processes on two nodes
|
||||
```
|
||||
job_desc.Min_nodes =uint32(2)
|
||||
job_desc.Num_tasks = uint32(2)
|
||||
```
|
||||
The application blocks, until the job is completed. The (std) output is written to
|
||||
jobid-out.txt, the std- error to jobId-err.txt
|
||||
```
|
||||
job_desc.Std_out = ("./%j-out.txt")
|
||||
job_desc.Std_err = ("./%j-err.txt")
|
||||
```
|
||||
## submit_omp_container.go
|
||||
Submits two openMP jobs to the cluster and wait, until they are completed.
|
||||
Both jobs allocate *one process* for the job, but *two CPUs per task/process* (for multi-threading).
|
||||
```
|
||||
job_desc.Num_tasks = uint32(1)
|
||||
job_desc.Cpus_per_task = uint16(2)
|
||||
|
||||
```
|
||||
The first job reads the environment variable ` SLURM_JOB_CPUS_PER_NODE` and sets the number of openMP threads to exactly the number of cpus that are available per task/process.
|
||||
```
|
||||
job_desc.Script+= "export OMP_NUM_THREADS=$SLURM_JOB_CPUS_PER_NODE\n"
|
||||
```
|
||||
The second job sets the number of threads to 4 (which is oversuscribing because more threads are started than processes) and executes the same job.
|
||||
```
|
||||
job_desc.Script+= "export OMP_NUM_THREADS=4\n"
|
||||
```
|
||||
|
||||
The program waits until both jobs are completed. The results are written to the two outputs files, similiar to `submit_mpi_container.go`
|
||||
|
||||
### submit_mpi_and_update.go
|
||||
This application is dooing the same as `submit_mpi_container.go`
|
||||
```
|
||||
ops.Qos = "shortjobs"
|
||||
ops.Partition = "short"
|
||||
```
|
||||
|
||||
This situation, can, for example, be created my submitting longer, other jobs bevore in the background (depending on the partion size) and than start this application:
|
||||
|
||||
```
|
||||
./submit_mpi_containier & ./submit_mpi_containier & ./submit_mpi_and_update
|
||||
```
|
|
@ -0,0 +1,122 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
|
||||
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
|
||||
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
func fileExists(filename string) bool {
|
||||
info, err := os.Stat(filename)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return !info.IsDir()
|
||||
}
|
||||
func build_container(file_name, container_name string) {
|
||||
|
||||
cmd := exec.Command("sudo", "/usr/local/bin/singularity", "build", container_name, file_name)
|
||||
fmt.Print("Now build new container")
|
||||
fmt.Printf("%s\n", cmd.String())
|
||||
stdoutStderr, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
fmt.Printf("error in creating container %s \n", err)
|
||||
// return
|
||||
}
|
||||
fmt.Printf("%s\n", stdoutStderr)
|
||||
}
|
||||
|
||||
func main() {
|
||||
job_desc := submit_job.Job_descriptor{}
|
||||
|
||||
dir, _ := os.Getwd()
|
||||
container := filepath.Join(dir, "mpi_container.img")
|
||||
definition := filepath.Join(dir, "mpi_container.def")
|
||||
if !fileExists(container) {
|
||||
build_container(definition, container)
|
||||
}
|
||||
|
||||
if !fileExists(container) {
|
||||
return
|
||||
}
|
||||
/* use Cmd to create our script */
|
||||
|
||||
job_desc.Script = "#!/bin/bash\n export PATH=$PATH:/usr/local/bin\n srun hostname \n"
|
||||
cmd := exec.Command("/home0/opt/openmpi/bin/mpirun", "-mca btl_tcp_if_include eth1", "/usr/local/bin/singularity", "exec", container, "/opt/mpi_pingpong")
|
||||
job_desc.Script += cmd.String()
|
||||
fmt.Printf("cmd %s\n", job_desc.Script)
|
||||
user, _ := user.Current()
|
||||
userid, _ := strconv.Atoi(user.Uid)
|
||||
job_desc.User_id = uint32(userid)
|
||||
groupid, _ := strconv.Atoi(user.Gid)
|
||||
|
||||
job_desc.Group_id = uint32(groupid)
|
||||
job_desc.Name = "flex_mpi_job"
|
||||
job_desc.Partition = "long"
|
||||
job_desc.Time_limit = uint32(60)
|
||||
job_desc.Ntasks_per_node = uint16(1)
|
||||
job_desc.Num_tasks = uint32(2)
|
||||
job_desc.Std_out = ("./%j-out.txt")
|
||||
job_desc.Std_err = ("./%j-err.txt")
|
||||
job_desc.Work_dir = dir
|
||||
|
||||
time.Sleep(3 * time.Second)
|
||||
answer := submit_job.Submit_job(&job_desc)
|
||||
if answer.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(answer.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
}
|
||||
fmt.Printf("Submitted Job %d\n", answer.Job_id)
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
job_list := job_info.Get_job(answer.Job_id)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
job := job_list.Job_list[0]
|
||||
|
||||
fmt.Printf("job %d is %s\n", answer.Job_id, job.Job_stateS)
|
||||
state := job.Job_stateS
|
||||
if state == "Pending" {
|
||||
fmt.Printf("Move job %d to another partition \n", answer.Job_id)
|
||||
var ops submit_job.Update_job_options
|
||||
|
||||
ops.Qos = "shortjobs"
|
||||
ops.Partition = "short"
|
||||
err2 := submit_job.Update_job(ops, uint32(answer.Job_id))
|
||||
if err2 != uint32(0) {
|
||||
fmt.Printf("error %s \n", slurm.GetErrorString(err2))
|
||||
}
|
||||
}
|
||||
|
||||
for state == "Pending" || state == "Running" {
|
||||
time.Sleep(2 * time.Second)
|
||||
job_list = job_info.Get_job(answer.Job_id)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
job = job_list.Job_list[0]
|
||||
|
||||
state = job.Job_stateS
|
||||
|
||||
fmt.Printf("job %d is %s\n", answer.Job_id, job.Job_stateS)
|
||||
|
||||
}
|
||||
|
||||
fmt.Printf("Total runtime Job %d %s\n", job.Job_id, job_info.Get_job_runtime(job).String())
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
Bootstrap: docker
|
||||
From: ubuntu:latest
|
||||
|
||||
%files
|
||||
mpi_pingpong.c /opt
|
||||
|
||||
%environment
|
||||
export OMPI_DIR=/home0/opt/openmpi
|
||||
export SINGULARITY_OMPI_DIR=$OMPI_DIR
|
||||
export SINGULARITYENV_APPEND_PATH=$OMPI_DIR/bin
|
||||
export SINGULAIRTYENV_APPEND_LD_LIBRARY_PATH=$OMPI_DIR/lib
|
||||
|
||||
%post
|
||||
echo "Installing required packages..."
|
||||
apt-get update && apt-get install -y wget git bash gcc gfortran g++ make file
|
||||
|
||||
echo "Installing Open MPI"
|
||||
export OMPI_DIR=/home0/opt/openmpi
|
||||
export OMPI_VERSION=4.0.3
|
||||
export OMPI_URL="https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-$OMPI_VERSION.tar.bz2"
|
||||
mkdir -p /tmp/ompi
|
||||
mkdir -p /opt
|
||||
chmod a+w /opt/
|
||||
chmod a+r /opt/
|
||||
ls -la /tmp/ompi
|
||||
# Download
|
||||
cd /tmp/ompi && wget -O openmpi-$OMPI_VERSION.tar.bz2 $OMPI_URL && tar -xjf openmpi-$OMPI_VERSION.tar.bz2
|
||||
ls -la
|
||||
# Compile and install
|
||||
cd /tmp/ompi/openmpi-$OMPI_VERSION && ./configure --prefix=$OMPI_DIR && make install
|
||||
# Set env variables so we can compile our application
|
||||
export PATH=$OMPI_DIR/bin:$PATH
|
||||
export LD_LIBRARY_PATH=$OMPI_DIR/lib:$LD_LIBRARY_PATH
|
||||
export MANPATH=$OMPI_DIR/share/man:$MANPATH
|
||||
# rm -r tmp/mpi
|
||||
echo "Compiling the MPI application..."
|
||||
cd /opt && mpicc -o mpi_pingpong mpi_pingpong.c
|
|
@ -0,0 +1,110 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
|
||||
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
|
||||
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
func fileExists(filename string) bool {
|
||||
info, err := os.Stat(filename)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return !info.IsDir()
|
||||
}
|
||||
func build_container(file_name, container_name string) {
|
||||
|
||||
cmd := exec.Command("sudo", "/usr/local/bin/singularity", "build", container_name, file_name)
|
||||
fmt.Print("Now build new container")
|
||||
fmt.Printf("%s\n", cmd.String())
|
||||
stdoutStderr, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
fmt.Printf("error in creating container %s \n", err)
|
||||
|
||||
fmt.Printf("%s\n", stdoutStderr)
|
||||
// return
|
||||
}
|
||||
fmt.Printf("%s\n", stdoutStderr)
|
||||
}
|
||||
|
||||
func main() {
|
||||
job_desc := submit_job.Job_descriptor{}
|
||||
|
||||
dir, _ := os.Getwd()
|
||||
container := filepath.Join(dir, "mpi_container.img")
|
||||
definition := filepath.Join(dir, "mpi_container.def")
|
||||
if !fileExists(container) {
|
||||
build_container(definition, container)
|
||||
}
|
||||
|
||||
if !fileExists(container) {
|
||||
return
|
||||
}
|
||||
/* use Cmd to create our script */
|
||||
|
||||
job_desc.Script = "#!/bin/bash\n export PATH=$PATH:/usr/local/bin\n hostname \n"
|
||||
cmd := exec.Command("/home0/opt/openmpi/bin/mpirun", "-mca btl_tcp_if_include eth1", "/usr/local/bin/singularity", "exec", container, "/opt/mpi_pingpong")
|
||||
job_desc.Script += cmd.String()
|
||||
fmt.Printf("cmd %s\n", job_desc.Script)
|
||||
user, _ := user.Current()
|
||||
userid, _ := strconv.Atoi(user.Uid)
|
||||
job_desc.User_id = uint32(userid)
|
||||
groupid, _ := strconv.Atoi(user.Gid)
|
||||
|
||||
job_desc.Group_id = uint32(groupid)
|
||||
job_desc.Name = "mpi_job"
|
||||
job_desc.Partition = "long"
|
||||
job_desc.Time_limit = uint32(60)
|
||||
job_desc.Min_nodes = uint32(2)
|
||||
job_desc.Num_tasks = uint32(2)
|
||||
job_desc.Std_out = ("./%j-out.txt")
|
||||
job_desc.Std_err = ("./%j-err.txt")
|
||||
job_desc.Work_dir = dir
|
||||
|
||||
answer := submit_job.Submit_job(&job_desc)
|
||||
if answer.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(answer.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
}
|
||||
fmt.Printf("Submitted Job %d\n", answer.Job_id)
|
||||
|
||||
job_list := job_info.Get_job(answer.Job_id)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
job := job_list.Job_list[0]
|
||||
|
||||
fmt.Printf("job %d is %s\n", answer.Job_id, job.Job_stateS)
|
||||
state := job.Job_stateS
|
||||
for state == "Pending" || state == "Running" {
|
||||
time.Sleep(2 * time.Second)
|
||||
job_list = job_info.Get_job(answer.Job_id)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
job = job_list.Job_list[0]
|
||||
|
||||
state = job.Job_stateS
|
||||
|
||||
fmt.Printf("job %d is %s\n", answer.Job_id, job.Job_stateS)
|
||||
|
||||
}
|
||||
|
||||
fmt.Printf("Total runtime Job %d: %s\n", job.Job_id, job_info.Get_job_runtime(job).String())
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
#include <mpi.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#define MAX_ITER 1000
|
||||
int main (int argc, char **argv) {
|
||||
int rc;
|
||||
int size;
|
||||
int myrank;
|
||||
size_t max_send = 1<<22;
|
||||
char *send_buf = (char*)malloc(sizeof(char)*max_send);
|
||||
char *recv_buf = (char*)malloc(sizeof(char)*max_send);
|
||||
size_t send_size;
|
||||
clock_t start, end;
|
||||
rc = MPI_Init (&argc, &argv);
|
||||
if (rc != MPI_SUCCESS) {
|
||||
fprintf (stderr, "MPI_Init() failed");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
rc = MPI_Comm_size (MPI_COMM_WORLD, &size);
|
||||
if (rc != MPI_SUCCESS) {
|
||||
fprintf (stderr, "MPI_Comm_size() failed");
|
||||
goto exit_with_error;
|
||||
}
|
||||
|
||||
if(size!= 2) {
|
||||
|
||||
fprintf(stderr, "This process requieres exact two processes\n");
|
||||
}
|
||||
rc = MPI_Comm_rank (MPI_COMM_WORLD, &myrank);
|
||||
if (rc != MPI_SUCCESS) {
|
||||
fprintf (stderr, "MPI_Comm_rank() failed");
|
||||
goto exit_with_error;
|
||||
}
|
||||
if(myrank==0)
|
||||
fprintf (stdout, "Size\t Time(ms)\n");
|
||||
|
||||
for(send_size=1 ; send_size<= max_send; send_size*=2){
|
||||
for (int i = 0; i<MAX_ITER+2; i++) {
|
||||
if(i == 2)
|
||||
start = clock();
|
||||
if(myrank == 0){
|
||||
MPI_Send(send_buf, send_size, MPI_CHAR, 1, 0x4, MPI_COMM_WORLD);
|
||||
MPI_Recv(recv_buf, send_size, MPI_CHAR, 1, 0x5, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||
}
|
||||
else {
|
||||
MPI_Recv(recv_buf, send_size, MPI_CHAR, 0, 0x4, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||
MPI_Send(send_buf, send_size, MPI_CHAR, 0, 0x5, MPI_COMM_WORLD);
|
||||
}
|
||||
}
|
||||
end= clock();
|
||||
double time_taken = (double)(end-start)/CLOCKS_PER_SEC;
|
||||
if(myrank == 0 )
|
||||
fprintf(stdout, "%ld\t %f\n", send_size, time_taken);
|
||||
|
||||
}
|
||||
MPI_Finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
exit_with_error:
|
||||
MPI_Finalize();
|
||||
return EXIT_FAILURE;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
Bootstrap: docker
|
||||
From: ubuntu:latest
|
||||
|
||||
%files
|
||||
openmp_example.c /opt
|
||||
|
||||
%environment
|
||||
export OMPI_DIR=/home0/opt/openmpi
|
||||
export SINGULARITY_OMPI_DIR=$OMPI_DIR
|
||||
export SINGULARITYENV_APPEND_PATH=$OMPI_DIR/bin
|
||||
export SINGULAIRTYENV_APPEND_LD_LIBRARY_PATH=$OMPI_DIR/lib
|
||||
|
||||
%post
|
||||
echo "Installing required packages..."
|
||||
apt-get update && apt-get install -y wget git bash gcc gfortran g++ make file
|
||||
|
||||
echo "Compiling the MPI application..."
|
||||
cd /opt && gcc -o openmp_example -fopenmp openmp_example.c
|
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
#include <omp.h>
|
||||
|
||||
int main() {
|
||||
#pragma omp parallel
|
||||
{
|
||||
int id = omp_get_thread_num();
|
||||
int data = id;
|
||||
int total = omp_get_num_threads();
|
||||
printf("Greetings from thread %d out of %d with Data %d\n", id, total, data);
|
||||
}
|
||||
printf("parallel for ends.\n");
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
|
||||
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
job_desc := submit_job.Job_descriptor{}
|
||||
job_desc.Script = "#! /bin/bash\n hostname \n env | grep SLURM "
|
||||
dir, _ := os.Getwd()
|
||||
|
||||
user, _ := user.Current()
|
||||
userid, _ := strconv.Atoi(user.Uid)
|
||||
job_desc.User_id = uint32(userid)
|
||||
groupid, _ := strconv.Atoi(user.Gid)
|
||||
|
||||
job_desc.Group_id = uint32(groupid)
|
||||
job_desc.Name = "test_job"
|
||||
job_desc.Partition = "debug"
|
||||
job_desc.Time_limit = uint32(2)
|
||||
job_desc.Min_nodes = uint32(1)
|
||||
job_desc.Std_out = ("./out-%j.txt")
|
||||
job_desc.Std_err = ("./err-%j.txt")
|
||||
job_desc.Work_dir = dir
|
||||
job_desc.Environment = []string{"SLURM_GO_JOB=TRUE", "SLURM_CONTAINER_JOB=FALSE"}
|
||||
answer := submit_job.Submit_job(&job_desc)
|
||||
if answer.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(answer.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
}
|
||||
fmt.Printf("Submitted Job %d\n", answer.Job_id)
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
|
||||
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
|
||||
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
func fileExists(filename string) bool {
|
||||
info, err := os.Stat(filename)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return !info.IsDir()
|
||||
}
|
||||
func build_container(file_name, container_name string) {
|
||||
|
||||
cmd := exec.Command("sudo", "/usr/local/bin/singularity", "build", container_name, file_name)
|
||||
fmt.Print("Now build new container")
|
||||
fmt.Printf("%s\n", cmd.String())
|
||||
stdoutStderr, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
fmt.Printf("error in creating container %s \n", err)
|
||||
|
||||
fmt.Printf("%s\n", stdoutStderr)
|
||||
// return
|
||||
}
|
||||
fmt.Printf("%s\n", stdoutStderr)
|
||||
}
|
||||
|
||||
func main() {
|
||||
job_desc := submit_job.Job_descriptor{}
|
||||
|
||||
dir, _ := os.Getwd()
|
||||
container := filepath.Join(dir, "openmp_container.img")
|
||||
definition := filepath.Join(dir, "openmp_container.def")
|
||||
if !fileExists(container) {
|
||||
build_container(definition, container)
|
||||
}
|
||||
|
||||
if !fileExists(container) {
|
||||
return
|
||||
}
|
||||
/* use Cmd to create our script */
|
||||
|
||||
job_desc.Script = "#!/bin/bash\n export PATH=$PATH:/usr/local/bin\n hostname \n"
|
||||
job_desc.Script += "export OMP_NUM_THREADS=$SLURM_JOB_CPUS_PER_NODE\n"
|
||||
cmd := exec.Command("/usr/local/bin/singularity", "exec", container, "/opt/openmp_example")
|
||||
|
||||
job_desc.Script += cmd.String()
|
||||
fmt.Printf("cmd %s\n", job_desc.Script)
|
||||
user, _ := user.Current()
|
||||
userid, _ := strconv.Atoi(user.Uid)
|
||||
job_desc.User_id = uint32(userid)
|
||||
groupid, _ := strconv.Atoi(user.Gid)
|
||||
|
||||
job_desc.Group_id = uint32(groupid)
|
||||
job_desc.Name = "test_job"
|
||||
job_desc.Partition = "long"
|
||||
job_desc.Time_limit = uint32(60)
|
||||
job_desc.Min_nodes = uint32(1)
|
||||
job_desc.Num_tasks = uint32(1)
|
||||
|
||||
job_desc.Cpus_per_task = uint16(2)
|
||||
job_desc.Std_out = ("./%j-out.txt")
|
||||
job_desc.Std_err = ("./%j-err.txt")
|
||||
job_desc.Work_dir = dir
|
||||
|
||||
answer := submit_job.Submit_job(&job_desc)
|
||||
if answer.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(answer.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
}
|
||||
fmt.Printf("Submitted Job %d\n", answer.Job_id)
|
||||
|
||||
/*Now, we submit the same jon again, ut with some oversubsciption */
|
||||
job_desc.Script = "#!/bin/bash\n export PATH=$PATH:/usr/local/bin\n hostname \n"
|
||||
job_desc.Script += "export OMP_NUM_THREADS=4\n"
|
||||
|
||||
job_desc.Script += cmd.String()
|
||||
fmt.Printf("cmd %s\n", job_desc.Script)
|
||||
answer2 := submit_job.Submit_job(&job_desc)
|
||||
if answer2.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(answer.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
}
|
||||
fmt.Printf("Submitted Job %d\n", answer2.Job_id)
|
||||
|
||||
job_list := job_info.Get_job(answer.Job_id)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
job := job_list.Job_list[0]
|
||||
|
||||
fmt.Printf("job is %s\n", job.Job_stateS)
|
||||
state := job.Job_stateS
|
||||
for state == "Pending" || state == "Running" {
|
||||
time.Sleep(2 * time.Second)
|
||||
job_list = job_info.Get_job(answer.Job_id)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
job = job_list.Job_list[0]
|
||||
|
||||
state = job.Job_stateS
|
||||
|
||||
fmt.Printf("job is %s\n", job.Job_stateS)
|
||||
|
||||
}
|
||||
|
||||
fmt.Printf("Total runtime first job %s\n", job_info.Get_job_runtime(job).String())
|
||||
/*wait for second job */
|
||||
job_list = job_info.Get_job(answer2.Job_id)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
job = job_list.Job_list[0]
|
||||
|
||||
fmt.Printf("job is %s\n", job.Job_stateS)
|
||||
state = job.Job_stateS
|
||||
for state == "Pending" || state == "Running" {
|
||||
time.Sleep(2 * time.Second)
|
||||
job_list = job_info.Get_job(answer2.Job_id)
|
||||
if job_list.Error_code != 0 {
|
||||
msg := slurm.GetErrorString(job_list.Error_code)
|
||||
fmt.Printf("Error: %s\n", msg)
|
||||
return
|
||||
|
||||
}
|
||||
job = job_list.Job_list[0]
|
||||
|
||||
state = job.Job_stateS
|
||||
|
||||
fmt.Printf("job is %s\n", job.Job_stateS)
|
||||
|
||||
}
|
||||
|
||||
fmt.Printf("Total runtime second job %s\n", job_info.Get_job_runtime(job).String())
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
|
||||
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 4 {
|
||||
fmt.Printf("Synthax specify JobID, qos and partition \n")
|
||||
return
|
||||
}
|
||||
var ops submit_job.Update_job_options
|
||||
id, err := strconv.Atoi(os.Args[1])
|
||||
if err != nil {
|
||||
fmt.Printf("Invalid job id (no int) %s\n", os.Args[1])
|
||||
return
|
||||
}
|
||||
|
||||
ops.Qos = os.Args[2]
|
||||
ops.Partition = os.Args[3]
|
||||
|
||||
err2 := submit_job.Update_job(ops, uint32(id))
|
||||
if err2 != uint32(0) {
|
||||
fmt.Printf("error %s \n", slurm.GetErrorString(err2))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,480 @@
|
|||
package job_info
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lslurm
|
||||
#include<stdlib.h>
|
||||
#include<slurm/slurm.h>
|
||||
|
||||
inline uint8_t uint8_ptr(uint8_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline int8_t int8_ptr(int8_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline uint16_t uint16_ptr(uint16_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline int16_t int16_ptr(int16_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline uint32_t uint32_ptr(uint32_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline int32_t int32_ptr(int32_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline uint64_t uint64_ptr(uint64_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline int64_t int64_ptr(int16_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
struct job_info_msg *get_job_info(){
|
||||
struct job_info_msg* job_buffer;
|
||||
if(slurm_load_jobs ((time_t) NULL,
|
||||
&job_buffer, SHOW_ALL)) {
|
||||
return NULL;
|
||||
}
|
||||
return job_buffer;
|
||||
}
|
||||
struct job_info_msg *get_single_job_info(uint32_t id){
|
||||
struct job_info_msg* job_buffer;
|
||||
if( slurm_load_job (&job_buffer, id, SHOW_DETAIL)) {
|
||||
return NULL;
|
||||
}
|
||||
return job_buffer;
|
||||
}
|
||||
|
||||
struct job_info* job_from_list(struct job_info_msg *list, int i){
|
||||
return &list->job_array[i];
|
||||
}
|
||||
void free_job_buffer(void* buffer){
|
||||
|
||||
slurm_free_job_info_msg ((struct job_info_msg*)buffer);
|
||||
}
|
||||
|
||||
struct job_info_msg *get_user_job_info(uint32_t id){
|
||||
|
||||
struct job_info_msg* job_buffer;
|
||||
if( slurm_load_job_user(&job_buffer, id, SHOW_DETAIL))
|
||||
return NULL;
|
||||
return job_buffer;
|
||||
|
||||
}
|
||||
|
||||
int64_t get_job_endtime(int32_t jobid){
|
||||
time_t end_time;
|
||||
|
||||
if(slurm_get_end_time (jobid, &end_time))
|
||||
return -1;
|
||||
else
|
||||
return end_time;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int char_len(char* c) {
|
||||
uint i = 0;
|
||||
while(c[i]!='\0') i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import "fmt"
|
||||
import "os/user"
|
||||
import "strconv"
|
||||
import "time"
|
||||
|
||||
func Reason_to_string(state uint16) string {
|
||||
switch s := C.uint16_t(state); s {
|
||||
case C.WAIT_NO_REASON:
|
||||
return "wait no reason"
|
||||
}
|
||||
return "unkown reason"
|
||||
|
||||
}
|
||||
func state_to_string(state uint32) string {
|
||||
switch s := C.uint32_t(state); s {
|
||||
case C.JOB_PENDING:
|
||||
return "Pending" /* queued waiting for initiation */
|
||||
case C.JOB_RUNNING:
|
||||
return "Running" /* allocated resources and executing */
|
||||
case C.JOB_SUSPENDED:
|
||||
return "Suspended" /* allocated resources, execution suspended */
|
||||
case C.JOB_COMPLETE:
|
||||
return "Complete" /* completed execution successfully */
|
||||
case C.JOB_CANCELLED:
|
||||
return "Cancelled" /* cancelled by user */
|
||||
case C.JOB_FAILED:
|
||||
return "Failed" /* completed execution unsuccessfully */
|
||||
case C.JOB_TIMEOUT:
|
||||
return "Timeout" /* terminated on reaching time limit */
|
||||
case C.JOB_NODE_FAIL:
|
||||
return "Node Fail" /* terminated on node failure */
|
||||
case C.JOB_PREEMPTED:
|
||||
return "Preempted" /* terminated due to preemption */
|
||||
}
|
||||
|
||||
return "Unknow status" /* not a real state, last entry in table */
|
||||
}
|
||||
|
||||
type Job_info struct {
|
||||
Account string
|
||||
Alloc_node string
|
||||
Alloc_sid uint32
|
||||
//array_bitmap void;
|
||||
Array_job_id uint32
|
||||
Array_task_id uint32
|
||||
Assoc_id uint32
|
||||
Batch_flag uint16
|
||||
Batch_host string
|
||||
Boards_per_node uint16
|
||||
Command string
|
||||
Comment string
|
||||
Contiguous uint16
|
||||
Cores_per_socket uint16
|
||||
Cpus_per_task uint16
|
||||
Dependency string
|
||||
Derived_ec uint32
|
||||
Eligible_time int64
|
||||
End_time int64
|
||||
Exc_nodes string
|
||||
Exc_node_inx int32
|
||||
Exit_code uint32
|
||||
Features string
|
||||
//gres_detail_str char**;
|
||||
Group_id uint32
|
||||
Job_id uint32
|
||||
Job_state uint32
|
||||
Job_stateS string
|
||||
Licenses string
|
||||
Max_cpus uint32
|
||||
Max_nodes uint32
|
||||
Name string
|
||||
Network string
|
||||
Nodes string
|
||||
Nice uint32
|
||||
Node_inx int32
|
||||
Ntasks_per_core uint16
|
||||
Ntasks_per_node uint16
|
||||
Ntasks_per_socket uint16
|
||||
Ntasks_per_board uint16
|
||||
Num_cpus uint32
|
||||
Num_nodes uint32
|
||||
Partition string
|
||||
Pn_min_memory uint64
|
||||
Pn_min_cpus uint16
|
||||
Pn_min_tmp_disk uint32
|
||||
Preempt_time int64
|
||||
Pre_sus_time int64
|
||||
Priority uint32
|
||||
Profile uint32
|
||||
Qos string
|
||||
Req_nodes string
|
||||
Req_node_inx int32
|
||||
Req_switch uint32
|
||||
Requeue uint16
|
||||
Resize_time int64
|
||||
Restart_cnt uint16
|
||||
Resv_name string
|
||||
Shared uint16
|
||||
Show_flags uint16
|
||||
Sockets_per_board uint16
|
||||
Sockets_per_node uint16
|
||||
Start_time int64
|
||||
State_desc string
|
||||
State_reason uint16
|
||||
Submit_time int64
|
||||
Suspend_time int64
|
||||
Time_limit uint32
|
||||
Time_min uint32
|
||||
Threads_per_core uint16
|
||||
User_id uint32
|
||||
//accurate void;
|
||||
Wait4switch uint32
|
||||
Wckey string
|
||||
Work_dir string
|
||||
}
|
||||
|
||||
func Job_info_convert_c_to_go(c_struct *C.struct_job_info) Job_info {
|
||||
var go_struct Job_info
|
||||
|
||||
go_struct.Account = C.GoString(c_struct.account)
|
||||
go_struct.Alloc_node = C.GoString(c_struct.alloc_node)
|
||||
go_struct.Alloc_sid = uint32(c_struct.alloc_sid)
|
||||
go_struct.Array_job_id = uint32(c_struct.array_job_id)
|
||||
go_struct.Array_task_id = uint32(c_struct.array_task_id)
|
||||
go_struct.Assoc_id = uint32(c_struct.assoc_id)
|
||||
go_struct.Batch_flag = uint16(c_struct.batch_flag)
|
||||
go_struct.Batch_host = C.GoString(c_struct.batch_host)
|
||||
go_struct.Boards_per_node = uint16(c_struct.boards_per_node)
|
||||
go_struct.Command = C.GoString(c_struct.command)
|
||||
go_struct.Comment = C.GoString(c_struct.comment)
|
||||
go_struct.Contiguous = uint16(c_struct.contiguous)
|
||||
go_struct.Cores_per_socket = uint16(c_struct.cores_per_socket)
|
||||
go_struct.Cpus_per_task = uint16(c_struct.cpus_per_task)
|
||||
go_struct.Dependency = C.GoString(c_struct.dependency)
|
||||
go_struct.Derived_ec = uint32(c_struct.derived_ec)
|
||||
go_struct.Eligible_time = int64(c_struct.eligible_time)
|
||||
go_struct.End_time = int64(c_struct.end_time)
|
||||
go_struct.Exc_nodes = C.GoString(c_struct.exc_nodes)
|
||||
go_struct.Exc_node_inx = int32(C.int32_ptr(c_struct.exc_node_inx))
|
||||
go_struct.Exit_code = uint32(c_struct.exit_code)
|
||||
go_struct.Features = C.GoString(c_struct.features)
|
||||
go_struct.Group_id = uint32(c_struct.group_id)
|
||||
go_struct.Job_id = uint32(c_struct.job_id)
|
||||
go_struct.Job_state = uint32(c_struct.job_state)
|
||||
go_struct.Job_stateS = state_to_string(uint32(c_struct.job_state))
|
||||
go_struct.Licenses = C.GoString(c_struct.licenses)
|
||||
go_struct.Max_cpus = uint32(c_struct.max_cpus)
|
||||
go_struct.Max_nodes = uint32(c_struct.max_nodes)
|
||||
go_struct.Name = C.GoString(c_struct.name)
|
||||
go_struct.Network = C.GoString(c_struct.network)
|
||||
go_struct.Nodes = C.GoString(c_struct.nodes)
|
||||
go_struct.Nice = uint32(c_struct.nice)
|
||||
go_struct.Node_inx = int32(C.int32_ptr(c_struct.node_inx))
|
||||
go_struct.Ntasks_per_core = uint16(c_struct.ntasks_per_core)
|
||||
go_struct.Ntasks_per_node = uint16(c_struct.ntasks_per_node)
|
||||
go_struct.Ntasks_per_socket = uint16(c_struct.ntasks_per_socket)
|
||||
go_struct.Ntasks_per_board = uint16(c_struct.ntasks_per_board)
|
||||
go_struct.Num_cpus = uint32(c_struct.num_cpus)
|
||||
go_struct.Num_nodes = uint32(c_struct.num_nodes)
|
||||
go_struct.Partition = C.GoString(c_struct.partition)
|
||||
go_struct.Pn_min_memory = uint64(c_struct.pn_min_memory)
|
||||
go_struct.Pn_min_cpus = uint16(c_struct.pn_min_cpus)
|
||||
go_struct.Pn_min_tmp_disk = uint32(c_struct.pn_min_tmp_disk)
|
||||
go_struct.Preempt_time = int64(c_struct.preempt_time)
|
||||
go_struct.Pre_sus_time = int64(c_struct.pre_sus_time)
|
||||
go_struct.Priority = uint32(c_struct.priority)
|
||||
go_struct.Profile = uint32(c_struct.profile)
|
||||
go_struct.Qos = C.GoString(c_struct.qos)
|
||||
go_struct.Req_nodes = C.GoString(c_struct.req_nodes)
|
||||
go_struct.Req_node_inx = int32(C.int32_ptr(c_struct.req_node_inx))
|
||||
go_struct.Req_switch = uint32(c_struct.req_switch)
|
||||
go_struct.Requeue = uint16(c_struct.requeue)
|
||||
go_struct.Resize_time = int64(c_struct.resize_time)
|
||||
go_struct.Restart_cnt = uint16(c_struct.restart_cnt)
|
||||
go_struct.Resv_name = C.GoString(c_struct.resv_name)
|
||||
go_struct.Shared = uint16(c_struct.shared)
|
||||
go_struct.Show_flags = uint16(c_struct.show_flags)
|
||||
go_struct.Sockets_per_board = uint16(c_struct.sockets_per_board)
|
||||
go_struct.Sockets_per_node = uint16(c_struct.sockets_per_node)
|
||||
go_struct.Start_time = int64(c_struct.start_time)
|
||||
go_struct.State_desc = C.GoString(c_struct.state_desc)
|
||||
go_struct.State_reason = uint16(c_struct.state_reason)
|
||||
go_struct.Submit_time = int64(c_struct.submit_time)
|
||||
go_struct.Suspend_time = int64(c_struct.suspend_time)
|
||||
go_struct.Time_limit = uint32(c_struct.time_limit)
|
||||
go_struct.Time_min = uint32(c_struct.time_min)
|
||||
go_struct.Threads_per_core = uint16(c_struct.threads_per_core)
|
||||
go_struct.User_id = uint32(c_struct.user_id)
|
||||
go_struct.Wait4switch = uint32(c_struct.wait4switch)
|
||||
go_struct.Wckey = C.GoString(c_struct.wckey)
|
||||
go_struct.Work_dir = C.GoString(c_struct.work_dir)
|
||||
return go_struct
|
||||
}
|
||||
|
||||
func Print_Job_info(go_struct Job_info) {
|
||||
fmt.Printf("%s:\t %s\n", "account", go_struct.Account)
|
||||
fmt.Printf("%s:\t %s\n", "alloc node", go_struct.Alloc_node)
|
||||
fmt.Printf("%s:\t %d\n", "alloc sid", go_struct.Alloc_sid)
|
||||
fmt.Printf("%s:\t %d\n", "array job id", go_struct.Array_job_id)
|
||||
fmt.Printf("%s:\t %d\n", "array task id", go_struct.Array_task_id)
|
||||
fmt.Printf("%s:\t %d\n", "assoc id", go_struct.Assoc_id)
|
||||
fmt.Printf("%s:\t %d\n", "batch flag", go_struct.Batch_flag)
|
||||
fmt.Printf("%s:\t %s\n", "batch host", go_struct.Batch_host)
|
||||
fmt.Printf("%s:\t %d\n", "boards per node", go_struct.Boards_per_node)
|
||||
fmt.Printf("%s:\t %s\n", "command", go_struct.Command)
|
||||
fmt.Printf("%s:\t %s\n", "comment", go_struct.Comment)
|
||||
fmt.Printf("%s:\t %d\n", "contiguous", go_struct.Contiguous)
|
||||
fmt.Printf("%s:\t %d\n", "cores per socket", go_struct.Cores_per_socket)
|
||||
fmt.Printf("%s:\t %d\n", "cpus per task", go_struct.Cpus_per_task)
|
||||
fmt.Printf("%s:\t %s\n", "dependency", go_struct.Dependency)
|
||||
fmt.Printf("%s:\t %d\n", "derived ec", go_struct.Derived_ec)
|
||||
fmt.Printf("%s:\t %d\n", "eligible time", go_struct.Eligible_time)
|
||||
fmt.Printf("%s:\t %d\n", "end time", go_struct.End_time)
|
||||
fmt.Printf("%s:\t %s\n", "exc nodes", go_struct.Exc_nodes)
|
||||
fmt.Printf("%s:\t %d\n", "exc node inx", go_struct.Exc_node_inx)
|
||||
fmt.Printf("%s:\t %d\n", "exit code", go_struct.Exit_code)
|
||||
fmt.Printf("%s:\t %s\n", "features", go_struct.Features)
|
||||
fmt.Printf("%s:\t %d\n", "group id", go_struct.Group_id)
|
||||
fmt.Printf("%s:\t %d\n", "job id", go_struct.Job_id)
|
||||
fmt.Printf("%s:\t %d\n", "job state", go_struct.Job_state)
|
||||
fmt.Printf("%s:\t %s\n", "licenses", go_struct.Licenses)
|
||||
fmt.Printf("%s:\t %d\n", "max cpus", go_struct.Max_cpus)
|
||||
fmt.Printf("%s:\t %d\n", "max nodes", go_struct.Max_nodes)
|
||||
fmt.Printf("%s:\t %s\n", "name", go_struct.Name)
|
||||
fmt.Printf("%s:\t %s\n", "network", go_struct.Network)
|
||||
fmt.Printf("%s:\t %s\n", "nodes", go_struct.Nodes)
|
||||
fmt.Printf("%s:\t %d\n", "nice", go_struct.Nice)
|
||||
fmt.Printf("%s:\t %d\n", "node inx", go_struct.Node_inx)
|
||||
fmt.Printf("%s:\t %d\n", "ntasks per core", go_struct.Ntasks_per_core)
|
||||
fmt.Printf("%s:\t %d\n", "ntasks per node", go_struct.Ntasks_per_node)
|
||||
fmt.Printf("%s:\t %d\n", "ntasks per socket", go_struct.Ntasks_per_socket)
|
||||
fmt.Printf("%s:\t %d\n", "ntasks per board", go_struct.Ntasks_per_board)
|
||||
fmt.Printf("%s:\t %d\n", "num cpus", go_struct.Num_cpus)
|
||||
fmt.Printf("%s:\t %d\n", "num nodes", go_struct.Num_nodes)
|
||||
fmt.Printf("%s:\t %s\n", "partition", go_struct.Partition)
|
||||
fmt.Printf("%s:\t %d\n", "pn min memory", go_struct.Pn_min_memory)
|
||||
fmt.Printf("%s:\t %d\n", "pn min cpus", go_struct.Pn_min_cpus)
|
||||
fmt.Printf("%s:\t %d\n", "pn min tmp disk", go_struct.Pn_min_tmp_disk)
|
||||
fmt.Printf("%s:\t %d\n", "preempt time", go_struct.Preempt_time)
|
||||
fmt.Printf("%s:\t %d\n", "pre sus time", go_struct.Pre_sus_time)
|
||||
fmt.Printf("%s:\t %d\n", "priority", go_struct.Priority)
|
||||
fmt.Printf("%s:\t %d\n", "profile", go_struct.Profile)
|
||||
fmt.Printf("%s:\t %s\n", "qos", go_struct.Qos)
|
||||
fmt.Printf("%s:\t %s\n", "req nodes", go_struct.Req_nodes)
|
||||
fmt.Printf("%s:\t %d\n", "req node inx", go_struct.Req_node_inx)
|
||||
fmt.Printf("%s:\t %d\n", "req switch", go_struct.Req_switch)
|
||||
fmt.Printf("%s:\t %d\n", "requeue", go_struct.Requeue)
|
||||
fmt.Printf("%s:\t %d\n", "resize time", go_struct.Resize_time)
|
||||
fmt.Printf("%s:\t %d\n", "restart cnt", go_struct.Restart_cnt)
|
||||
fmt.Printf("%s:\t %s\n", "resv name", go_struct.Resv_name)
|
||||
fmt.Printf("%s:\t %d\n", "shared", go_struct.Shared)
|
||||
fmt.Printf("%s:\t %d\n", "show flags", go_struct.Show_flags)
|
||||
fmt.Printf("%s:\t %d\n", "sockets per board", go_struct.Sockets_per_board)
|
||||
fmt.Printf("%s:\t %d\n", "sockets per node", go_struct.Sockets_per_node)
|
||||
fmt.Printf("%s:\t %d\n", "start time", go_struct.Start_time)
|
||||
fmt.Printf("%s:\t %s\n", "state desc", go_struct.State_desc)
|
||||
fmt.Printf("%s:\t %d\n", "state reason", go_struct.State_reason)
|
||||
fmt.Printf("%s:\t %d\n", "submit time", go_struct.Submit_time)
|
||||
fmt.Printf("%s:\t %d\n", "suspend time", go_struct.Suspend_time)
|
||||
fmt.Printf("%s:\t %d\n", "time limit", go_struct.Time_limit)
|
||||
fmt.Printf("%s:\t %d\n", "time min", go_struct.Time_min)
|
||||
fmt.Printf("%s:\t %d\n", "threads per core", go_struct.Threads_per_core)
|
||||
fmt.Printf("%s:\t %d\n", "user id", go_struct.User_id)
|
||||
fmt.Printf("%s:\t %d\n", "wait4switch", go_struct.Wait4switch)
|
||||
fmt.Printf("%s:\t %s\n", "wckey", go_struct.Wckey)
|
||||
fmt.Printf("%s:\t %s\n", "work dir", go_struct.Work_dir)
|
||||
}
|
||||
|
||||
type Job_info_msg struct {
|
||||
Last_update int64
|
||||
Record_count uint32
|
||||
Error_code uint32
|
||||
Job_list []Job_info
|
||||
}
|
||||
|
||||
func Get_job_runtime(job Job_info) time.Duration {
|
||||
|
||||
start_time := time.Unix(job.Start_time, 0)
|
||||
current_time := time.Now()
|
||||
diff := current_time.Sub(start_time).Round(time.Second)
|
||||
if int64(diff) < 0 {
|
||||
return 0
|
||||
}
|
||||
end_time := time.Unix(job.End_time, 0)
|
||||
diff2 := current_time.Sub(end_time)
|
||||
if int64(diff2) < 0 {
|
||||
return diff
|
||||
}
|
||||
return end_time.Sub(start_time)
|
||||
}
|
||||
|
||||
func Get_job_endtime(id uint32) time.Time {
|
||||
c_time := C.get_job_endtime(C.int32_t(id))
|
||||
return time.Unix(int64(c_time), 0)
|
||||
|
||||
}
|
||||
|
||||
func Get_all_jobs() Job_info_msg {
|
||||
var go_job_buffer Job_info_msg
|
||||
c_job_buffer := C.get_job_info()
|
||||
if c_job_buffer == nil {
|
||||
go_job_buffer.Last_update = int64(0)
|
||||
go_job_buffer.Record_count = uint32(0)
|
||||
go_job_buffer.Error_code = uint32(C.slurm_get_errno())
|
||||
return go_job_buffer
|
||||
}
|
||||
|
||||
go_job_buffer.Last_update = int64(c_job_buffer.last_update)
|
||||
go_job_buffer.Record_count = uint32(c_job_buffer.record_count)
|
||||
go_job_buffer.Job_list = make([]Job_info, c_job_buffer.record_count, c_job_buffer.record_count)
|
||||
for i := uint32(0); i < go_job_buffer.Record_count; i++ {
|
||||
job := C.job_from_list(c_job_buffer, C.int(i))
|
||||
go_job := Job_info_convert_c_to_go(job)
|
||||
go_job_buffer.Job_list[i] = go_job
|
||||
}
|
||||
C.slurm_free_job_info_msg(c_job_buffer)
|
||||
|
||||
return go_job_buffer
|
||||
}
|
||||
|
||||
func Get_job(id uint32) Job_info_msg {
|
||||
var go_job_buffer Job_info_msg
|
||||
c_job_buffer := C.get_single_job_info(C.uint32_t(id))
|
||||
if c_job_buffer == nil {
|
||||
go_job_buffer.Last_update = int64(0)
|
||||
go_job_buffer.Record_count = uint32(0)
|
||||
go_job_buffer.Error_code = uint32(C.slurm_get_errno())
|
||||
return go_job_buffer
|
||||
}
|
||||
go_job_buffer.Last_update = int64(c_job_buffer.last_update)
|
||||
go_job_buffer.Record_count = uint32(c_job_buffer.record_count)
|
||||
go_job_buffer.Job_list = make([]Job_info, c_job_buffer.record_count, c_job_buffer.record_count)
|
||||
for i := uint32(0); i < go_job_buffer.Record_count; i++ {
|
||||
job := C.job_from_list(c_job_buffer, C.int(i))
|
||||
go_job := Job_info_convert_c_to_go(job)
|
||||
go_job_buffer.Job_list[i] = go_job
|
||||
}
|
||||
C.slurm_free_job_info_msg(c_job_buffer)
|
||||
|
||||
return go_job_buffer
|
||||
}
|
||||
|
||||
func Get_user_jobs(name string) Job_info_msg {
|
||||
|
||||
var go_job_buffer Job_info_msg
|
||||
user, err := user.Lookup(name)
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("Error %s\n", err.Error())
|
||||
go_job_buffer.Last_update = int64(0)
|
||||
go_job_buffer.Record_count = uint32(0)
|
||||
go_job_buffer.Error_code = C.ESLURMD_UID_NOT_FOUND
|
||||
|
||||
return go_job_buffer
|
||||
|
||||
}
|
||||
|
||||
userid, _ := strconv.Atoi(user.Uid)
|
||||
c_job_buffer := C.get_user_job_info(C.uint32_t(userid))
|
||||
|
||||
if c_job_buffer == nil {
|
||||
go_job_buffer.Last_update = int64(0)
|
||||
go_job_buffer.Record_count = uint32(0)
|
||||
go_job_buffer.Error_code = uint32(C.slurm_get_errno())
|
||||
return go_job_buffer
|
||||
}
|
||||
go_job_buffer.Last_update = int64(c_job_buffer.last_update)
|
||||
go_job_buffer.Record_count = uint32(c_job_buffer.record_count)
|
||||
go_job_buffer.Job_list = make([]Job_info, c_job_buffer.record_count, c_job_buffer.record_count)
|
||||
for i := uint32(0); i < go_job_buffer.Record_count; i++ {
|
||||
job := C.job_from_list(c_job_buffer, C.int(i))
|
||||
go_job := Job_info_convert_c_to_go(job)
|
||||
go_job_buffer.Job_list[i] = go_job
|
||||
}
|
||||
C.slurm_free_job_info_msg(c_job_buffer)
|
||||
|
||||
return go_job_buffer
|
||||
|
||||
}
|
|
@ -78,30 +78,16 @@ type Node_info struct {
|
|||
Arch string
|
||||
Boards uint16
|
||||
Boot_time int64
|
||||
Cluster_name string
|
||||
Cores uint16
|
||||
Core_spec_cnt uint16
|
||||
Cpu_bind uint32
|
||||
Cpu_load uint32
|
||||
Free_mem uint64
|
||||
Cpus uint16
|
||||
Cpu_spec_list string
|
||||
Features string
|
||||
Features_act string
|
||||
Gres string
|
||||
Gres_drain string
|
||||
Gres_used string
|
||||
Mcs_label string
|
||||
Mem_spec_limit uint64
|
||||
Name string
|
||||
Next_state uint32
|
||||
Node_addr string
|
||||
Node_hostname string
|
||||
Node_state uint32
|
||||
Os string
|
||||
Owner uint32
|
||||
Partitions string
|
||||
Port uint16
|
||||
Real_memory uint64
|
||||
Reason string
|
||||
Reason_time int64
|
||||
|
@ -111,8 +97,6 @@ type Node_info struct {
|
|||
Threads uint16
|
||||
Tmp_disk uint32
|
||||
Weight uint32
|
||||
Tres_fmt_str string
|
||||
Version string
|
||||
}
|
||||
|
||||
func Node_info_convert_c_to_go(c_struct *C.struct_node_info) Node_info {
|
||||
|
@ -121,30 +105,16 @@ func Node_info_convert_c_to_go(c_struct *C.struct_node_info) Node_info {
|
|||
go_struct.Arch = C.GoString(c_struct.arch)
|
||||
go_struct.Boards = uint16(c_struct.boards)
|
||||
go_struct.Boot_time = int64(c_struct.boot_time)
|
||||
go_struct.Cluster_name = C.GoString(c_struct.cluster_name)
|
||||
go_struct.Cores = uint16(c_struct.cores)
|
||||
go_struct.Core_spec_cnt = uint16(c_struct.core_spec_cnt)
|
||||
go_struct.Cpu_bind = uint32(c_struct.cpu_bind)
|
||||
go_struct.Cpu_load = uint32(c_struct.cpu_load)
|
||||
go_struct.Free_mem = uint64(c_struct.free_mem)
|
||||
go_struct.Cpus = uint16(c_struct.cpus)
|
||||
go_struct.Cpu_spec_list = C.GoString(c_struct.cpu_spec_list)
|
||||
go_struct.Features = C.GoString(c_struct.features)
|
||||
go_struct.Features_act = C.GoString(c_struct.features_act)
|
||||
go_struct.Gres = C.GoString(c_struct.gres)
|
||||
go_struct.Gres_drain = C.GoString(c_struct.gres_drain)
|
||||
go_struct.Gres_used = C.GoString(c_struct.gres_used)
|
||||
go_struct.Mcs_label = C.GoString(c_struct.mcs_label)
|
||||
go_struct.Mem_spec_limit = uint64(c_struct.mem_spec_limit)
|
||||
go_struct.Name = C.GoString(c_struct.name)
|
||||
go_struct.Next_state = uint32(c_struct.next_state)
|
||||
go_struct.Node_addr = C.GoString(c_struct.node_addr)
|
||||
go_struct.Node_hostname = C.GoString(c_struct.node_hostname)
|
||||
go_struct.Node_state = uint32(c_struct.node_state)
|
||||
go_struct.Os = C.GoString(c_struct.os)
|
||||
go_struct.Owner = uint32(c_struct.owner)
|
||||
go_struct.Partitions = C.GoString(c_struct.partitions)
|
||||
go_struct.Port = uint16(c_struct.port)
|
||||
go_struct.Real_memory = uint64(c_struct.real_memory)
|
||||
go_struct.Reason = C.GoString(c_struct.reason)
|
||||
go_struct.Reason_time = int64(c_struct.reason_time)
|
||||
|
@ -154,8 +124,6 @@ func Node_info_convert_c_to_go(c_struct *C.struct_node_info) Node_info {
|
|||
go_struct.Threads = uint16(c_struct.threads)
|
||||
go_struct.Tmp_disk = uint32(c_struct.tmp_disk)
|
||||
go_struct.Weight = uint32(c_struct.weight)
|
||||
go_struct.Tres_fmt_str = C.GoString(c_struct.tres_fmt_str)
|
||||
go_struct.Version = C.GoString(c_struct.version)
|
||||
return go_struct
|
||||
}
|
||||
|
||||
|
@ -186,30 +154,16 @@ func Print_node_info(go_struct Node_info) {
|
|||
fmt.Printf("%s:\t %s\n", "arch", go_struct.Arch)
|
||||
fmt.Printf("%s:\t %d\n", "boards", go_struct.Boards)
|
||||
fmt.Printf("%s:\t %d\n", "boot time", go_struct.Boot_time)
|
||||
fmt.Printf("%s:\t %s\n", "cluster name", go_struct.Cluster_name)
|
||||
fmt.Printf("%s:\t %d\n", "cores", go_struct.Cores)
|
||||
fmt.Printf("%s:\t %d\n", "core spec cnt", go_struct.Core_spec_cnt)
|
||||
fmt.Printf("%s:\t %d\n", "cpu bind", go_struct.Cpu_bind)
|
||||
fmt.Printf("%s:\t %d\n", "cpu load", go_struct.Cpu_load)
|
||||
fmt.Printf("%s:\t %d\n", "free mem", go_struct.Free_mem)
|
||||
fmt.Printf("%s:\t %d\n", "cpus", go_struct.Cpus)
|
||||
fmt.Printf("%s:\t %s\n", "cpu spec list", go_struct.Cpu_spec_list)
|
||||
fmt.Printf("%s:\t %s\n", "features", go_struct.Features)
|
||||
fmt.Printf("%s:\t %s\n", "features act", go_struct.Features_act)
|
||||
fmt.Printf("%s:\t %s\n", "gres", go_struct.Gres)
|
||||
fmt.Printf("%s:\t %s\n", "gres drain", go_struct.Gres_drain)
|
||||
fmt.Printf("%s:\t %s\n", "gres used", go_struct.Gres_used)
|
||||
fmt.Printf("%s:\t %s\n", "mcs label", go_struct.Mcs_label)
|
||||
fmt.Printf("%s:\t %d\n", "mem spec limit", go_struct.Mem_spec_limit)
|
||||
fmt.Printf("%s:\t %s\n", "name", go_struct.Name)
|
||||
fmt.Printf("%s:\t %d\n", "next state", go_struct.Next_state)
|
||||
fmt.Printf("%s:\t %s\n", "node addr", go_struct.Node_addr)
|
||||
fmt.Printf("%s:\t %s\n", "node hostname", go_struct.Node_hostname)
|
||||
fmt.Printf("%s:\t %d\n", "node state", go_struct.Node_state)
|
||||
fmt.Printf("%s:\t %s\n", "os", go_struct.Os)
|
||||
fmt.Printf("%s:\t %d\n", "owner", go_struct.Owner)
|
||||
fmt.Printf("%s:\t %s\n", "partitions", go_struct.Partitions)
|
||||
fmt.Printf("%s:\t %d\n", "port", go_struct.Port)
|
||||
fmt.Printf("%s:\t %d\n", "real memory", go_struct.Real_memory)
|
||||
fmt.Printf("%s:\t %s\n", "reason", go_struct.Reason)
|
||||
fmt.Printf("%s:\t %d\n", "reason time", go_struct.Reason_time)
|
||||
|
@ -219,8 +173,6 @@ func Print_node_info(go_struct Node_info) {
|
|||
fmt.Printf("%s:\t %d\n", "threads", go_struct.Threads)
|
||||
fmt.Printf("%s:\t %d\n", "tmp disk", go_struct.Tmp_disk)
|
||||
fmt.Printf("%s:\t %d\n", "weight", go_struct.Weight)
|
||||
fmt.Printf("%s:\t %s\n", "tres fmt str", go_struct.Tres_fmt_str)
|
||||
fmt.Printf("%s:\t %s\n", "version", go_struct.Version)
|
||||
}
|
||||
|
||||
type Node_info_msg struct {
|
|
@ -75,61 +75,40 @@ import "C"
|
|||
import "fmt"
|
||||
|
||||
type Partition_info struct {
|
||||
Allow_alloc_nodes string
|
||||
Allow_accounts string
|
||||
Allow_groups string
|
||||
Allow_qos string
|
||||
Alternate string
|
||||
Billing_weights_str string
|
||||
Cluster_name string
|
||||
Cr_type uint16
|
||||
Cpu_bind uint32
|
||||
Def_mem_per_cpu uint64
|
||||
Default_time uint32
|
||||
Deny_accounts string
|
||||
Deny_qos string
|
||||
Flags uint16
|
||||
Grace_time uint32
|
||||
Job_defaults_str string
|
||||
Max_cpus_per_node uint32
|
||||
Max_mem_per_cpu uint64
|
||||
Max_nodes uint32
|
||||
Max_share uint16
|
||||
Max_time uint32
|
||||
Min_nodes uint32
|
||||
Name string
|
||||
Node_inx []int32
|
||||
Nodes string
|
||||
Over_time_limit uint16
|
||||
Preempt_mode uint16
|
||||
Priority_job_factor uint16
|
||||
Priority_tier uint16
|
||||
Qos_char string
|
||||
State_up uint16
|
||||
Total_cpus uint32
|
||||
Total_nodes uint32
|
||||
Tres_fmt_str string
|
||||
Allow_alloc_nodes string
|
||||
Allow_groups string
|
||||
Alternate string
|
||||
Cr_type uint16
|
||||
Def_mem_per_cpu uint64
|
||||
Default_time uint32
|
||||
Flags uint16
|
||||
Grace_time uint32
|
||||
Max_cpus_per_node uint32
|
||||
Max_mem_per_cpu uint64
|
||||
Max_nodes uint32
|
||||
Max_share uint16
|
||||
Max_time uint32
|
||||
Min_nodes uint32
|
||||
Name string
|
||||
Node_inx []int32
|
||||
Nodes string
|
||||
Preempt_mode uint16
|
||||
State_up uint16
|
||||
Total_cpus uint32
|
||||
Total_nodes uint32
|
||||
}
|
||||
|
||||
func Partition_info_convert_c_to_go(c_struct *C.struct_partition_info) Partition_info {
|
||||
var go_struct Partition_info
|
||||
|
||||
go_struct.Allow_alloc_nodes = C.GoString(c_struct.allow_alloc_nodes)
|
||||
go_struct.Allow_accounts = C.GoString(c_struct.allow_accounts)
|
||||
go_struct.Allow_groups = C.GoString(c_struct.allow_groups)
|
||||
go_struct.Allow_qos = C.GoString(c_struct.allow_qos)
|
||||
go_struct.Alternate = C.GoString(c_struct.alternate)
|
||||
go_struct.Billing_weights_str = C.GoString(c_struct.billing_weights_str)
|
||||
go_struct.Cluster_name = C.GoString(c_struct.cluster_name)
|
||||
go_struct.Cr_type = uint16(c_struct.cr_type)
|
||||
go_struct.Cpu_bind = uint32(c_struct.cpu_bind)
|
||||
go_struct.Def_mem_per_cpu = uint64(c_struct.def_mem_per_cpu)
|
||||
go_struct.Default_time = uint32(c_struct.default_time)
|
||||
go_struct.Deny_accounts = C.GoString(c_struct.deny_accounts)
|
||||
go_struct.Deny_qos = C.GoString(c_struct.deny_qos)
|
||||
go_struct.Flags = uint16(c_struct.flags)
|
||||
go_struct.Grace_time = uint32(c_struct.grace_time)
|
||||
go_struct.Job_defaults_str = C.GoString(c_struct.job_defaults_str)
|
||||
go_struct.Max_cpus_per_node = uint32(c_struct.max_cpus_per_node)
|
||||
go_struct.Max_mem_per_cpu = uint64(c_struct.max_mem_per_cpu)
|
||||
go_struct.Max_nodes = uint32(c_struct.max_nodes)
|
||||
|
@ -146,34 +125,21 @@ func Partition_info_convert_c_to_go(c_struct *C.struct_partition_info) Partition
|
|||
|
||||
}
|
||||
go_struct.Nodes = C.GoString(c_struct.nodes)
|
||||
go_struct.Over_time_limit = uint16(c_struct.over_time_limit)
|
||||
go_struct.Preempt_mode = uint16(c_struct.preempt_mode)
|
||||
go_struct.Priority_job_factor = uint16(c_struct.priority_job_factor)
|
||||
go_struct.Priority_tier = uint16(c_struct.priority_tier)
|
||||
go_struct.Qos_char = C.GoString(c_struct.qos_char)
|
||||
go_struct.State_up = uint16(c_struct.state_up)
|
||||
go_struct.Total_cpus = uint32(c_struct.total_cpus)
|
||||
go_struct.Total_nodes = uint32(c_struct.total_nodes)
|
||||
go_struct.Tres_fmt_str = C.GoString(c_struct.tres_fmt_str)
|
||||
return go_struct
|
||||
}
|
||||
func Print_Partition_info(go_struct Partition_info) {
|
||||
fmt.Printf("%s:\t %s\n", "allow alloc nodes", go_struct.Allow_alloc_nodes)
|
||||
fmt.Printf("%s:\t %s\n", "allow accounts", go_struct.Allow_accounts)
|
||||
fmt.Printf("%s:\t %s\n", "allow groups", go_struct.Allow_groups)
|
||||
fmt.Printf("%s:\t %s\n", "allow qos", go_struct.Allow_qos)
|
||||
fmt.Printf("%s:\t %s\n", "alternate", go_struct.Alternate)
|
||||
fmt.Printf("%s:\t %s\n", "billing weights str", go_struct.Billing_weights_str)
|
||||
fmt.Printf("%s:\t %s\n", "cluster name", go_struct.Cluster_name)
|
||||
fmt.Printf("%s:\t %d\n", "cr type", go_struct.Cr_type)
|
||||
fmt.Printf("%s:\t %d\n", "cpu bind", go_struct.Cpu_bind)
|
||||
fmt.Printf("%s:\t %d\n", "def mem per cpu", go_struct.Def_mem_per_cpu)
|
||||
fmt.Printf("%s:\t %d\n", "default time", go_struct.Default_time)
|
||||
fmt.Printf("%s:\t %s\n", "deny accounts", go_struct.Deny_accounts)
|
||||
fmt.Printf("%s:\t %s\n", "deny qos", go_struct.Deny_qos)
|
||||
fmt.Printf("%s:\t %d\n", "flags", go_struct.Flags)
|
||||
fmt.Printf("%s:\t %d\n", "grace time", go_struct.Grace_time)
|
||||
fmt.Printf("%s:\t %s\n", "job defaults str", go_struct.Job_defaults_str)
|
||||
fmt.Printf("%s:\t %d\n", "max cpus per node", go_struct.Max_cpus_per_node)
|
||||
fmt.Printf("%s:\t %d\n", "max mem per cpu", go_struct.Max_mem_per_cpu)
|
||||
fmt.Printf("%s:\t %d\n", "max nodes", go_struct.Max_nodes)
|
||||
|
@ -183,15 +149,10 @@ func Print_Partition_info(go_struct Partition_info) {
|
|||
fmt.Printf("%s:\t %s\n", "name", go_struct.Name)
|
||||
fmt.Printf("%s:\t %d\n", "node inx", go_struct.Node_inx)
|
||||
fmt.Printf("%s:\t %s\n", "nodes", go_struct.Nodes)
|
||||
fmt.Printf("%s:\t %d\n", "over time limit", go_struct.Over_time_limit)
|
||||
fmt.Printf("%s:\t %d\n", "preempt mode", go_struct.Preempt_mode)
|
||||
fmt.Printf("%s:\t %d\n", "priority job factor", go_struct.Priority_job_factor)
|
||||
fmt.Printf("%s:\t %d\n", "priority tier", go_struct.Priority_tier)
|
||||
fmt.Printf("%s:\t %s\n", "qos char", go_struct.Qos_char)
|
||||
fmt.Printf("%s:\t %d\n", "state up", go_struct.State_up)
|
||||
fmt.Printf("%s:\t %d\n", "total cpus", go_struct.Total_cpus)
|
||||
fmt.Printf("%s:\t %d\n", "total nodes", go_struct.Total_nodes)
|
||||
fmt.Printf("%s:\t %s\n", "tres fmt str", go_struct.Tres_fmt_str)
|
||||
}
|
||||
|
||||
type Partition_info_msg struct {
|
|
@ -0,0 +1,574 @@
|
|||
package slurm
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lslurm
|
||||
#include<stdlib.h>
|
||||
#include<slurm/slurm.h>
|
||||
#include<slurm/slurm_errno.h>
|
||||
#ifndef ptr_convert
|
||||
#define ptr_convert
|
||||
|
||||
struct slurm_ctl_conf* get_config(uint64_t time){
|
||||
slurm_ctl_conf_t * config = NULL;
|
||||
slurm_load_ctl_conf ((time_t) time, &config);
|
||||
return config;
|
||||
|
||||
}
|
||||
|
||||
inline uint8_t uint8_ptr(uint8_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline int8_t int8_ptr(int8_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline uint16_t uint16_ptr(uint16_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline int16_t int16_ptr(int16_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline uint32_t uint32_ptr(uint32_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline int32_t int32_ptr(int32_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline uint64_t uint64_ptr(uint64_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
inline int64_t int64_ptr(int16_t* pointer) {
|
||||
if (NULL == pointer) {
|
||||
return -1;}
|
||||
return *pointer;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Ctl_conf struct {
|
||||
Last_update int64
|
||||
Accounting_storage_tres string
|
||||
Accounting_storage_enforce uint16
|
||||
Accounting_storage_backup_host string
|
||||
Accounting_storage_host string
|
||||
Accounting_storage_loc string
|
||||
Accounting_storage_pass string
|
||||
Accounting_storage_port uint32
|
||||
Accounting_storage_type string
|
||||
Accounting_storage_user string
|
||||
Acctng_store_job_comment uint16
|
||||
//acct_gather_conf void;
|
||||
Acct_gather_energy_type string
|
||||
Acct_gather_profile_type string
|
||||
Acct_gather_filesystem_type string
|
||||
Acct_gather_node_freq uint16
|
||||
Authtype string
|
||||
Batch_start_timeout uint16
|
||||
Boot_time int64
|
||||
//cgroup_conf void;
|
||||
Checkpoint_type string
|
||||
Cluster_name string
|
||||
Complete_wait uint16
|
||||
Debug_flags uint64
|
||||
Def_mem_per_cpu uint64
|
||||
Disable_root_jobs uint16
|
||||
Enforce_part_limits uint16
|
||||
Epilog string
|
||||
Epilog_msg_time uint32
|
||||
Epilog_slurmctld string
|
||||
Ext_sensors_type string
|
||||
Ext_sensors_freq uint16
|
||||
//ext_sensors_conf void;
|
||||
Fast_schedule uint16
|
||||
First_job_id uint32
|
||||
Get_env_timeout uint16
|
||||
Gres_plugins string
|
||||
Hash_val uint32
|
||||
Health_check_interval uint16
|
||||
Health_check_node_state uint16
|
||||
Health_check_program string
|
||||
Inactive_limit uint16
|
||||
Job_acct_gather_freq string
|
||||
Job_acct_gather_type string
|
||||
Job_ckpt_dir string
|
||||
Job_comp_host string
|
||||
Job_comp_loc string
|
||||
Job_comp_pass string
|
||||
Job_comp_port uint32
|
||||
Job_comp_type string
|
||||
Job_comp_user string
|
||||
Job_credential_private_key string
|
||||
Job_credential_public_certificate string
|
||||
Job_file_append uint16
|
||||
Job_requeue uint16
|
||||
Job_submit_plugins string
|
||||
Keep_alive_time uint16
|
||||
Kill_on_bad_exit uint16
|
||||
Kill_wait uint16
|
||||
Launch_type string
|
||||
Licenses string
|
||||
Licenses_used string
|
||||
Mail_prog string
|
||||
Max_array_sz uint32
|
||||
Max_job_cnt uint32
|
||||
Max_job_id uint32
|
||||
Max_mem_per_cpu uint64
|
||||
Max_step_cnt uint32
|
||||
Max_tasks_per_node uint16
|
||||
Min_job_age uint32
|
||||
Mpi_default string
|
||||
Mpi_params string
|
||||
Msg_timeout uint16
|
||||
Next_job_id uint32
|
||||
//node_features_conf void;
|
||||
Node_prefix string
|
||||
Over_time_limit uint16
|
||||
Plugindir string
|
||||
Plugstack string
|
||||
Preempt_mode uint16
|
||||
Preempt_type string
|
||||
Priority_decay_hl uint32
|
||||
Priority_calc_period uint32
|
||||
Priority_favor_small uint16
|
||||
Priority_flags uint16
|
||||
Priority_max_age uint32
|
||||
Priority_reset_period uint16
|
||||
Priority_type string
|
||||
Priority_weight_age uint32
|
||||
Priority_weight_fs uint32
|
||||
Priority_weight_js uint32
|
||||
Priority_weight_part uint32
|
||||
Priority_weight_qos uint32
|
||||
Private_data uint16
|
||||
Proctrack_type string
|
||||
Prolog string
|
||||
Prolog_slurmctld string
|
||||
Propagate_prio_process uint16
|
||||
Propagate_rlimits string
|
||||
Propagate_rlimits_except string
|
||||
Reboot_program string
|
||||
Reconfig_flags uint16
|
||||
Resume_program string
|
||||
Resume_rate uint16
|
||||
Resume_timeout uint16
|
||||
Resv_epilog string
|
||||
Resv_over_run uint16
|
||||
Resv_prolog string
|
||||
Ret2service uint16
|
||||
Salloc_default_command string
|
||||
Sched_logfile string
|
||||
Sched_log_level uint16
|
||||
Sched_params string
|
||||
Sched_time_slice uint16
|
||||
Schedtype string
|
||||
Select_type string
|
||||
//select_conf_key_pairs void;
|
||||
Select_type_param uint16
|
||||
Slurm_conf string
|
||||
Slurm_user_id uint32
|
||||
Slurm_user_name string
|
||||
Slurmd_user_id uint32
|
||||
Slurmd_user_name string
|
||||
Slurmctld_debug uint16
|
||||
Slurmctld_logfile string
|
||||
Slurmctld_pidfile string
|
||||
Slurmctld_plugstack string
|
||||
//slurmctld_plugstack_conf void;
|
||||
Slurmctld_port uint32
|
||||
Slurmctld_port_count uint16
|
||||
Slurmctld_timeout uint16
|
||||
Slurmd_debug uint16
|
||||
Slurmd_logfile string
|
||||
Slurmd_pidfile string
|
||||
Slurmd_port uint32
|
||||
Slurmd_spooldir string
|
||||
Slurmd_timeout uint16
|
||||
Srun_epilog string
|
||||
Srun_prolog string
|
||||
State_save_location string
|
||||
Suspend_exc_nodes string
|
||||
Suspend_exc_parts string
|
||||
Suspend_program string
|
||||
Suspend_rate uint16
|
||||
Suspend_time uint32
|
||||
Suspend_timeout uint16
|
||||
Switch_type string
|
||||
Task_epilog string
|
||||
Task_plugin string
|
||||
Task_plugin_param uint32
|
||||
Task_prolog string
|
||||
Tmp_fs string
|
||||
Topology_plugin string
|
||||
Track_wckey uint16
|
||||
Tree_width uint16
|
||||
Unkillable_program string
|
||||
Unkillable_timeout uint16
|
||||
Use_pam uint16
|
||||
Version string
|
||||
Vsize_factor uint16
|
||||
Wait_time uint16
|
||||
}
|
||||
|
||||
func Ctl_conf_convert_c_to_go(c_struct *C.struct_slurm_ctl_conf) Ctl_conf {
|
||||
var go_struct Ctl_conf
|
||||
|
||||
go_struct.Last_update = int64(c_struct.last_update)
|
||||
go_struct.Accounting_storage_enforce = uint16(c_struct.accounting_storage_enforce)
|
||||
go_struct.Accounting_storage_backup_host = C.GoString(c_struct.accounting_storage_backup_host)
|
||||
go_struct.Accounting_storage_host = C.GoString(c_struct.accounting_storage_host)
|
||||
go_struct.Accounting_storage_loc = C.GoString(c_struct.accounting_storage_loc)
|
||||
go_struct.Accounting_storage_pass = C.GoString(c_struct.accounting_storage_pass)
|
||||
go_struct.Accounting_storage_port = uint32(c_struct.accounting_storage_port)
|
||||
go_struct.Accounting_storage_type = C.GoString(c_struct.accounting_storage_type)
|
||||
go_struct.Accounting_storage_user = C.GoString(c_struct.accounting_storage_user)
|
||||
go_struct.Acctng_store_job_comment = uint16(c_struct.acctng_store_job_comment)
|
||||
go_struct.Acct_gather_energy_type = C.GoString(c_struct.acct_gather_energy_type)
|
||||
go_struct.Acct_gather_profile_type = C.GoString(c_struct.acct_gather_profile_type)
|
||||
go_struct.Acct_gather_filesystem_type = C.GoString(c_struct.acct_gather_filesystem_type)
|
||||
go_struct.Acct_gather_node_freq = uint16(c_struct.acct_gather_node_freq)
|
||||
go_struct.Authtype = C.GoString(c_struct.authtype)
|
||||
go_struct.Batch_start_timeout = uint16(c_struct.batch_start_timeout)
|
||||
go_struct.Boot_time = int64(c_struct.boot_time)
|
||||
go_struct.Checkpoint_type = C.GoString(c_struct.checkpoint_type)
|
||||
go_struct.Cluster_name = C.GoString(c_struct.cluster_name)
|
||||
go_struct.Complete_wait = uint16(c_struct.complete_wait)
|
||||
go_struct.Debug_flags = uint64(c_struct.debug_flags)
|
||||
go_struct.Def_mem_per_cpu = uint64(c_struct.def_mem_per_cpu)
|
||||
go_struct.Disable_root_jobs = uint16(c_struct.disable_root_jobs)
|
||||
go_struct.Enforce_part_limits = uint16(c_struct.enforce_part_limits)
|
||||
go_struct.Epilog = C.GoString(c_struct.epilog)
|
||||
go_struct.Epilog_msg_time = uint32(c_struct.epilog_msg_time)
|
||||
go_struct.Epilog_slurmctld = C.GoString(c_struct.epilog_slurmctld)
|
||||
go_struct.Ext_sensors_type = C.GoString(c_struct.ext_sensors_type)
|
||||
go_struct.Ext_sensors_freq = uint16(c_struct.ext_sensors_freq)
|
||||
go_struct.Fast_schedule = uint16(c_struct.fast_schedule)
|
||||
go_struct.First_job_id = uint32(c_struct.first_job_id)
|
||||
go_struct.Get_env_timeout = uint16(c_struct.get_env_timeout)
|
||||
go_struct.Gres_plugins = C.GoString(c_struct.gres_plugins)
|
||||
go_struct.Hash_val = uint32(c_struct.hash_val)
|
||||
go_struct.Health_check_interval = uint16(c_struct.health_check_interval)
|
||||
go_struct.Health_check_node_state = uint16(c_struct.health_check_node_state)
|
||||
go_struct.Health_check_program = C.GoString(c_struct.health_check_program)
|
||||
go_struct.Inactive_limit = uint16(c_struct.inactive_limit)
|
||||
go_struct.Job_acct_gather_freq = C.GoString(c_struct.job_acct_gather_freq)
|
||||
go_struct.Job_acct_gather_type = C.GoString(c_struct.job_acct_gather_type)
|
||||
go_struct.Job_ckpt_dir = C.GoString(c_struct.job_ckpt_dir)
|
||||
go_struct.Job_comp_host = C.GoString(c_struct.job_comp_host)
|
||||
go_struct.Job_comp_loc = C.GoString(c_struct.job_comp_loc)
|
||||
go_struct.Job_comp_pass = C.GoString(c_struct.job_comp_pass)
|
||||
go_struct.Job_comp_port = uint32(c_struct.job_comp_port)
|
||||
go_struct.Job_comp_type = C.GoString(c_struct.job_comp_type)
|
||||
go_struct.Job_comp_user = C.GoString(c_struct.job_comp_user)
|
||||
go_struct.Job_credential_private_key = C.GoString(c_struct.job_credential_private_key)
|
||||
go_struct.Job_credential_public_certificate = C.GoString(c_struct.job_credential_public_certificate)
|
||||
go_struct.Job_file_append = uint16(c_struct.job_file_append)
|
||||
go_struct.Job_requeue = uint16(c_struct.job_requeue)
|
||||
go_struct.Job_submit_plugins = C.GoString(c_struct.job_submit_plugins)
|
||||
go_struct.Keep_alive_time = uint16(c_struct.keep_alive_time)
|
||||
go_struct.Kill_on_bad_exit = uint16(c_struct.kill_on_bad_exit)
|
||||
go_struct.Kill_wait = uint16(c_struct.kill_wait)
|
||||
go_struct.Launch_type = C.GoString(c_struct.launch_type)
|
||||
go_struct.Licenses = C.GoString(c_struct.licenses)
|
||||
go_struct.Licenses_used = C.GoString(c_struct.licenses_used)
|
||||
go_struct.Mail_prog = C.GoString(c_struct.mail_prog)
|
||||
go_struct.Max_array_sz = uint32(c_struct.max_array_sz)
|
||||
go_struct.Max_job_cnt = uint32(c_struct.max_job_cnt)
|
||||
go_struct.Max_job_id = uint32(c_struct.max_job_id)
|
||||
go_struct.Max_mem_per_cpu = uint64(c_struct.max_mem_per_cpu)
|
||||
go_struct.Max_step_cnt = uint32(c_struct.max_step_cnt)
|
||||
go_struct.Max_tasks_per_node = uint16(c_struct.max_tasks_per_node)
|
||||
go_struct.Min_job_age = uint32(c_struct.min_job_age)
|
||||
go_struct.Mpi_default = C.GoString(c_struct.mpi_default)
|
||||
go_struct.Mpi_params = C.GoString(c_struct.mpi_params)
|
||||
go_struct.Msg_timeout = uint16(c_struct.msg_timeout)
|
||||
go_struct.Next_job_id = uint32(c_struct.next_job_id)
|
||||
go_struct.Node_prefix = C.GoString(c_struct.node_prefix)
|
||||
go_struct.Over_time_limit = uint16(c_struct.over_time_limit)
|
||||
go_struct.Plugindir = C.GoString(c_struct.plugindir)
|
||||
go_struct.Plugstack = C.GoString(c_struct.plugstack)
|
||||
go_struct.Preempt_mode = uint16(c_struct.preempt_mode)
|
||||
go_struct.Preempt_type = C.GoString(c_struct.preempt_type)
|
||||
go_struct.Priority_decay_hl = uint32(c_struct.priority_decay_hl)
|
||||
go_struct.Priority_calc_period = uint32(c_struct.priority_calc_period)
|
||||
go_struct.Priority_favor_small = uint16(c_struct.priority_favor_small)
|
||||
go_struct.Priority_flags = uint16(c_struct.priority_flags)
|
||||
go_struct.Priority_max_age = uint32(c_struct.priority_max_age)
|
||||
go_struct.Priority_reset_period = uint16(c_struct.priority_reset_period)
|
||||
go_struct.Priority_type = C.GoString(c_struct.priority_type)
|
||||
go_struct.Priority_weight_age = uint32(c_struct.priority_weight_age)
|
||||
go_struct.Priority_weight_fs = uint32(c_struct.priority_weight_fs)
|
||||
go_struct.Priority_weight_js = uint32(c_struct.priority_weight_js)
|
||||
go_struct.Priority_weight_part = uint32(c_struct.priority_weight_part)
|
||||
go_struct.Priority_weight_qos = uint32(c_struct.priority_weight_qos)
|
||||
go_struct.Private_data = uint16(c_struct.private_data)
|
||||
go_struct.Proctrack_type = C.GoString(c_struct.proctrack_type)
|
||||
go_struct.Prolog = C.GoString(c_struct.prolog)
|
||||
go_struct.Prolog_slurmctld = C.GoString(c_struct.prolog_slurmctld)
|
||||
go_struct.Propagate_prio_process = uint16(c_struct.propagate_prio_process)
|
||||
go_struct.Propagate_rlimits = C.GoString(c_struct.propagate_rlimits)
|
||||
go_struct.Propagate_rlimits_except = C.GoString(c_struct.propagate_rlimits_except)
|
||||
go_struct.Reboot_program = C.GoString(c_struct.reboot_program)
|
||||
go_struct.Reconfig_flags = uint16(c_struct.reconfig_flags)
|
||||
go_struct.Resume_program = C.GoString(c_struct.resume_program)
|
||||
go_struct.Resume_rate = uint16(c_struct.resume_rate)
|
||||
go_struct.Resume_timeout = uint16(c_struct.resume_timeout)
|
||||
go_struct.Resv_epilog = C.GoString(c_struct.resv_epilog)
|
||||
go_struct.Resv_over_run = uint16(c_struct.resv_over_run)
|
||||
go_struct.Resv_prolog = C.GoString(c_struct.resv_prolog)
|
||||
go_struct.Ret2service = uint16(c_struct.ret2service)
|
||||
go_struct.Salloc_default_command = C.GoString(c_struct.salloc_default_command)
|
||||
go_struct.Sched_logfile = C.GoString(c_struct.sched_logfile)
|
||||
go_struct.Sched_log_level = uint16(c_struct.sched_log_level)
|
||||
go_struct.Sched_params = C.GoString(c_struct.sched_params)
|
||||
go_struct.Sched_time_slice = uint16(c_struct.sched_time_slice)
|
||||
go_struct.Schedtype = C.GoString(c_struct.schedtype)
|
||||
go_struct.Select_type = C.GoString(c_struct.select_type)
|
||||
go_struct.Select_type_param = uint16(c_struct.select_type_param)
|
||||
go_struct.Slurm_conf = C.GoString(c_struct.slurm_conf)
|
||||
go_struct.Slurm_user_id = uint32(c_struct.slurm_user_id)
|
||||
go_struct.Slurm_user_name = C.GoString(c_struct.slurm_user_name)
|
||||
go_struct.Slurmd_user_id = uint32(c_struct.slurmd_user_id)
|
||||
go_struct.Slurmd_user_name = C.GoString(c_struct.slurmd_user_name)
|
||||
go_struct.Slurmctld_debug = uint16(c_struct.slurmctld_debug)
|
||||
go_struct.Slurmctld_logfile = C.GoString(c_struct.slurmctld_logfile)
|
||||
go_struct.Slurmctld_pidfile = C.GoString(c_struct.slurmctld_pidfile)
|
||||
go_struct.Slurmctld_plugstack = C.GoString(c_struct.slurmctld_plugstack)
|
||||
go_struct.Slurmctld_port = uint32(c_struct.slurmctld_port)
|
||||
go_struct.Slurmctld_port_count = uint16(c_struct.slurmctld_port_count)
|
||||
go_struct.Slurmctld_timeout = uint16(c_struct.slurmctld_timeout)
|
||||
go_struct.Slurmd_debug = uint16(c_struct.slurmd_debug)
|
||||
go_struct.Slurmd_logfile = C.GoString(c_struct.slurmd_logfile)
|
||||
go_struct.Slurmd_pidfile = C.GoString(c_struct.slurmd_pidfile)
|
||||
go_struct.Slurmd_port = uint32(c_struct.slurmd_port)
|
||||
go_struct.Slurmd_spooldir = C.GoString(c_struct.slurmd_spooldir)
|
||||
go_struct.Slurmd_timeout = uint16(c_struct.slurmd_timeout)
|
||||
go_struct.Srun_epilog = C.GoString(c_struct.srun_epilog)
|
||||
go_struct.Srun_prolog = C.GoString(c_struct.srun_prolog)
|
||||
go_struct.State_save_location = C.GoString(c_struct.state_save_location)
|
||||
go_struct.Suspend_exc_nodes = C.GoString(c_struct.suspend_exc_nodes)
|
||||
go_struct.Suspend_exc_parts = C.GoString(c_struct.suspend_exc_parts)
|
||||
go_struct.Suspend_program = C.GoString(c_struct.suspend_program)
|
||||
go_struct.Suspend_rate = uint16(c_struct.suspend_rate)
|
||||
go_struct.Suspend_time = uint32(c_struct.suspend_time)
|
||||
go_struct.Suspend_timeout = uint16(c_struct.suspend_timeout)
|
||||
go_struct.Switch_type = C.GoString(c_struct.switch_type)
|
||||
go_struct.Task_epilog = C.GoString(c_struct.task_epilog)
|
||||
go_struct.Task_plugin = C.GoString(c_struct.task_plugin)
|
||||
go_struct.Task_plugin_param = uint32(c_struct.task_plugin_param)
|
||||
go_struct.Task_prolog = C.GoString(c_struct.task_prolog)
|
||||
go_struct.Tmp_fs = C.GoString(c_struct.tmp_fs)
|
||||
go_struct.Topology_plugin = C.GoString(c_struct.topology_plugin)
|
||||
go_struct.Track_wckey = uint16(c_struct.track_wckey)
|
||||
go_struct.Tree_width = uint16(c_struct.tree_width)
|
||||
go_struct.Unkillable_program = C.GoString(c_struct.unkillable_program)
|
||||
go_struct.Unkillable_timeout = uint16(c_struct.unkillable_timeout)
|
||||
go_struct.Use_pam = uint16(c_struct.use_pam)
|
||||
go_struct.Version = C.GoString(c_struct.version)
|
||||
go_struct.Vsize_factor = uint16(c_struct.vsize_factor)
|
||||
go_struct.Wait_time = uint16(c_struct.wait_time)
|
||||
return go_struct
|
||||
}
|
||||
|
||||
func Print_Ctl_conf(go_struct Ctl_conf) {
|
||||
fmt.Printf("%s:\t %d\n", "last update", go_struct.Last_update)
|
||||
fmt.Printf("%s:\t %s\n", "accounting storage tres", go_struct.Accounting_storage_tres)
|
||||
fmt.Printf("%s:\t %d\n", "accounting storage enforce", go_struct.Accounting_storage_enforce)
|
||||
fmt.Printf("%s:\t %s\n", "accounting storage backup host", go_struct.Accounting_storage_backup_host)
|
||||
fmt.Printf("%s:\t %s\n", "accounting storage host", go_struct.Accounting_storage_host)
|
||||
fmt.Printf("%s:\t %s\n", "accounting storage loc", go_struct.Accounting_storage_loc)
|
||||
fmt.Printf("%s:\t %s\n", "accounting storage pass", go_struct.Accounting_storage_pass)
|
||||
fmt.Printf("%s:\t %d\n", "accounting storage port", go_struct.Accounting_storage_port)
|
||||
fmt.Printf("%s:\t %s\n", "accounting storage type", go_struct.Accounting_storage_type)
|
||||
fmt.Printf("%s:\t %s\n", "accounting storage user", go_struct.Accounting_storage_user)
|
||||
fmt.Printf("%s:\t %d\n", "acctng store job comment", go_struct.Acctng_store_job_comment)
|
||||
fmt.Printf("%s:\t %s\n", "acct gather energy type", go_struct.Acct_gather_energy_type)
|
||||
fmt.Printf("%s:\t %s\n", "acct gather profile type", go_struct.Acct_gather_profile_type)
|
||||
fmt.Printf("%s:\t %s\n", "acct gather filesystem type", go_struct.Acct_gather_filesystem_type)
|
||||
fmt.Printf("%s:\t %d\n", "acct gather node freq", go_struct.Acct_gather_node_freq)
|
||||
fmt.Printf("%s:\t %s\n", "authtype", go_struct.Authtype)
|
||||
fmt.Printf("%s:\t %d\n", "batch start timeout", go_struct.Batch_start_timeout)
|
||||
fmt.Printf("%s:\t %d\n", "boot time", go_struct.Boot_time)
|
||||
fmt.Printf("%s:\t %s\n", "checkpoint type", go_struct.Checkpoint_type)
|
||||
fmt.Printf("%s:\t %s\n", "cluster name", go_struct.Cluster_name)
|
||||
fmt.Printf("%s:\t %d\n", "complete wait", go_struct.Complete_wait)
|
||||
fmt.Printf("%s:\t %d\n", "debug flags", go_struct.Debug_flags)
|
||||
fmt.Printf("%s:\t %d\n", "def mem per cpu", go_struct.Def_mem_per_cpu)
|
||||
fmt.Printf("%s:\t %d\n", "disable root jobs", go_struct.Disable_root_jobs)
|
||||
fmt.Printf("%s:\t %d\n", "enforce part limits", go_struct.Enforce_part_limits)
|
||||
fmt.Printf("%s:\t %s\n", "epilog", go_struct.Epilog)
|
||||
fmt.Printf("%s:\t %d\n", "epilog msg time", go_struct.Epilog_msg_time)
|
||||
fmt.Printf("%s:\t %s\n", "epilog slurmctld", go_struct.Epilog_slurmctld)
|
||||
fmt.Printf("%s:\t %s\n", "ext sensors type", go_struct.Ext_sensors_type)
|
||||
fmt.Printf("%s:\t %d\n", "ext sensors freq", go_struct.Ext_sensors_freq)
|
||||
fmt.Printf("%s:\t %d\n", "fast schedule", go_struct.Fast_schedule)
|
||||
fmt.Printf("%s:\t %d\n", "first job id", go_struct.First_job_id)
|
||||
fmt.Printf("%s:\t %d\n", "get env timeout", go_struct.Get_env_timeout)
|
||||
fmt.Printf("%s:\t %s\n", "gres plugins", go_struct.Gres_plugins)
|
||||
fmt.Printf("%s:\t %d\n", "hash val", go_struct.Hash_val)
|
||||
fmt.Printf("%s:\t %d\n", "health check interval", go_struct.Health_check_interval)
|
||||
fmt.Printf("%s:\t %d\n", "health check node state", go_struct.Health_check_node_state)
|
||||
fmt.Printf("%s:\t %s\n", "health check program", go_struct.Health_check_program)
|
||||
fmt.Printf("%s:\t %d\n", "inactive limit", go_struct.Inactive_limit)
|
||||
fmt.Printf("%s:\t %s\n", "job acct gather freq", go_struct.Job_acct_gather_freq)
|
||||
fmt.Printf("%s:\t %s\n", "job acct gather type", go_struct.Job_acct_gather_type)
|
||||
fmt.Printf("%s:\t %s\n", "job ckpt dir", go_struct.Job_ckpt_dir)
|
||||
fmt.Printf("%s:\t %s\n", "job comp host", go_struct.Job_comp_host)
|
||||
fmt.Printf("%s:\t %s\n", "job comp loc", go_struct.Job_comp_loc)
|
||||
fmt.Printf("%s:\t %s\n", "job comp pass", go_struct.Job_comp_pass)
|
||||
fmt.Printf("%s:\t %d\n", "job comp port", go_struct.Job_comp_port)
|
||||
fmt.Printf("%s:\t %s\n", "job comp type", go_struct.Job_comp_type)
|
||||
fmt.Printf("%s:\t %s\n", "job comp user", go_struct.Job_comp_user)
|
||||
fmt.Printf("%s:\t %s\n", "job credential private key", go_struct.Job_credential_private_key)
|
||||
fmt.Printf("%s:\t %s\n", "job credential public certificate", go_struct.Job_credential_public_certificate)
|
||||
fmt.Printf("%s:\t %d\n", "job file append", go_struct.Job_file_append)
|
||||
fmt.Printf("%s:\t %d\n", "job requeue", go_struct.Job_requeue)
|
||||
fmt.Printf("%s:\t %s\n", "job submit plugins", go_struct.Job_submit_plugins)
|
||||
fmt.Printf("%s:\t %d\n", "keep alive time", go_struct.Keep_alive_time)
|
||||
fmt.Printf("%s:\t %d\n", "kill on bad exit", go_struct.Kill_on_bad_exit)
|
||||
fmt.Printf("%s:\t %d\n", "kill wait", go_struct.Kill_wait)
|
||||
fmt.Printf("%s:\t %s\n", "launch type", go_struct.Launch_type)
|
||||
fmt.Printf("%s:\t %s\n", "licenses", go_struct.Licenses)
|
||||
fmt.Printf("%s:\t %s\n", "licenses used", go_struct.Licenses_used)
|
||||
fmt.Printf("%s:\t %s\n", "mail prog", go_struct.Mail_prog)
|
||||
fmt.Printf("%s:\t %d\n", "max array sz", go_struct.Max_array_sz)
|
||||
fmt.Printf("%s:\t %d\n", "max job cnt", go_struct.Max_job_cnt)
|
||||
fmt.Printf("%s:\t %d\n", "max job id", go_struct.Max_job_id)
|
||||
fmt.Printf("%s:\t %d\n", "max mem per cpu", go_struct.Max_mem_per_cpu)
|
||||
fmt.Printf("%s:\t %d\n", "max step cnt", go_struct.Max_step_cnt)
|
||||
fmt.Printf("%s:\t %d\n", "max tasks per node", go_struct.Max_tasks_per_node)
|
||||
fmt.Printf("%s:\t %d\n", "min job age", go_struct.Min_job_age)
|
||||
fmt.Printf("%s:\t %s\n", "mpi default", go_struct.Mpi_default)
|
||||
fmt.Printf("%s:\t %s\n", "mpi params", go_struct.Mpi_params)
|
||||
fmt.Printf("%s:\t %d\n", "msg timeout", go_struct.Msg_timeout)
|
||||
fmt.Printf("%s:\t %d\n", "next job id", go_struct.Next_job_id)
|
||||
fmt.Printf("%s:\t %s\n", "node prefix", go_struct.Node_prefix)
|
||||
fmt.Printf("%s:\t %d\n", "over time limit", go_struct.Over_time_limit)
|
||||
fmt.Printf("%s:\t %s\n", "plugindir", go_struct.Plugindir)
|
||||
fmt.Printf("%s:\t %s\n", "plugstack", go_struct.Plugstack)
|
||||
fmt.Printf("%s:\t %d\n", "preempt mode", go_struct.Preempt_mode)
|
||||
fmt.Printf("%s:\t %s\n", "preempt type", go_struct.Preempt_type)
|
||||
fmt.Printf("%s:\t %d\n", "priority decay hl", go_struct.Priority_decay_hl)
|
||||
fmt.Printf("%s:\t %d\n", "priority calc period", go_struct.Priority_calc_period)
|
||||
fmt.Printf("%s:\t %d\n", "priority favor small", go_struct.Priority_favor_small)
|
||||
fmt.Printf("%s:\t %d\n", "priority flags", go_struct.Priority_flags)
|
||||
fmt.Printf("%s:\t %d\n", "priority max age", go_struct.Priority_max_age)
|
||||
fmt.Printf("%s:\t %d\n", "priority reset period", go_struct.Priority_reset_period)
|
||||
fmt.Printf("%s:\t %s\n", "priority type", go_struct.Priority_type)
|
||||
fmt.Printf("%s:\t %d\n", "priority weight age", go_struct.Priority_weight_age)
|
||||
fmt.Printf("%s:\t %d\n", "priority weight fs", go_struct.Priority_weight_fs)
|
||||
fmt.Printf("%s:\t %d\n", "priority weight js", go_struct.Priority_weight_js)
|
||||
fmt.Printf("%s:\t %d\n", "priority weight part", go_struct.Priority_weight_part)
|
||||
fmt.Printf("%s:\t %d\n", "priority weight qos", go_struct.Priority_weight_qos)
|
||||
fmt.Printf("%s:\t %d\n", "private data", go_struct.Private_data)
|
||||
fmt.Printf("%s:\t %s\n", "proctrack type", go_struct.Proctrack_type)
|
||||
fmt.Printf("%s:\t %s\n", "prolog", go_struct.Prolog)
|
||||
fmt.Printf("%s:\t %s\n", "prolog slurmctld", go_struct.Prolog_slurmctld)
|
||||
fmt.Printf("%s:\t %d\n", "propagate prio process", go_struct.Propagate_prio_process)
|
||||
fmt.Printf("%s:\t %s\n", "propagate rlimits", go_struct.Propagate_rlimits)
|
||||
fmt.Printf("%s:\t %s\n", "propagate rlimits except", go_struct.Propagate_rlimits_except)
|
||||
fmt.Printf("%s:\t %s\n", "reboot program", go_struct.Reboot_program)
|
||||
fmt.Printf("%s:\t %d\n", "reconfig flags", go_struct.Reconfig_flags)
|
||||
fmt.Printf("%s:\t %s\n", "resume program", go_struct.Resume_program)
|
||||
fmt.Printf("%s:\t %d\n", "resume rate", go_struct.Resume_rate)
|
||||
fmt.Printf("%s:\t %d\n", "resume timeout", go_struct.Resume_timeout)
|
||||
fmt.Printf("%s:\t %s\n", "resv epilog", go_struct.Resv_epilog)
|
||||
fmt.Printf("%s:\t %d\n", "resv over run", go_struct.Resv_over_run)
|
||||
fmt.Printf("%s:\t %s\n", "resv prolog", go_struct.Resv_prolog)
|
||||
fmt.Printf("%s:\t %d\n", "ret2service", go_struct.Ret2service)
|
||||
fmt.Printf("%s:\t %s\n", "salloc default command", go_struct.Salloc_default_command)
|
||||
fmt.Printf("%s:\t %s\n", "sched logfile", go_struct.Sched_logfile)
|
||||
fmt.Printf("%s:\t %d\n", "sched log level", go_struct.Sched_log_level)
|
||||
fmt.Printf("%s:\t %s\n", "sched params", go_struct.Sched_params)
|
||||
fmt.Printf("%s:\t %d\n", "sched time slice", go_struct.Sched_time_slice)
|
||||
fmt.Printf("%s:\t %s\n", "schedtype", go_struct.Schedtype)
|
||||
fmt.Printf("%s:\t %s\n", "select type", go_struct.Select_type)
|
||||
fmt.Printf("%s:\t %d\n", "select type param", go_struct.Select_type_param)
|
||||
fmt.Printf("%s:\t %s\n", "slurm conf", go_struct.Slurm_conf)
|
||||
fmt.Printf("%s:\t %d\n", "slurm user id", go_struct.Slurm_user_id)
|
||||
fmt.Printf("%s:\t %s\n", "slurm user name", go_struct.Slurm_user_name)
|
||||
fmt.Printf("%s:\t %d\n", "slurmd user id", go_struct.Slurmd_user_id)
|
||||
fmt.Printf("%s:\t %s\n", "slurmd user name", go_struct.Slurmd_user_name)
|
||||
fmt.Printf("%s:\t %d\n", "slurmctld debug", go_struct.Slurmctld_debug)
|
||||
fmt.Printf("%s:\t %s\n", "slurmctld logfile", go_struct.Slurmctld_logfile)
|
||||
fmt.Printf("%s:\t %s\n", "slurmctld pidfile", go_struct.Slurmctld_pidfile)
|
||||
fmt.Printf("%s:\t %s\n", "slurmctld plugstack", go_struct.Slurmctld_plugstack)
|
||||
fmt.Printf("%s:\t %d\n", "slurmctld port", go_struct.Slurmctld_port)
|
||||
fmt.Printf("%s:\t %d\n", "slurmctld port count", go_struct.Slurmctld_port_count)
|
||||
fmt.Printf("%s:\t %d\n", "slurmctld timeout", go_struct.Slurmctld_timeout)
|
||||
fmt.Printf("%s:\t %d\n", "slurmd debug", go_struct.Slurmd_debug)
|
||||
fmt.Printf("%s:\t %s\n", "slurmd logfile", go_struct.Slurmd_logfile)
|
||||
fmt.Printf("%s:\t %s\n", "slurmd pidfile", go_struct.Slurmd_pidfile)
|
||||
fmt.Printf("%s:\t %d\n", "slurmd port", go_struct.Slurmd_port)
|
||||
fmt.Printf("%s:\t %s\n", "slurmd spooldir", go_struct.Slurmd_spooldir)
|
||||
fmt.Printf("%s:\t %d\n", "slurmd timeout", go_struct.Slurmd_timeout)
|
||||
fmt.Printf("%s:\t %s\n", "srun epilog", go_struct.Srun_epilog)
|
||||
fmt.Printf("%s:\t %s\n", "srun prolog", go_struct.Srun_prolog)
|
||||
fmt.Printf("%s:\t %s\n", "state save location", go_struct.State_save_location)
|
||||
fmt.Printf("%s:\t %s\n", "suspend exc nodes", go_struct.Suspend_exc_nodes)
|
||||
fmt.Printf("%s:\t %s\n", "suspend exc parts", go_struct.Suspend_exc_parts)
|
||||
fmt.Printf("%s:\t %s\n", "suspend program", go_struct.Suspend_program)
|
||||
fmt.Printf("%s:\t %d\n", "suspend rate", go_struct.Suspend_rate)
|
||||
fmt.Printf("%s:\t %d\n", "suspend time", go_struct.Suspend_time)
|
||||
fmt.Printf("%s:\t %d\n", "suspend timeout", go_struct.Suspend_timeout)
|
||||
fmt.Printf("%s:\t %s\n", "switch type", go_struct.Switch_type)
|
||||
fmt.Printf("%s:\t %s\n", "task epilog", go_struct.Task_epilog)
|
||||
fmt.Printf("%s:\t %s\n", "task plugin", go_struct.Task_plugin)
|
||||
fmt.Printf("%s:\t %d\n", "task plugin param", go_struct.Task_plugin_param)
|
||||
fmt.Printf("%s:\t %s\n", "task prolog", go_struct.Task_prolog)
|
||||
fmt.Printf("%s:\t %s\n", "tmp fs", go_struct.Tmp_fs)
|
||||
fmt.Printf("%s:\t %s\n", "topology plugin", go_struct.Topology_plugin)
|
||||
fmt.Printf("%s:\t %d\n", "track wckey", go_struct.Track_wckey)
|
||||
fmt.Printf("%s:\t %d\n", "tree width", go_struct.Tree_width)
|
||||
fmt.Printf("%s:\t %s\n", "unkillable program", go_struct.Unkillable_program)
|
||||
fmt.Printf("%s:\t %d\n", "unkillable timeout", go_struct.Unkillable_timeout)
|
||||
fmt.Printf("%s:\t %d\n", "use pam", go_struct.Use_pam)
|
||||
fmt.Printf("%s:\t %s\n", "version", go_struct.Version)
|
||||
fmt.Printf("%s:\t %d\n", "vsize factor", go_struct.Vsize_factor)
|
||||
fmt.Printf("%s:\t %d\n", "wait time", go_struct.Wait_time)
|
||||
}
|
||||
|
||||
func Version() int {
|
||||
|
||||
ver := C.long(0)
|
||||
ver = C.slurm_api_version()
|
||||
|
||||
return int(ver)
|
||||
}
|
||||
func VersionString(v int) string {
|
||||
|
||||
var major, minor, micro int
|
||||
var version string
|
||||
major = ((v >> 16) & 0xff)
|
||||
minor = ((v >> 8) & 0xff)
|
||||
micro = (v & 0xff)
|
||||
version = fmt.Sprintf("%d.%d.%d", major, minor, micro)
|
||||
return version
|
||||
}
|
||||
|
||||
func GetConfig() Ctl_conf {
|
||||
|
||||
c_config := C.get_config(C.uint64_t(0))
|
||||
ret_config := Ctl_conf_convert_c_to_go(c_config)
|
||||
return ret_config
|
||||
}
|
||||
|
||||
func GetErrorString(errno uint32) string {
|
||||
msg := C.GoString(C.slurm_strerror(C.int(errno)))
|
||||
return msg
|
||||
}
|
|
@ -73,100 +73,70 @@ void free_submit_response_msg(struct submit_response_msg *msg)
|
|||
*/
|
||||
import "C"
|
||||
|
||||
import "fmt"
|
||||
import "unsafe"
|
||||
import "slurm/jobinfo"
|
||||
import (
|
||||
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
|
||||
"fmt"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type Job_descriptor struct {
|
||||
Account string
|
||||
Acctg_freq string
|
||||
Admin_comment string
|
||||
Alloc_node string
|
||||
Alloc_resp_port uint16
|
||||
Alloc_sid uint32
|
||||
Argc uint32
|
||||
Argv []string
|
||||
Array_inx string
|
||||
//array_bitmap void;
|
||||
Batch_features string
|
||||
Begin_time int64
|
||||
Bitflags uint32
|
||||
Burst_buffer string
|
||||
Ckpt_interval uint16
|
||||
Ckpt_dir string
|
||||
Clusters string
|
||||
Cluster_features string
|
||||
Comment string
|
||||
Contiguous uint16
|
||||
Core_spec uint16
|
||||
Cpu_bind string
|
||||
Cpu_bind_type uint16
|
||||
Cpu_freq_min uint32
|
||||
Cpu_freq_max uint32
|
||||
Cpu_freq_gov uint32
|
||||
Cpus_per_tres string
|
||||
Deadline int64
|
||||
Delay_boot uint32
|
||||
Dependency string
|
||||
End_time int64
|
||||
Environment []string
|
||||
Env_size uint32
|
||||
Extra string
|
||||
Exc_nodes string
|
||||
Features string
|
||||
Fed_siblings_active uint64
|
||||
Fed_siblings_viable uint64
|
||||
Group_id uint32
|
||||
Immediate uint16
|
||||
Job_id uint32
|
||||
Job_id_str string
|
||||
Kill_on_node_fail uint16
|
||||
Licenses string
|
||||
Mail_type uint16
|
||||
Mail_user string
|
||||
Mcs_label string
|
||||
Mem_bind string
|
||||
Mem_bind_type uint16
|
||||
Mem_per_tres string
|
||||
Name string
|
||||
Network string
|
||||
Nice uint32
|
||||
Num_tasks uint32
|
||||
Open_mode uint8
|
||||
Origin_cluster string
|
||||
Other_port uint16
|
||||
Overcommit uint8
|
||||
Pack_job_offset uint32
|
||||
Partition string
|
||||
Plane_size uint16
|
||||
Power_flags uint8
|
||||
Priority uint32
|
||||
Profile uint32
|
||||
Qos string
|
||||
Reboot uint16
|
||||
Resp_host string
|
||||
Restart_cnt uint16
|
||||
Req_nodes string
|
||||
Requeue uint16
|
||||
Reservation string
|
||||
Script string
|
||||
Account string
|
||||
Acctg_freq string
|
||||
Alloc_node string
|
||||
Alloc_resp_port uint16
|
||||
Alloc_sid uint32
|
||||
Argc uint32
|
||||
Argv []string
|
||||
Array_inx string
|
||||
Begin_time int64
|
||||
Ckpt_interval uint16
|
||||
Ckpt_dir string
|
||||
Comment string
|
||||
Contiguous uint16
|
||||
Cpu_bind string
|
||||
Cpu_bind_type uint16
|
||||
Dependency string
|
||||
End_time int64
|
||||
Environment []string
|
||||
Env_size uint32
|
||||
Exc_nodes string
|
||||
Features string
|
||||
Group_id uint32
|
||||
Immediate uint16
|
||||
Job_id uint32
|
||||
Kill_on_node_fail uint16
|
||||
Licenses string
|
||||
Mail_type uint16
|
||||
Mail_user string
|
||||
Mem_bind string
|
||||
Mem_bind_type uint16
|
||||
Name string
|
||||
Network string
|
||||
Nice uint32
|
||||
Num_tasks uint32
|
||||
Open_mode uint8
|
||||
Other_port uint16
|
||||
Overcommit uint8
|
||||
Partition string
|
||||
Plane_size uint16
|
||||
Priority uint32
|
||||
Profile uint32
|
||||
Qos string
|
||||
Reboot uint16
|
||||
Resp_host string
|
||||
Req_nodes string
|
||||
Requeue uint16
|
||||
Reservation string
|
||||
Script string
|
||||
//script_buf void;
|
||||
Shared uint16
|
||||
Site_factor uint32
|
||||
Shared uint16
|
||||
//spank_job_env char**;
|
||||
Spank_job_env_size uint32
|
||||
Task_dist uint32
|
||||
Time_limit uint32
|
||||
Time_min uint32
|
||||
Tres_bind string
|
||||
Tres_freq string
|
||||
Tres_per_job string
|
||||
Tres_per_node string
|
||||
Tres_per_socket string
|
||||
Tres_per_task string
|
||||
User_id uint32
|
||||
Wait_all_nodes uint16
|
||||
Warn_flags uint16
|
||||
Warn_signal uint16
|
||||
Warn_time uint16
|
||||
Work_dir string
|
||||
|
@ -194,10 +164,6 @@ type Job_descriptor struct {
|
|||
Tres_req_cnt uint64
|
||||
Wait4switch uint32
|
||||
Wckey string
|
||||
X11 uint16
|
||||
X11_magic_cookie string
|
||||
X11_target string
|
||||
X11_target_port uint16
|
||||
}
|
||||
|
||||
func Job_descriptor_convert_c_to_go(c_struct *C.struct_job_descriptor) Job_descriptor {
|
||||
|
@ -205,88 +171,57 @@ func Job_descriptor_convert_c_to_go(c_struct *C.struct_job_descriptor) Job_descr
|
|||
|
||||
go_struct.Account = C.GoString(c_struct.account)
|
||||
go_struct.Acctg_freq = C.GoString(c_struct.acctg_freq)
|
||||
go_struct.Admin_comment = C.GoString(c_struct.admin_comment)
|
||||
go_struct.Alloc_node = C.GoString(c_struct.alloc_node)
|
||||
go_struct.Alloc_resp_port = uint16(c_struct.alloc_resp_port)
|
||||
go_struct.Alloc_sid = uint32(c_struct.alloc_sid)
|
||||
go_struct.Argc = uint32(c_struct.argc)
|
||||
go_struct.Array_inx = C.GoString(c_struct.array_inx)
|
||||
go_struct.Batch_features = C.GoString(c_struct.batch_features)
|
||||
go_struct.Begin_time = int64(c_struct.begin_time)
|
||||
go_struct.Bitflags = uint32(c_struct.bitflags)
|
||||
go_struct.Burst_buffer = C.GoString(c_struct.burst_buffer)
|
||||
go_struct.Ckpt_interval = uint16(c_struct.ckpt_interval)
|
||||
go_struct.Ckpt_dir = C.GoString(c_struct.ckpt_dir)
|
||||
go_struct.Clusters = C.GoString(c_struct.clusters)
|
||||
go_struct.Cluster_features = C.GoString(c_struct.cluster_features)
|
||||
go_struct.Comment = C.GoString(c_struct.comment)
|
||||
go_struct.Contiguous = uint16(c_struct.contiguous)
|
||||
go_struct.Core_spec = uint16(c_struct.core_spec)
|
||||
go_struct.Cpu_bind = C.GoString(c_struct.cpu_bind)
|
||||
go_struct.Cpu_bind_type = uint16(c_struct.cpu_bind_type)
|
||||
go_struct.Cpu_freq_min = uint32(c_struct.cpu_freq_min)
|
||||
go_struct.Cpu_freq_max = uint32(c_struct.cpu_freq_max)
|
||||
go_struct.Cpu_freq_gov = uint32(c_struct.cpu_freq_gov)
|
||||
go_struct.Cpus_per_tres = C.GoString(c_struct.cpus_per_tres)
|
||||
go_struct.Deadline = int64(c_struct.deadline)
|
||||
go_struct.Delay_boot = uint32(c_struct.delay_boot)
|
||||
go_struct.Dependency = C.GoString(c_struct.dependency)
|
||||
go_struct.End_time = int64(c_struct.end_time)
|
||||
go_struct.Env_size = uint32(c_struct.env_size)
|
||||
go_struct.Extra = C.GoString(c_struct.extra)
|
||||
go_struct.Exc_nodes = C.GoString(c_struct.exc_nodes)
|
||||
go_struct.Features = C.GoString(c_struct.features)
|
||||
go_struct.Fed_siblings_active = uint64(c_struct.fed_siblings_active)
|
||||
go_struct.Fed_siblings_viable = uint64(c_struct.fed_siblings_viable)
|
||||
go_struct.Group_id = uint32(c_struct.group_id)
|
||||
go_struct.Immediate = uint16(c_struct.immediate)
|
||||
go_struct.Job_id = uint32(c_struct.job_id)
|
||||
go_struct.Job_id_str = C.GoString(c_struct.job_id_str)
|
||||
go_struct.Kill_on_node_fail = uint16(c_struct.kill_on_node_fail)
|
||||
go_struct.Licenses = C.GoString(c_struct.licenses)
|
||||
go_struct.Mail_type = uint16(c_struct.mail_type)
|
||||
go_struct.Mail_user = C.GoString(c_struct.mail_user)
|
||||
go_struct.Mcs_label = C.GoString(c_struct.mcs_label)
|
||||
go_struct.Mem_bind = C.GoString(c_struct.mem_bind)
|
||||
go_struct.Mem_bind_type = uint16(c_struct.mem_bind_type)
|
||||
go_struct.Mem_per_tres = C.GoString(c_struct.mem_per_tres)
|
||||
go_struct.Name = C.GoString(c_struct.name)
|
||||
go_struct.Network = C.GoString(c_struct.network)
|
||||
go_struct.Nice = uint32(c_struct.nice)
|
||||
go_struct.Num_tasks = uint32(c_struct.num_tasks)
|
||||
go_struct.Open_mode = uint8(c_struct.open_mode)
|
||||
go_struct.Origin_cluster = C.GoString(c_struct.origin_cluster)
|
||||
go_struct.Other_port = uint16(c_struct.other_port)
|
||||
go_struct.Overcommit = uint8(c_struct.overcommit)
|
||||
go_struct.Pack_job_offset = uint32(c_struct.pack_job_offset)
|
||||
go_struct.Partition = C.GoString(c_struct.partition)
|
||||
go_struct.Plane_size = uint16(c_struct.plane_size)
|
||||
go_struct.Power_flags = uint8(c_struct.power_flags)
|
||||
go_struct.Priority = uint32(c_struct.priority)
|
||||
go_struct.Profile = uint32(c_struct.profile)
|
||||
go_struct.Qos = C.GoString(c_struct.qos)
|
||||
go_struct.Reboot = uint16(c_struct.reboot)
|
||||
go_struct.Resp_host = C.GoString(c_struct.resp_host)
|
||||
go_struct.Restart_cnt = uint16(c_struct.restart_cnt)
|
||||
go_struct.Req_nodes = C.GoString(c_struct.req_nodes)
|
||||
go_struct.Requeue = uint16(c_struct.requeue)
|
||||
go_struct.Reservation = C.GoString(c_struct.reservation)
|
||||
go_struct.Script = C.GoString(c_struct.script)
|
||||
go_struct.Shared = uint16(c_struct.shared)
|
||||
go_struct.Site_factor = uint32(c_struct.site_factor)
|
||||
go_struct.Spank_job_env_size = uint32(c_struct.spank_job_env_size)
|
||||
go_struct.Task_dist = uint32(c_struct.task_dist)
|
||||
go_struct.Time_limit = uint32(c_struct.time_limit)
|
||||
go_struct.Time_min = uint32(c_struct.time_min)
|
||||
go_struct.Tres_bind = C.GoString(c_struct.tres_bind)
|
||||
go_struct.Tres_freq = C.GoString(c_struct.tres_freq)
|
||||
go_struct.Tres_per_job = C.GoString(c_struct.tres_per_job)
|
||||
go_struct.Tres_per_node = C.GoString(c_struct.tres_per_node)
|
||||
go_struct.Tres_per_socket = C.GoString(c_struct.tres_per_socket)
|
||||
go_struct.Tres_per_task = C.GoString(c_struct.tres_per_task)
|
||||
go_struct.User_id = uint32(c_struct.user_id)
|
||||
go_struct.Wait_all_nodes = uint16(c_struct.wait_all_nodes)
|
||||
go_struct.Warn_flags = uint16(c_struct.warn_flags)
|
||||
go_struct.Warn_signal = uint16(c_struct.warn_signal)
|
||||
go_struct.Warn_time = uint16(c_struct.warn_time)
|
||||
go_struct.Work_dir = C.GoString(c_struct.work_dir)
|
||||
|
@ -313,97 +248,62 @@ func Job_descriptor_convert_c_to_go(c_struct *C.struct_job_descriptor) Job_descr
|
|||
go_struct.Std_out = C.GoString(c_struct.std_out)
|
||||
go_struct.Wait4switch = uint32(c_struct.wait4switch)
|
||||
go_struct.Wckey = C.GoString(c_struct.wckey)
|
||||
go_struct.X11 = uint16(c_struct.x11)
|
||||
go_struct.X11_magic_cookie = C.GoString(c_struct.x11_magic_cookie)
|
||||
go_struct.X11_target = C.GoString(c_struct.x11_target)
|
||||
go_struct.X11_target_port = uint16(c_struct.x11_target_port)
|
||||
return go_struct
|
||||
}
|
||||
func Print_Job_descriptor(go_struct Job_descriptor) {
|
||||
fmt.Printf("%s:\t %s\n", "account", go_struct.Account)
|
||||
fmt.Printf("%s:\t %s\n", "acctg freq", go_struct.Acctg_freq)
|
||||
fmt.Printf("%s:\t %s\n", "admin comment", go_struct.Admin_comment)
|
||||
fmt.Printf("%s:\t %s\n", "alloc node", go_struct.Alloc_node)
|
||||
fmt.Printf("%s:\t %d\n", "alloc resp port", go_struct.Alloc_resp_port)
|
||||
fmt.Printf("%s:\t %d\n", "alloc sid", go_struct.Alloc_sid)
|
||||
fmt.Printf("%s:\t %d\n", "argc", go_struct.Argc)
|
||||
fmt.Printf("%s:\t %s\n", "array inx", go_struct.Array_inx)
|
||||
fmt.Printf("%s:\t %s\n", "batch features", go_struct.Batch_features)
|
||||
fmt.Printf("%s:\t %d\n", "begin time", go_struct.Begin_time)
|
||||
fmt.Printf("%s:\t %d\n", "bitflags", go_struct.Bitflags)
|
||||
fmt.Printf("%s:\t %s\n", "burst buffer", go_struct.Burst_buffer)
|
||||
fmt.Printf("%s:\t %d\n", "ckpt interval", go_struct.Ckpt_interval)
|
||||
fmt.Printf("%s:\t %s\n", "ckpt dir", go_struct.Ckpt_dir)
|
||||
fmt.Printf("%s:\t %s\n", "clusters", go_struct.Clusters)
|
||||
fmt.Printf("%s:\t %s\n", "cluster features", go_struct.Cluster_features)
|
||||
fmt.Printf("%s:\t %s\n", "comment", go_struct.Comment)
|
||||
fmt.Printf("%s:\t %d\n", "contiguous", go_struct.Contiguous)
|
||||
fmt.Printf("%s:\t %d\n", "core spec", go_struct.Core_spec)
|
||||
fmt.Printf("%s:\t %s\n", "cpu bind", go_struct.Cpu_bind)
|
||||
fmt.Printf("%s:\t %d\n", "cpu bind type", go_struct.Cpu_bind_type)
|
||||
fmt.Printf("%s:\t %d\n", "cpu freq min", go_struct.Cpu_freq_min)
|
||||
fmt.Printf("%s:\t %d\n", "cpu freq max", go_struct.Cpu_freq_max)
|
||||
fmt.Printf("%s:\t %d\n", "cpu freq gov", go_struct.Cpu_freq_gov)
|
||||
fmt.Printf("%s:\t %s\n", "cpus per tres", go_struct.Cpus_per_tres)
|
||||
fmt.Printf("%s:\t %d\n", "deadline", go_struct.Deadline)
|
||||
fmt.Printf("%s:\t %d\n", "delay boot", go_struct.Delay_boot)
|
||||
fmt.Printf("%s:\t %s\n", "dependency", go_struct.Dependency)
|
||||
fmt.Printf("%s:\t %d\n", "end time", go_struct.End_time)
|
||||
fmt.Printf("%s:\t %d\n", "env size", go_struct.Env_size)
|
||||
fmt.Printf("%s:\t %s\n", "extra", go_struct.Extra)
|
||||
fmt.Printf("%s:\t %s\n", "exc nodes", go_struct.Exc_nodes)
|
||||
fmt.Printf("%s:\t %s\n", "features", go_struct.Features)
|
||||
fmt.Printf("%s:\t %d\n", "fed siblings active", go_struct.Fed_siblings_active)
|
||||
fmt.Printf("%s:\t %d\n", "fed siblings viable", go_struct.Fed_siblings_viable)
|
||||
fmt.Printf("%s:\t %d\n", "group id", go_struct.Group_id)
|
||||
fmt.Printf("%s:\t %d\n", "immediate", go_struct.Immediate)
|
||||
fmt.Printf("%s:\t %d\n", "job id", go_struct.Job_id)
|
||||
fmt.Printf("%s:\t %s\n", "job id str", go_struct.Job_id_str)
|
||||
fmt.Printf("%s:\t %d\n", "kill on node fail", go_struct.Kill_on_node_fail)
|
||||
fmt.Printf("%s:\t %s\n", "licenses", go_struct.Licenses)
|
||||
fmt.Printf("%s:\t %d\n", "mail type", go_struct.Mail_type)
|
||||
fmt.Printf("%s:\t %s\n", "mail user", go_struct.Mail_user)
|
||||
fmt.Printf("%s:\t %s\n", "mcs label", go_struct.Mcs_label)
|
||||
fmt.Printf("%s:\t %s\n", "mem bind", go_struct.Mem_bind)
|
||||
fmt.Printf("%s:\t %d\n", "mem bind type", go_struct.Mem_bind_type)
|
||||
fmt.Printf("%s:\t %s\n", "mem per tres", go_struct.Mem_per_tres)
|
||||
fmt.Printf("%s:\t %s\n", "name", go_struct.Name)
|
||||
fmt.Printf("%s:\t %s\n", "network", go_struct.Network)
|
||||
fmt.Printf("%s:\t %d\n", "nice", go_struct.Nice)
|
||||
fmt.Printf("%s:\t %d\n", "num tasks", go_struct.Num_tasks)
|
||||
fmt.Printf("%s:\t %d\n", "open mode", go_struct.Open_mode)
|
||||
fmt.Printf("%s:\t %s\n", "origin cluster", go_struct.Origin_cluster)
|
||||
fmt.Printf("%s:\t %d\n", "other port", go_struct.Other_port)
|
||||
fmt.Printf("%s:\t %d\n", "overcommit", go_struct.Overcommit)
|
||||
fmt.Printf("%s:\t %d\n", "pack job offset", go_struct.Pack_job_offset)
|
||||
fmt.Printf("%s:\t %s\n", "partition", go_struct.Partition)
|
||||
fmt.Printf("%s:\t %d\n", "plane size", go_struct.Plane_size)
|
||||
fmt.Printf("%s:\t %d\n", "power flags", go_struct.Power_flags)
|
||||
fmt.Printf("%s:\t %d\n", "priority", go_struct.Priority)
|
||||
fmt.Printf("%s:\t %d\n", "profile", go_struct.Profile)
|
||||
fmt.Printf("%s:\t %s\n", "qos", go_struct.Qos)
|
||||
fmt.Printf("%s:\t %d\n", "reboot", go_struct.Reboot)
|
||||
fmt.Printf("%s:\t %s\n", "resp host", go_struct.Resp_host)
|
||||
fmt.Printf("%s:\t %d\n", "restart cnt", go_struct.Restart_cnt)
|
||||
fmt.Printf("%s:\t %s\n", "req nodes", go_struct.Req_nodes)
|
||||
fmt.Printf("%s:\t %d\n", "requeue", go_struct.Requeue)
|
||||
fmt.Printf("%s:\t %s\n", "reservation", go_struct.Reservation)
|
||||
fmt.Printf("%s:\t %s\n", "script", go_struct.Script)
|
||||
fmt.Printf("%s:\t %d\n", "shared", go_struct.Shared)
|
||||
fmt.Printf("%s:\t %d\n", "site factor", go_struct.Site_factor)
|
||||
fmt.Printf("%s:\t %d\n", "spank job env size", go_struct.Spank_job_env_size)
|
||||
fmt.Printf("%s:\t %d\n", "task dist", go_struct.Task_dist)
|
||||
fmt.Printf("%s:\t %d\n", "time limit", go_struct.Time_limit)
|
||||
fmt.Printf("%s:\t %d\n", "time min", go_struct.Time_min)
|
||||
fmt.Printf("%s:\t %s\n", "tres bind", go_struct.Tres_bind)
|
||||
fmt.Printf("%s:\t %s\n", "tres freq", go_struct.Tres_freq)
|
||||
fmt.Printf("%s:\t %s\n", "tres per job", go_struct.Tres_per_job)
|
||||
fmt.Printf("%s:\t %s\n", "tres per node", go_struct.Tres_per_node)
|
||||
fmt.Printf("%s:\t %s\n", "tres per socket", go_struct.Tres_per_socket)
|
||||
fmt.Printf("%s:\t %s\n", "tres per task", go_struct.Tres_per_task)
|
||||
fmt.Printf("%s:\t %d\n", "user id", go_struct.User_id)
|
||||
fmt.Printf("%s:\t %d\n", "wait all nodes", go_struct.Wait_all_nodes)
|
||||
fmt.Printf("%s:\t %d\n", "warn flags", go_struct.Warn_flags)
|
||||
fmt.Printf("%s:\t %d\n", "warn signal", go_struct.Warn_signal)
|
||||
fmt.Printf("%s:\t %d\n", "warn time", go_struct.Warn_time)
|
||||
fmt.Printf("%s:\t %s\n", "work dir", go_struct.Work_dir)
|
||||
|
@ -431,10 +331,6 @@ func Print_Job_descriptor(go_struct Job_descriptor) {
|
|||
fmt.Printf("%s:\t %d\n", "tres req cnt", go_struct.Tres_req_cnt)
|
||||
fmt.Printf("%s:\t %d\n", "wait4switch", go_struct.Wait4switch)
|
||||
fmt.Printf("%s:\t %s\n", "wckey", go_struct.Wckey)
|
||||
fmt.Printf("%s:\t %d\n", "x11", go_struct.X11)
|
||||
fmt.Printf("%s:\t %s\n", "x11 magic cookie", go_struct.X11_magic_cookie)
|
||||
fmt.Printf("%s:\t %s\n", "x11 target", go_struct.X11_target)
|
||||
fmt.Printf("%s:\t %d\n", "x11 target port", go_struct.X11_target_port)
|
||||
}
|
||||
|
||||
type Update_job_options struct {
|
||||
|
@ -449,10 +345,9 @@ type Update_job_options struct {
|
|||
}
|
||||
|
||||
type Submit_response_msg struct {
|
||||
Job_id uint32
|
||||
Step_id uint32
|
||||
Error_code uint32
|
||||
Job_submit_user_msg string
|
||||
Job_id uint32
|
||||
Step_id uint32
|
||||
Error_code uint32
|
||||
}
|
||||
|
||||
func submit_response_msg_convert_c_to_go(c_struct *C.struct_submit_response_msg) Submit_response_msg {
|
||||
|
@ -461,14 +356,12 @@ func submit_response_msg_convert_c_to_go(c_struct *C.struct_submit_response_msg)
|
|||
go_struct.Job_id = uint32(c_struct.job_id)
|
||||
go_struct.Step_id = uint32(c_struct.step_id)
|
||||
go_struct.Error_code = uint32(c_struct.error_code)
|
||||
go_struct.Job_submit_user_msg = C.GoString(c_struct.job_submit_user_msg)
|
||||
return go_struct
|
||||
}
|
||||
func Print_submit_response_msg(go_struct Submit_response_msg) {
|
||||
fmt.Printf("%s:\t %d\n", "job id", go_struct.Job_id)
|
||||
fmt.Printf("%s:\t %d\n", "step id", go_struct.Step_id)
|
||||
fmt.Printf("%s:\t %d\n", "error code", go_struct.Error_code)
|
||||
fmt.Printf("%s:\t %s\n", "job submit user msg", go_struct.Job_submit_user_msg)
|
||||
}
|
||||
|
||||
/*This is an ugly function, since we start to convert everyting back*/
|
||||
|
@ -488,11 +381,7 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
defer C.free(unsafe.Pointer(acctg_freq_s))
|
||||
c_struct.acctg_freq = acctg_freq_s
|
||||
}
|
||||
if go_struct.Admin_comment != "" {
|
||||
admin_comment_s := C.CString(go_struct.Admin_comment)
|
||||
defer C.free(unsafe.Pointer(admin_comment_s))
|
||||
c_struct.admin_comment = admin_comment_s
|
||||
}
|
||||
|
||||
if go_struct.Alloc_node != "" {
|
||||
alloc_node_s := C.CString(go_struct.Alloc_node)
|
||||
defer C.free(unsafe.Pointer(alloc_node_s))
|
||||
|
@ -520,22 +409,9 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
defer C.free(unsafe.Pointer(array_inx_s))
|
||||
c_struct.array_inx = array_inx_s
|
||||
}
|
||||
if go_struct.Batch_features != "" {
|
||||
batch_features_s := C.CString(go_struct.Batch_features)
|
||||
defer C.free(unsafe.Pointer(batch_features_s))
|
||||
c_struct.batch_features = batch_features_s
|
||||
}
|
||||
if go_struct.Begin_time != 0 {
|
||||
c_struct.begin_time = C.int64_t(go_struct.Begin_time)
|
||||
}
|
||||
if go_struct.Bitflags != 0 {
|
||||
c_struct.bitflags = C.uint32_t(go_struct.Bitflags)
|
||||
}
|
||||
if go_struct.Burst_buffer != "" {
|
||||
burst_buffer_s := C.CString(go_struct.Burst_buffer)
|
||||
defer C.free(unsafe.Pointer(burst_buffer_s))
|
||||
c_struct.burst_buffer = burst_buffer_s
|
||||
}
|
||||
if go_struct.Ckpt_interval != 0 {
|
||||
c_struct.ckpt_interval = C.uint16_t(go_struct.Ckpt_interval)
|
||||
}
|
||||
|
@ -544,16 +420,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
defer C.free(unsafe.Pointer(ckpt_dir_s))
|
||||
c_struct.ckpt_dir = ckpt_dir_s
|
||||
}
|
||||
if go_struct.Clusters != "" {
|
||||
clusters_s := C.CString(go_struct.Clusters)
|
||||
defer C.free(unsafe.Pointer(clusters_s))
|
||||
c_struct.clusters = clusters_s
|
||||
}
|
||||
if go_struct.Cluster_features != "" {
|
||||
cluster_features_s := C.CString(go_struct.Cluster_features)
|
||||
defer C.free(unsafe.Pointer(cluster_features_s))
|
||||
c_struct.cluster_features = cluster_features_s
|
||||
}
|
||||
if go_struct.Comment != "" {
|
||||
comment_s := C.CString(go_struct.Comment)
|
||||
defer C.free(unsafe.Pointer(comment_s))
|
||||
|
@ -562,9 +428,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
if go_struct.Contiguous != 0 {
|
||||
c_struct.contiguous = C.uint16_t(go_struct.Contiguous)
|
||||
}
|
||||
if go_struct.Core_spec != 0 {
|
||||
c_struct.core_spec = C.uint16_t(go_struct.Core_spec)
|
||||
}
|
||||
if go_struct.Cpu_bind != "" {
|
||||
cpu_bind_s := C.CString(go_struct.Cpu_bind)
|
||||
defer C.free(unsafe.Pointer(cpu_bind_s))
|
||||
|
@ -573,26 +436,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
if go_struct.Cpu_bind_type != 0 {
|
||||
c_struct.cpu_bind_type = C.uint16_t(go_struct.Cpu_bind_type)
|
||||
}
|
||||
if go_struct.Cpu_freq_min != 0 {
|
||||
c_struct.cpu_freq_min = C.uint32_t(go_struct.Cpu_freq_min)
|
||||
}
|
||||
if go_struct.Cpu_freq_max != 0 {
|
||||
c_struct.cpu_freq_max = C.uint32_t(go_struct.Cpu_freq_max)
|
||||
}
|
||||
if go_struct.Cpu_freq_gov != 0 {
|
||||
c_struct.cpu_freq_gov = C.uint32_t(go_struct.Cpu_freq_gov)
|
||||
}
|
||||
if go_struct.Cpus_per_tres != "" {
|
||||
cpus_per_tres_s := C.CString(go_struct.Cpus_per_tres)
|
||||
defer C.free(unsafe.Pointer(cpus_per_tres_s))
|
||||
c_struct.cpus_per_tres = cpus_per_tres_s
|
||||
}
|
||||
if go_struct.Deadline != 0 {
|
||||
c_struct.deadline = C.int64_t(go_struct.Deadline)
|
||||
}
|
||||
if go_struct.Delay_boot != 0 {
|
||||
c_struct.delay_boot = C.uint32_t(go_struct.Delay_boot)
|
||||
}
|
||||
if go_struct.Dependency != "" {
|
||||
dependency_s := C.CString(go_struct.Dependency)
|
||||
defer C.free(unsafe.Pointer(dependency_s))
|
||||
|
@ -619,11 +462,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
c_struct.environment = (**C.char)(cArray)
|
||||
|
||||
}
|
||||
if go_struct.Extra != "" {
|
||||
extra_s := C.CString(go_struct.Extra)
|
||||
defer C.free(unsafe.Pointer(extra_s))
|
||||
c_struct.extra = extra_s
|
||||
}
|
||||
if go_struct.Exc_nodes != "" {
|
||||
exc_nodes_s := C.CString(go_struct.Exc_nodes)
|
||||
defer C.free(unsafe.Pointer(exc_nodes_s))
|
||||
|
@ -634,12 +472,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
defer C.free(unsafe.Pointer(features_s))
|
||||
c_struct.features = features_s
|
||||
}
|
||||
if go_struct.Fed_siblings_active != 0 {
|
||||
c_struct.fed_siblings_active = C.uint64_t(go_struct.Fed_siblings_active)
|
||||
}
|
||||
if go_struct.Fed_siblings_viable != 0 {
|
||||
c_struct.fed_siblings_viable = C.uint64_t(go_struct.Fed_siblings_viable)
|
||||
}
|
||||
if go_struct.Group_id != 0 {
|
||||
c_struct.group_id = C.uint32_t(go_struct.Group_id)
|
||||
}
|
||||
|
@ -649,11 +481,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
if go_struct.Job_id != 0 {
|
||||
c_struct.job_id = C.uint32_t(go_struct.Job_id)
|
||||
}
|
||||
if go_struct.Job_id_str != "" {
|
||||
job_id_str_s := C.CString(go_struct.Job_id_str)
|
||||
defer C.free(unsafe.Pointer(job_id_str_s))
|
||||
c_struct.job_id_str = job_id_str_s
|
||||
}
|
||||
if go_struct.Kill_on_node_fail != 0 {
|
||||
c_struct.kill_on_node_fail = C.uint16_t(go_struct.Kill_on_node_fail)
|
||||
}
|
||||
|
@ -670,11 +497,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
defer C.free(unsafe.Pointer(mail_user_s))
|
||||
c_struct.mail_user = mail_user_s
|
||||
}
|
||||
if go_struct.Mcs_label != "" {
|
||||
mcs_label_s := C.CString(go_struct.Mcs_label)
|
||||
defer C.free(unsafe.Pointer(mcs_label_s))
|
||||
c_struct.mcs_label = mcs_label_s
|
||||
}
|
||||
if go_struct.Mem_bind != "" {
|
||||
mem_bind_s := C.CString(go_struct.Mem_bind)
|
||||
defer C.free(unsafe.Pointer(mem_bind_s))
|
||||
|
@ -683,11 +505,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
if go_struct.Mem_bind_type != 0 {
|
||||
c_struct.mem_bind_type = C.uint16_t(go_struct.Mem_bind_type)
|
||||
}
|
||||
if go_struct.Mem_per_tres != "" {
|
||||
mem_per_tres_s := C.CString(go_struct.Mem_per_tres)
|
||||
defer C.free(unsafe.Pointer(mem_per_tres_s))
|
||||
c_struct.mem_per_tres = mem_per_tres_s
|
||||
}
|
||||
if go_struct.Name != "" {
|
||||
name_s := C.CString(go_struct.Name)
|
||||
defer C.free(unsafe.Pointer(name_s))
|
||||
|
@ -698,29 +515,21 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
defer C.free(unsafe.Pointer(network_s))
|
||||
c_struct.network = network_s
|
||||
}
|
||||
if go_struct.Nice != 0 {
|
||||
c_struct.nice = C.uint32_t(go_struct.Nice)
|
||||
}
|
||||
//if go_struct.Nice != 0 {
|
||||
// c_struct.nice = C.uint32_t(go_struct.Nice)
|
||||
//}
|
||||
if go_struct.Num_tasks != 0 {
|
||||
c_struct.num_tasks = C.uint32_t(go_struct.Num_tasks)
|
||||
}
|
||||
if go_struct.Open_mode != 0 {
|
||||
c_struct.open_mode = C.uint8_t(go_struct.Open_mode)
|
||||
}
|
||||
if go_struct.Origin_cluster != "" {
|
||||
origin_cluster_s := C.CString(go_struct.Origin_cluster)
|
||||
defer C.free(unsafe.Pointer(origin_cluster_s))
|
||||
c_struct.origin_cluster = origin_cluster_s
|
||||
}
|
||||
if go_struct.Other_port != 0 {
|
||||
c_struct.other_port = C.uint16_t(go_struct.Other_port)
|
||||
}
|
||||
if go_struct.Overcommit != 0 {
|
||||
c_struct.overcommit = C.uint8_t(go_struct.Overcommit)
|
||||
}
|
||||
if go_struct.Pack_job_offset != 0 {
|
||||
c_struct.pack_job_offset = C.uint32_t(go_struct.Pack_job_offset)
|
||||
}
|
||||
if go_struct.Partition != "" {
|
||||
partition_s := C.CString(go_struct.Partition)
|
||||
defer C.free(unsafe.Pointer(partition_s))
|
||||
|
@ -729,9 +538,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
if go_struct.Plane_size != 0 {
|
||||
c_struct.plane_size = C.uint16_t(go_struct.Plane_size)
|
||||
}
|
||||
if go_struct.Power_flags != 0 {
|
||||
c_struct.power_flags = C.uint8_t(go_struct.Power_flags)
|
||||
}
|
||||
if go_struct.Priority != 0 {
|
||||
c_struct.priority = C.uint32_t(go_struct.Priority)
|
||||
}
|
||||
|
@ -751,9 +557,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
defer C.free(unsafe.Pointer(resp_host_s))
|
||||
c_struct.resp_host = resp_host_s
|
||||
}
|
||||
if go_struct.Restart_cnt != 0 {
|
||||
c_struct.restart_cnt = C.uint16_t(go_struct.Restart_cnt)
|
||||
}
|
||||
if go_struct.Req_nodes != "" {
|
||||
req_nodes_s := C.CString(go_struct.Req_nodes)
|
||||
defer C.free(unsafe.Pointer(req_nodes_s))
|
||||
|
@ -775,60 +578,24 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
if go_struct.Shared != 0 {
|
||||
c_struct.shared = C.uint16_t(go_struct.Shared)
|
||||
}
|
||||
if go_struct.Site_factor != 0 {
|
||||
c_struct.site_factor = C.uint32_t(go_struct.Site_factor)
|
||||
}
|
||||
if go_struct.Spank_job_env_size != 0 {
|
||||
c_struct.spank_job_env_size = C.uint32_t(go_struct.Spank_job_env_size)
|
||||
}
|
||||
if go_struct.Task_dist != 0 {
|
||||
c_struct.task_dist = C.uint32_t(go_struct.Task_dist)
|
||||
}
|
||||
//if go_struct.Task_dist != 0 {
|
||||
// c_struct.task_dist = C.uint32_t(go_struct.Task_dist)
|
||||
//}
|
||||
if go_struct.Time_limit != 0 {
|
||||
c_struct.time_limit = C.uint32_t(go_struct.Time_limit)
|
||||
}
|
||||
if go_struct.Time_min != 0 {
|
||||
c_struct.time_min = C.uint32_t(go_struct.Time_min)
|
||||
}
|
||||
if go_struct.Tres_bind != "" {
|
||||
tres_bind_s := C.CString(go_struct.Tres_bind)
|
||||
defer C.free(unsafe.Pointer(tres_bind_s))
|
||||
c_struct.tres_bind = tres_bind_s
|
||||
}
|
||||
if go_struct.Tres_freq != "" {
|
||||
tres_freq_s := C.CString(go_struct.Tres_freq)
|
||||
defer C.free(unsafe.Pointer(tres_freq_s))
|
||||
c_struct.tres_freq = tres_freq_s
|
||||
}
|
||||
if go_struct.Tres_per_job != "" {
|
||||
tres_per_job_s := C.CString(go_struct.Tres_per_job)
|
||||
defer C.free(unsafe.Pointer(tres_per_job_s))
|
||||
c_struct.tres_per_job = tres_per_job_s
|
||||
}
|
||||
if go_struct.Tres_per_node != "" {
|
||||
tres_per_node_s := C.CString(go_struct.Tres_per_node)
|
||||
defer C.free(unsafe.Pointer(tres_per_node_s))
|
||||
c_struct.tres_per_node = tres_per_node_s
|
||||
}
|
||||
if go_struct.Tres_per_socket != "" {
|
||||
tres_per_socket_s := C.CString(go_struct.Tres_per_socket)
|
||||
defer C.free(unsafe.Pointer(tres_per_socket_s))
|
||||
c_struct.tres_per_socket = tres_per_socket_s
|
||||
}
|
||||
if go_struct.Tres_per_task != "" {
|
||||
tres_per_task_s := C.CString(go_struct.Tres_per_task)
|
||||
defer C.free(unsafe.Pointer(tres_per_task_s))
|
||||
c_struct.tres_per_task = tres_per_task_s
|
||||
}
|
||||
if go_struct.User_id != 0 {
|
||||
c_struct.user_id = C.uint32_t(go_struct.User_id)
|
||||
}
|
||||
if go_struct.Wait_all_nodes != 0 {
|
||||
c_struct.wait_all_nodes = C.uint16_t(go_struct.Wait_all_nodes)
|
||||
}
|
||||
if go_struct.Warn_flags != 0 {
|
||||
c_struct.warn_flags = C.uint16_t(go_struct.Warn_flags)
|
||||
}
|
||||
if go_struct.Warn_signal != 0 {
|
||||
c_struct.warn_signal = C.uint16_t(go_struct.Warn_signal)
|
||||
}
|
||||
|
@ -885,9 +652,7 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
if go_struct.Pn_min_cpus != 0 {
|
||||
c_struct.pn_min_cpus = C.uint16_t(go_struct.Pn_min_cpus)
|
||||
}
|
||||
if go_struct.Pn_min_memory != 0 {
|
||||
c_struct.pn_min_memory = C.uint64_t(go_struct.Pn_min_memory)
|
||||
}
|
||||
|
||||
if go_struct.Pn_min_tmp_disk != 0 {
|
||||
c_struct.pn_min_tmp_disk = C.uint32_t(go_struct.Pn_min_tmp_disk)
|
||||
}
|
||||
|
@ -918,23 +683,6 @@ func Submit_job(go_struct *Job_descriptor) Submit_response_msg {
|
|||
defer C.free(unsafe.Pointer(wckey_s))
|
||||
c_struct.wckey = wckey_s
|
||||
}
|
||||
if go_struct.X11 != 0 {
|
||||
c_struct.x11 = C.uint16_t(go_struct.X11)
|
||||
}
|
||||
if go_struct.X11_magic_cookie != "" {
|
||||
x11_magic_cookie_s := C.CString(go_struct.X11_magic_cookie)
|
||||
defer C.free(unsafe.Pointer(x11_magic_cookie_s))
|
||||
c_struct.x11_magic_cookie = x11_magic_cookie_s
|
||||
}
|
||||
if go_struct.X11_target != "" {
|
||||
x11_target_s := C.CString(go_struct.X11_target)
|
||||
defer C.free(unsafe.Pointer(x11_target_s))
|
||||
c_struct.x11_target = x11_target_s
|
||||
}
|
||||
if go_struct.X11_target_port != 0 {
|
||||
c_struct.x11_target_port = C.uint16_t(go_struct.X11_target_port)
|
||||
}
|
||||
|
||||
c_msg := C.submit_job(&c_struct)
|
||||
|
||||
defer C.free_submit_response_msg(c_msg)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,3 @@
|
|||
package rest
|
||||
|
||||
//TODO
|
Loading…
Reference in New Issue