332
423
return plugin_dir;
426
/* slurm_get_priority_decay_hl
427
* returns the priority decay half life in seconds from slurmctld_conf object
428
* RET uint32_t - decay_hl in secs.
430
uint32_t slurm_get_priority_decay_hl(void)
432
uint32_t priority_hl = NO_VAL;
433
slurm_ctl_conf_t *conf;
437
conf = slurm_conf_lock();
438
priority_hl = conf->priority_decay_hl;
445
/* slurm_get_priority_favor_small
446
* returns weither or not we are favoring small jobs from slurmctld_conf object
447
* RET bool - true if favor small, false else.
449
bool slurm_get_priority_favor_small(void)
452
slurm_ctl_conf_t *conf;
456
conf = slurm_conf_lock();
457
factor = conf->priority_favor_small;
465
/* slurm_get_priority_max_age
466
* returns the priority age max in seconds from slurmctld_conf object
467
* RET uint32_t - age_max in secs.
469
uint32_t slurm_get_priority_max_age(void)
471
uint32_t age = NO_VAL;
472
slurm_ctl_conf_t *conf;
476
conf = slurm_conf_lock();
477
age = conf->priority_max_age;
484
/* slurm_get_priority_reset_period
485
* returns the priority usage reset period from slurmctld_conf object
486
* RET uint16_t - flag, see PRIORITY_RESET_* in slurm/slurm.h.
488
uint16_t slurm_get_priority_reset_period(void)
490
uint16_t reset_period = (uint16_t) 0;
491
slurm_ctl_conf_t *conf;
495
conf = slurm_conf_lock();
496
reset_period = conf->priority_reset_period;
503
/* slurm_get_priority_type
504
* returns the priority type from slurmctld_conf object
505
* RET char * - priority type, MUST be xfreed by caller
507
char *slurm_get_priority_type(void)
509
char *priority_type = NULL;
510
slurm_ctl_conf_t *conf;
514
conf = slurm_conf_lock();
515
priority_type = xstrdup(conf->priority_type);
519
return priority_type;
522
/* slurm_get_priority_weight_age
523
* returns the priority weight for age from slurmctld_conf object
524
* RET uint32_t - factor weight.
526
uint32_t slurm_get_priority_weight_age(void)
528
uint32_t factor = NO_VAL;
529
slurm_ctl_conf_t *conf;
533
conf = slurm_conf_lock();
534
factor = conf->priority_weight_age;
542
/* slurm_get_priority_weight_fairshare
543
* returns the priority weight for fairshare from slurmctld_conf object
544
* RET uint32_t - factor weight.
546
uint32_t slurm_get_priority_weight_fairshare(void)
548
uint32_t factor = NO_VAL;
549
slurm_ctl_conf_t *conf;
553
conf = slurm_conf_lock();
554
factor = conf->priority_weight_fs;
562
/* slurm_get_priority_weight_job_size
563
* returns the priority weight for job size from slurmctld_conf object
564
* RET uint32_t - factor weight.
566
uint32_t slurm_get_priority_weight_job_size(void)
568
uint32_t factor = NO_VAL;
569
slurm_ctl_conf_t *conf;
573
conf = slurm_conf_lock();
574
factor = conf->priority_weight_js;
581
/* slurm_get_priority_weight_partition
582
* returns the priority weight for partitions from slurmctld_conf object
583
* RET uint32_t - factor weight.
585
uint32_t slurm_get_priority_weight_partition(void)
587
uint32_t factor = NO_VAL;
588
slurm_ctl_conf_t *conf;
592
conf = slurm_conf_lock();
593
factor = conf->priority_weight_part;
601
/* slurm_get_priority_weight_qos
602
* returns the priority weight for QOS from slurmctld_conf object
603
* RET uint32_t - factor weight.
605
uint32_t slurm_get_priority_weight_qos(void)
607
uint32_t factor = NO_VAL;
608
slurm_ctl_conf_t *conf;
612
conf = slurm_conf_lock();
613
factor = conf->priority_weight_qos;
335
621
/* slurm_get_private_data
336
622
* get private data from slurmctld_conf object
608
912
return storage_user;
915
/* slurm_set_accounting_storage_user
916
* IN: char *user (name of file or database)
917
* RET 0 or error code
919
int slurm_set_accounting_storage_user(char *user)
921
slurm_ctl_conf_t *conf;
924
xfree(slurmdbd_conf->storage_user);
925
slurmdbd_conf->storage_user = xstrdup(user);
927
conf = slurm_conf_lock();
928
xfree(conf->accounting_storage_user);
929
conf->accounting_storage_user = xstrdup(user);
935
/* slurm_get_accounting_storage_backup_host
936
* returns the storage backup host from slurmctld_conf object
937
* RET char * - storage backup host, MUST be xfreed by caller
939
char *slurm_get_accounting_storage_backup_host(void)
942
slurm_ctl_conf_t *conf;
945
storage_host = xstrdup(slurmdbd_conf->storage_backup_host);
947
conf = slurm_conf_lock();
948
storage_host = xstrdup(conf->accounting_storage_backup_host);
611
954
/* slurm_get_accounting_storage_host
612
955
* returns the storage host from slurmctld_conf object
613
956
* RET char * - storage host, MUST be xfreed by caller
1654
2096
if(check_header_version(&header) < 0) {
2097
slurm_addr resp_addr;
1655
2099
int uid = _unpack_msg_uid(buffer);
1656
error("Invalid Protocol Version %u from uid=%d",
1657
header.version, uid);
2100
slurm_get_peer_addr(fd, &resp_addr);
2101
slurm_print_slurm_addr(&resp_addr, addr_str, sizeof(addr_str));
2102
error("Invalid Protocol Version %u from uid=%d at %s",
2103
header.version, uid, addr_str);
1658
2104
free_buf(buffer);
1659
2105
rc = SLURM_PROTOCOL_VERSION_ERROR;
1660
2106
goto total_return;
1662
2108
//info("ret_cnt = %d",header.ret_cnt);
1663
2109
if(header.ret_cnt > 0) {
1664
ret_list = list_create(destroy_data_info);
1665
while((ret_data_info = list_pop(header.ret_list)))
1666
list_push(ret_list, ret_data_info);
2111
ret_list = header.ret_list;
2113
ret_list = list_create(destroy_data_info);
1667
2114
header.ret_cnt = 0;
1668
list_destroy(header.ret_list);
1669
2115
header.ret_list = NULL;
2722
3180
hl = hostlist_create(name);
2725
3184
/* info("total sending to %s",nodelist); */
2726
3185
hl = hostlist_create(nodelist);
2728
while((name = hostlist_shift(hl))) {
2730
if(slurm_conf_get_addr(name, &msg->address) == SLURM_ERROR) {
2732
debug("slurm_send_recv_msgs: can't find "
2733
"address for host %s, check slurm.conf",
2736
error("slurm_send_recv_msgs: can't find "
2737
"address for host %s, check slurm.conf",
2740
mark_as_failed_forward(&tmp_ret_list, name,
2741
SLURM_COMMUNICATIONS_CONNECTION_ERROR);
2746
if ((fd = slurm_open_msg_conn(&msg->address)) < 0) {
2748
debug("slurm_send_recv_msgs to %s: %m", name);
2750
error("slurm_send_recv_msgs to %s: %m", name);
2751
mark_as_failed_forward(&tmp_ret_list, name,
2752
SLURM_COMMUNICATIONS_CONNECTION_ERROR);
2757
hostlist_ranged_string(hl, sizeof(buf), buf);
2758
forward_init(&msg->forward, NULL);
2759
msg->forward.nodelist = xstrdup(buf);
2760
msg->forward.timeout = timeout;
2761
msg->forward.cnt = hostlist_count(hl);
2762
if (msg->forward.nodelist[0]) {
2763
debug3("sending to %s along with to %s",
2764
name, msg->forward.nodelist);
2766
debug3("sending to %s", name);
2768
if(!(ret_list = _send_and_recv_msgs(fd, msg, timeout))) {
2769
xfree(msg->forward.nodelist);
2771
debug("slurm_send_recv_msgs"
2772
"(_send_and_recv_msgs) to %s: %m",
2775
error("slurm_send_recv_msgs"
2776
"(_send_and_recv_msgs) to %s: %m",
2779
mark_as_failed_forward(&tmp_ret_list, name, errno);
2783
itr = list_iterator_create(ret_list);
2784
while((ret_data_info = list_next(itr)))
2785
if(!ret_data_info->node_name) {
2786
ret_data_info->node_name =
2789
list_iterator_destroy(itr);
2791
xfree(msg->forward.nodelist);
3189
error("slurm_send_recv_msgs: problem creating hostlist");
3193
ret_list = start_msg_tree(hl, msg, timeout);
2795
3194
hostlist_destroy(hl);
2799
ret_list = tmp_ret_list;
2801
while((ret_data_info = list_pop(tmp_ret_list)))
2802
list_push(ret_list, ret_data_info);
2803
list_destroy(tmp_ret_list);
2806
3196
return ret_list;
3198
/* The below code will start from the first node in the list
3199
* to start the tree. The start_msg_tree function starts the
3200
* tree from the calling node. */
3202
/* while((name = hostlist_shift(hl))) { */
3204
/* if(slurm_conf_get_addr(name, &msg->address) == SLURM_ERROR) { */
3206
/* debug("slurm_send_recv_msgs: can't find " */
3207
/* "address for host %s, check slurm.conf", */
3210
/* error("slurm_send_recv_msgs: can't find " */
3211
/* "address for host %s, check slurm.conf", */
3214
/* mark_as_failed_forward(&tmp_ret_list, name, */
3215
/* SLURM_COMMUNICATIONS_CONNECTION_ERROR); */
3220
/* if ((fd = slurm_open_msg_conn(&msg->address)) < 0) { */
3222
/* debug("slurm_send_recv_msgs to %s: %m", name); */
3224
/* error("slurm_send_recv_msgs to %s: %m", name); */
3225
/* mark_as_failed_forward(&tmp_ret_list, name, */
3226
/* SLURM_COMMUNICATIONS_CONNECTION_ERROR); */
3231
/* hostlist_ranged_string(hl, sizeof(buf), buf); */
3232
/* forward_init(&msg->forward, NULL); */
3233
/* msg->forward.nodelist = xstrdup(buf); */
3234
/* msg->forward.timeout = timeout; */
3235
/* msg->forward.cnt = hostlist_count(hl); */
3236
/* if (msg->forward.nodelist[0]) { */
3237
/* debug3("sending to %s along with %s", */
3238
/* name, msg->forward.nodelist); */
3240
/* debug3("sending to %s", name); */
3242
/* if(!(ret_list = _send_and_recv_msgs(fd, msg, timeout))) { */
3243
/* xfree(msg->forward.nodelist); */
3245
/* debug("slurm_send_recv_msgs" */
3246
/* "(_send_and_recv_msgs) to %s: %m", */
3249
/* error("slurm_send_recv_msgs" */
3250
/* "(_send_and_recv_msgs) to %s: %m", */
3253
/* mark_as_failed_forward(&tmp_ret_list, name, errno); */
3257
/* itr = list_iterator_create(ret_list); */
3258
/* while((ret_data_info = list_next(itr))) */
3259
/* if(!ret_data_info->node_name) { */
3260
/* ret_data_info->node_name = */
3261
/* xstrdup(name); */
3263
/* list_iterator_destroy(itr); */
3265
/* xfree(msg->forward.nodelist); */
3269
/* hostlist_destroy(hl); */
3271
/* if(tmp_ret_list) { */
3273
/* ret_list = tmp_ret_list; */
3275
/* list_transfer(ret_list, tmp_ret_list); */
3276
/* list_destroy(tmp_ret_list); */
3279
/* return ret_list; */