config & code restructure
This commit is contained in:
parent
575310a61c
commit
9b0204ccd4
|
@ -1,7 +1,9 @@
|
|||
package main
|
||||
|
||||
import "slurm/extra"
|
||||
import "fmt"
|
||||
import (
|
||||
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/extra"
|
||||
"fmt"
|
||||
)
|
||||
import "os"
|
||||
import "strconv"
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
package main
|
||||
|
||||
import "slurm/extra"
|
||||
import "fmt"
|
||||
import (
|
||||
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/extra"
|
||||
"fmt"
|
||||
)
|
||||
import "os"
|
||||
import "strconv"
|
||||
|
|
@ -4,12 +4,13 @@
|
|||
package extra
|
||||
|
||||
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"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"slurm"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
|
@ -1,83 +0,0 @@
|
|||
package submit_job
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lslurm
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include<slurm/slurm.h>
|
||||
#include<slurm/slurm_errno.h>
|
||||
int submit() {
|
||||
int error_code, i, count;
|
||||
job_desc_msg_t job_mesg;
|
||||
submit_response_msg_t *resp_msg;
|
||||
char *env[2];
|
||||
|
||||
slurm_init_job_desc_msg( &job_mesg );
|
||||
job_mesg. contiguous = 1;
|
||||
job_mesg. name = ("job01");
|
||||
job_mesg. min_cpus = 1;
|
||||
job_mesg. pn_min_memory = 100;
|
||||
job_mesg. pn_min_tmp_disk = 200;
|
||||
job_mesg. priority = 100;
|
||||
job_mesg. shared = 0;
|
||||
job_mesg. time_limit = 100;
|
||||
job_mesg. min_nodes = 1;
|
||||
job_mesg. user_id = getuid();
|
||||
job_mesg. script = "#!/bin/csh\n/bin/hostname\n";
|
||||
job_mesg. std_err = "/tmp/slurm.stderr";
|
||||
job_mesg. std_in = "/tmp/slurm.stdin";
|
||||
job_mesg. std_out = "/tmp/slurm.stdout";
|
||||
job_mesg. work_dir = "/tmp\0";
|
||||
job_mesg. env_size = 2;
|
||||
env[0] = "SLURM_ENV_0=looking_good";
|
||||
env[1] = "SLURM_ENV_1=still_good";
|
||||
job_mesg. environment = env;
|
||||
|
||||
error_code = slurm_submit_batch_job( &job_mesg, &resp_msg );
|
||||
if (error_code) {
|
||||
slurm_perror ("slurm_submit_batch_job");
|
||||
return (error_code);
|
||||
}
|
||||
else {
|
||||
printf ("job %u submitted\n", resp_msg->job_id);
|
||||
slurm_free_submit_response_response_msg ( resp_msg );
|
||||
}
|
||||
|
||||
//if (argc > 1)
|
||||
// count = atoi (argv[1]);
|
||||
//else
|
||||
// count = 1;
|
||||
//
|
||||
//for (i=1; i<count; i++) {
|
||||
// slurm_init_job_desc_msg( &job_mesg );
|
||||
// job_mesg. contiguous = 1;
|
||||
// job_mesg. name = ("job02+");
|
||||
// job_mesg. min_cpus = 1;
|
||||
// job_mesg. pn_min_memory = 100 + i;
|
||||
// job_mesg. pn_min_tmp_disk = 200 + i;
|
||||
// job_mesg. priority = 100 + i;
|
||||
// job_mesg. script = "/bin/hostname\n";
|
||||
// job_mesg. shared = 0;
|
||||
// job_mesg. time_limit = 100 + i;
|
||||
// job_mesg. min_nodes = i;
|
||||
// job_mesg. user_id = getuid();
|
||||
// error_code = slurm_submit_batch_job( &job_mesg, &resp_msg );
|
||||
// if (error_code) {
|
||||
// slurm_perror ("slurm_submit_batch_job");
|
||||
// break;
|
||||
// }
|
||||
// else {
|
||||
// printf ("job %u submitted\n", resp_msg->job_id);
|
||||
// slurm_free_submit_response_response_msg ( resp_msg );
|
||||
// }
|
||||
//}
|
||||
exit (error_code);
|
||||
}
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func TestSubmit() {
|
||||
C.submit()
|
||||
}
|
Loading…
Reference in New Issue