本文整理汇总了C++中select_g_select_jobinfo_get函数的典型用法代码示例。如果您正苦于以下问题:C++ select_g_select_jobinfo_get函数的具体用法?C++ select_g_select_jobinfo_get怎么用?C++ select_g_select_jobinfo_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了select_g_select_jobinfo_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _setup_particulars
static int _setup_particulars(uint32_t cluster_flags,
char ***dest,
dynamic_plugin_data_t *select_jobinfo)
{
int rc = SLURM_SUCCESS;
if (cluster_flags & CLUSTER_FLAG_BG) {
char *bg_part_id = NULL;
select_g_select_jobinfo_get(select_jobinfo,
SELECT_JOBDATA_BLOCK_ID,
&bg_part_id);
if (bg_part_id) {
/* check to see if this is a HTC block or not. */
if (cluster_flags & CLUSTER_FLAG_BGP) {
uint16_t conn_type[HIGHEST_DIMENSIONS];
select_g_select_jobinfo_get(
select_jobinfo,
SELECT_JOBDATA_CONN_TYPE,
&conn_type);
if (conn_type[0] > SELECT_SMALL) {
/* SUBMIT_POOL over rides
HTC_SUBMIT_POOL */
setenvf(dest, "SUBMIT_POOL", "%s",
bg_part_id);
}
}
setenvf(dest, "MPIRUN_PARTITION", "%s", bg_part_id);
setenvf(dest, "MPIRUN_NOFREE", "%d", 1);
setenvf(dest, "MPIRUN_NOALLOCATE", "%d", 1);
xfree(bg_part_id);
} else
rc = SLURM_FAILURE;
if (rc == SLURM_FAILURE) {
error("Can't set MPIRUN_PARTITION "
"environment variable");
}
} else if (cluster_flags & CLUSTER_FLAG_CRAYXT) {
uint32_t resv_id = 0;
select_g_select_jobinfo_get(select_jobinfo,
SELECT_JOBDATA_RESV_ID,
&resv_id);
if (resv_id) {
setenvf(dest, "BASIL_RESERVATION_ID", "%u", resv_id);
} else {
error("Can't set BASIL_RESERVATION_ID "
"environment variable");
rc = SLURM_FAILURE;
}
} else if (cluster_flags & CLUSTER_FLAG_AIX) {
setenvf(dest, "LOADLBATCH", "%s", "yes");
}
return rc;
}
开发者ID:donaghy1,项目名称:slurm,代码行数:57,代码来源:env.c
示例2: _print_job_nodes
int _print_job_nodes(job_info_t * job, int width, bool right, char* suffix)
{
if (job == NULL) { /* Print the Header instead */
char *title = "NODELIST";
if (params.cluster_flags & CLUSTER_FLAG_BG)
title = "MIDPLANELIST";
_print_str(title, width, right, false);
} else {
char *nodes = xstrdup(job->nodes);
char *ionodes = NULL;
if (nodes) {
select_g_select_jobinfo_get(job->select_jobinfo,
SELECT_JOBDATA_IONODES,
&ionodes);
}
if (ionodes) {
xstrfmtcat(nodes, "[%s]", ionodes);
xfree(ionodes);
_print_str(nodes, width, right, false);
} else
_print_nodes(nodes, width, right, false);
xfree(nodes);
}
if (suffix)
printf("%s", suffix);
return SLURM_SUCCESS;
}
开发者ID:Cray,项目名称:slurm,代码行数:29,代码来源:print.c
示例3: _print_job_num_nodes
int _print_job_num_nodes(job_info_t * job, int width, bool right_justify,
char* suffix)
{
uint32_t node_cnt = 0;
char tmp_char[8];
if (job == NULL) /* Print the Header instead */
_print_str("NODES", width, right_justify, true);
else {
if (params.cluster_flags & CLUSTER_FLAG_BG)
select_g_select_jobinfo_get(job->select_jobinfo,
SELECT_JOBDATA_NODE_CNT,
&node_cnt);
if ((node_cnt == 0) || (node_cnt == NO_VAL))
node_cnt = _get_node_cnt(job);
if (params.cluster_flags & CLUSTER_FLAG_BG)
convert_num_unit((float)node_cnt, tmp_char,
sizeof(tmp_char), UNIT_NONE);
else
snprintf(tmp_char, sizeof(tmp_char), "%d", node_cnt);
_print_str(tmp_char, width, right_justify, true);
}
if (suffix)
printf("%s", suffix);
return SLURM_SUCCESS;
}
开发者ID:Cray,项目名称:slurm,代码行数:29,代码来源:print.c
示例4: _wait_bluegene_block_ready
/* returns 1 if job and nodes are ready for job to begin, 0 otherwise */
static int _wait_bluegene_block_ready(resource_allocation_response_msg_t *alloc)
{
int is_ready = 0, i, rc;
char *block_id = NULL;
double cur_delay = 0;
double cur_sleep = 0;
int max_delay = BG_FREE_PREVIOUS_BLOCK + BG_MIN_BLOCK_BOOT +
(BG_INCR_BLOCK_BOOT * alloc->node_cnt);
select_g_select_jobinfo_get(alloc->select_jobinfo,
SELECT_JOBDATA_BLOCK_ID,
&block_id);
for (i = 0; cur_delay < max_delay; i++) {
cur_sleep = POLL_SLEEP * i;
if (i == 1) {
debug("Waiting for block %s to become ready for job",
block_id);
}
if (i) {
usleep(1000000 * cur_sleep);
rc = _blocks_dealloc();
if ((rc == 0) || (rc == -1))
cur_delay += cur_sleep;
debug2("still waiting");
}
rc = slurm_job_node_ready(alloc->job_id);
if (rc == READY_JOB_FATAL)
break; /* fatal error */
if ((rc == READY_JOB_ERROR) || (rc == EAGAIN))
continue; /* retry */
if ((rc & READY_JOB_STATE) == 0) /* job killed */
break;
if (rc & READY_NODE_STATE) { /* job and node ready */
is_ready = 1;
break;
}
if (destroy_job)
break;
}
if (is_ready)
debug("Block %s is ready for job", block_id);
else if (!destroy_job)
error("Block %s still not ready", block_id);
else /* destroy_job set and slurmctld not responing */
is_ready = 0;
xfree(block_id);
return is_ready;
}
开发者ID:dellswor,项目名称:slurm,代码行数:54,代码来源:allocate.c
示例5: _print_job_reason_list
int _print_job_reason_list(job_info_t * job, int width, bool right,
char* suffix)
{
if (job == NULL) { /* Print the Header instead */
char *title = "NODELIST(REASON)";
if (params.cluster_flags & CLUSTER_FLAG_BG)
title = "MIDPLANELIST(REASON)";
_print_str(title, width, right, false);
} else if (!IS_JOB_COMPLETING(job)
&& (IS_JOB_PENDING(job)
|| IS_JOB_TIMEOUT(job)
|| IS_JOB_FAILED(job))) {
char id[FORMAT_STRING_SIZE], *reason;
if (job->state_desc)
reason = job->state_desc;
else
reason = job_reason_string(job->state_reason);
snprintf(id, FORMAT_STRING_SIZE, "(%s)", reason);
_print_str(id, width, right, true);
} else {
char *nodes = xstrdup(job->nodes);
char *ionodes = NULL;
select_g_select_jobinfo_get(job->select_jobinfo,
SELECT_JOBDATA_IONODES,
&ionodes);
if (ionodes) {
xstrfmtcat(nodes, "[%s]", ionodes);
xfree(ionodes);
_print_str(nodes, width, right, false);
} else
_print_nodes(nodes, width, right, false);
xfree(nodes);
}
if (suffix)
printf("%s", suffix);
return SLURM_SUCCESS;
}
开发者ID:Cray,项目名称:slurm,代码行数:38,代码来源:print.c
示例6: _print_record
static int _print_record(struct job_record *job_ptr,
time_t time, char *data)
{
static int rc=SLURM_SUCCESS;
char *block_id = NULL;
if (!job_ptr->details) {
error("job_acct: job=%u doesn't exist", job_ptr->job_id);
return SLURM_ERROR;
}
debug2("_print_record, job=%u, \"%s\"",
job_ptr->job_id, data);
#ifdef HAVE_BG
select_g_select_jobinfo_get(job_ptr->select_jobinfo,
SELECT_JOBDATA_BLOCK_ID,
&block_id);
#endif
if (!block_id)
block_id = xstrdup("-");
slurm_mutex_lock( &logfile_lock );
if (fprintf(LOGFILE,
"%u %s %d %d %u %u %s - %s\n",
job_ptr->job_id, job_ptr->partition,
(int)job_ptr->details->submit_time, (int)time,
job_ptr->user_id, job_ptr->group_id, block_id, data)
< 0)
rc=SLURM_ERROR;
#ifdef HAVE_FDATASYNC
fdatasync(LOGFILE_FD);
#endif
slurm_mutex_unlock( &logfile_lock );
xfree(block_id);
return rc;
}
开发者ID:jsollom,项目名称:slurm,代码行数:37,代码来源:accounting_storage_filetxt.c
示例7: allocate_nodes
resource_allocation_response_msg_t *
allocate_nodes(bool handle_signals)
{
resource_allocation_response_msg_t *resp = NULL;
job_desc_msg_t *j = job_desc_msg_create_from_opts();
slurm_allocation_callbacks_t callbacks;
int i;
if (!j)
return NULL;
/* Do not re-use existing job id when submitting new job
* from within a running job */
if ((j->job_id != NO_VAL) && !opt.jobid_set) {
info("WARNING: Creating SLURM job allocation from within "
"another allocation");
info("WARNING: You are attempting to initiate a second job");
if (!opt.jobid_set) /* Let slurmctld set jobid */
j->job_id = NO_VAL;
}
callbacks.ping = _ping_handler;
callbacks.timeout = _timeout_handler;
callbacks.job_complete = _job_complete_handler;
callbacks.job_suspend = NULL;
callbacks.user_msg = _user_msg_handler;
callbacks.node_fail = _node_fail_handler;
/* create message thread to handle pings and such from slurmctld */
msg_thr = slurm_allocation_msg_thr_create(&j->other_port, &callbacks);
/* NOTE: Do not process signals in separate pthread. The signal will
* cause slurm_allocate_resources_blocking() to exit immediately. */
if (handle_signals) {
xsignal_unblock(sig_array);
for (i = 0; sig_array[i]; i++)
xsignal(sig_array[i], _signal_while_allocating);
}
while (!resp) {
resp = slurm_allocate_resources_blocking(j, opt.immediate,
_set_pending_job_id);
if (destroy_job) {
/* cancelled by signal */
break;
} else if (!resp && !_retry()) {
break;
}
}
if (resp && !destroy_job) {
/*
* Allocation granted!
*/
pending_job_id = resp->job_id;
/*
* These values could be changed while the job was
* pending so overwrite the request with what was
* allocated so we don't have issues when we use them
* in the step creation.
*/
if (opt.pn_min_memory != NO_VAL)
opt.pn_min_memory = (resp->pn_min_memory &
(~MEM_PER_CPU));
else if (opt.mem_per_cpu != NO_VAL)
opt.mem_per_cpu = (resp->pn_min_memory &
(~MEM_PER_CPU));
/*
* FIXME: timelimit should probably also be updated
* here since it could also change.
*/
#ifdef HAVE_BG
uint32_t node_cnt = 0;
select_g_select_jobinfo_get(resp->select_jobinfo,
SELECT_JOBDATA_NODE_CNT,
&node_cnt);
if ((node_cnt == 0) || (node_cnt == NO_VAL)) {
opt.min_nodes = node_cnt;
opt.max_nodes = node_cnt;
} /* else we just use the original request */
if (!_wait_bluegene_block_ready(resp)) {
if (!destroy_job)
error("Something is wrong with the "
"boot of the block.");
goto relinquish;
}
#else
opt.min_nodes = resp->node_cnt;
opt.max_nodes = resp->node_cnt;
if (!_wait_nodes_ready(resp)) {
if (!destroy_job)
error("Something is wrong with the "
"boot of the nodes.");
goto relinquish;
}
#endif
} else if (destroy_job) {
//.........这里部分代码省略.........
开发者ID:RPI-HPC,项目名称:slurm,代码行数:101,代码来源:allocate.c
示例8: slurm_get_select_jobinfo
extern int slurm_get_select_jobinfo(dynamic_plugin_data_t *jobinfo,
enum select_jobdata_type data_type,
void *data)
{
return select_g_select_jobinfo_get(jobinfo, data_type, data);
}
开发者ID:damienfrancois,项目名称:slurm,代码行数:6,代码来源:block_info.c
示例9: _will_run_test2
//.........这里部分代码省略.........
FREE_NULL_BITMAP(exc_core_bitmap);
return NULL;
}
if (job_ptr->details->exc_node_bitmap) {
bit_not(job_ptr->details->exc_node_bitmap);
bit_and(avail_bitmap, job_ptr->details->exc_node_bitmap);
bit_not(job_ptr->details->exc_node_bitmap);
}
if ((job_ptr->details->req_node_bitmap) &&
(!bit_super_set(job_ptr->details->req_node_bitmap,
avail_bitmap))) {
*err_code = -730;
*err_msg = "Job's required nodes not available";
error("wiki: job %u not runnable on hosts=%s",
jobid, node_list);
FREE_NULL_BITMAP(avail_bitmap);
FREE_NULL_BITMAP(exc_core_bitmap);
return NULL;
}
min_nodes = MAX(job_ptr->details->min_nodes, part_ptr->min_nodes);
if (job_ptr->details->max_nodes == 0)
max_nodes = part_ptr->max_nodes;
else
max_nodes = MIN(job_ptr->details->max_nodes,
part_ptr->max_nodes);
max_nodes = MIN(max_nodes, 500000); /* prevent overflows */
if (job_ptr->details->max_nodes)
req_nodes = max_nodes;
else
req_nodes = min_nodes;
if (min_nodes > max_nodes) {
/* job's min_nodes exceeds partitions max_nodes */
*err_code = -730;
*err_msg = "Job's min_nodes > max_nodes";
error("wiki: job %u not runnable on hosts=%s",
jobid, node_list);
FREE_NULL_BITMAP(avail_bitmap);
FREE_NULL_BITMAP(exc_core_bitmap);
return NULL;
}
if (preemptee_cnt) {
preemptee_candidates = list_create(NULL);
for (i=0; i<preemptee_cnt; i++) {
if ((pre_ptr = find_job_record(preemptee[i])))
list_append(preemptee_candidates, pre_ptr);
}
}
orig_start_time = job_ptr->start_time;
rc = select_g_job_test(job_ptr, avail_bitmap, min_nodes, max_nodes,
req_nodes, SELECT_MODE_WILL_RUN,
preemptee_candidates, &preempted_jobs,
exc_core_bitmap);
FREE_NULL_LIST(preemptee_candidates);
if (rc == SLURM_SUCCESS) {
char *hostlist, *sep, tmp_str[128];
uint32_t pre_cnt = 0, proc_cnt = 0;
#ifdef HAVE_BG
select_g_select_jobinfo_get(job_ptr->select_jobinfo,
SELECT_JOBDATA_NODE_CNT, &proc_cnt);
#else
proc_cnt = job_ptr->total_cpus;
#endif
snprintf(tmp_str, sizeof(tmp_str),
"STARTINFO=%u TASKS=%u STARTTIME=%u NODES=",
job_ptr->job_id, proc_cnt,
(uint32_t) job_ptr->start_time);
xstrcat(reply_msg, tmp_str);
hostlist = bitmap2node_name(avail_bitmap);
xstrcat(reply_msg, hostlist);
xfree(hostlist);
if (preempted_jobs) {
while ((pre_ptr = list_pop(preempted_jobs))) {
if (pre_cnt++)
sep = ",";
else
sep = " PREEMPT=";
snprintf(tmp_str, sizeof(tmp_str), "%s%u",
sep, pre_ptr->job_id);
xstrcat(reply_msg, tmp_str);
}
FREE_NULL_LIST(preempted_jobs);
}
} else {
xstrcat(reply_msg, "Jobs not runable on selected nodes");
error("wiki: jobs not runnable on nodes");
}
/* Restore pending job's expected start time */
job_ptr->start_time = orig_start_time;
FREE_NULL_BITMAP(avail_bitmap);
FREE_NULL_BITMAP(exc_core_bitmap);
return reply_msg;
}
开发者ID:beninim,项目名称:slurm_simulator,代码行数:101,代码来源:job_will_run.c
示例10: batch_stepd_step_rec_create
//.........这里部分代码省略.........
if (msg->cpus_per_node)
job->cpus = msg->cpus_per_node[0];
job->node_tasks = 1;
job->ntasks = msg->ntasks;
job->jobid = msg->job_id;
job->stepid = msg->step_id;
job->array_job_id = msg->array_job_id;
job->array_task_id = msg->array_task_id;
job->batch = true;
/* This needs to happen before acct_gather_profile_startpoll
and only really looks at the profile in the job.
*/
acct_gather_profile_g_node_step_start(job);
/* needed for the jobacct_gather plugin to start */
acct_gather_profile_startpoll(msg->acctg_freq,
conf->job_acct_gather_freq);
job->multi_prog = 0;
job->open_mode = msg->open_mode;
job->overcommit = (bool) msg->overcommit;
job->node_name = xstrdup(conf->node_name);
job->uid = (uid_t) msg->uid;
job->user_name = xstrdup(msg->user_name);
job->gid = (gid_t) msg->gid;
job->cwd = xstrdup(msg->work_dir);
job->ckpt_dir = xstrdup(msg->ckpt_dir);
job->restart_dir = xstrdup(msg->restart_dir);
job->env = _array_copy(msg->envc, msg->environment);
job->eio = eio_handle_create();
job->sruns = list_create((ListDelF) _srun_info_destructor);
job->envtp = xmalloc(sizeof(env_t));
job->envtp->jobid = -1;
job->envtp->stepid = -1;
job->envtp->procid = -1;
job->envtp->localid = -1;
job->envtp->nodeid = -1;
job->envtp->distribution = 0;
job->cpu_bind_type = msg->cpu_bind_type;
job->cpu_bind = xstrdup(msg->cpu_bind);
job->envtp->mem_bind_type = 0;
job->envtp->mem_bind = NULL;
job->envtp->ckpt_dir = NULL;
job->envtp->restart_cnt = msg->restart_cnt;
if (msg->cpus_per_node)
job->cpus = msg->cpus_per_node[0];
format_core_allocs(msg->cred, conf->node_name, conf->cpus,
&job->job_alloc_cores, &job->step_alloc_cores,
&job->job_mem, &job->step_mem);
if (job->step_mem)
jobacct_gather_set_mem_limit(job->jobid, NO_VAL, job->step_mem);
else if (job->job_mem)
jobacct_gather_set_mem_limit(job->jobid, NO_VAL, job->job_mem);
get_cred_gres(msg->cred, conf->node_name,
&job->job_gres_list, &job->step_gres_list);
srun = srun_info_create(NULL, NULL, NULL);
list_append(job->sruns, (void *) srun);
if (msg->argc) {
job->argc = msg->argc;
job->argv = _array_copy(job->argc, msg->argv);
} else {
job->argc = 1;
/* job script has not yet been written out to disk --
* argv will be filled in later by _make_batch_script()
*/
job->argv = (char **) xmalloc(2 * sizeof(char *));
}
job->task = xmalloc(sizeof(stepd_step_task_info_t *));
if (msg->std_err == NULL)
msg->std_err = xstrdup(msg->std_out);
if (msg->std_in == NULL)
in_name = xstrdup("/dev/null");
else
in_name = fname_create(job, msg->std_in, 0);
job->task[0] = task_info_create(0, 0,
in_name,
_batchfilename(job, msg->std_out),
_batchfilename(job, msg->std_err));
job->task[0]->argc = job->argc;
job->task[0]->argv = job->argv;
#ifdef HAVE_ALPS_CRAY
select_g_select_jobinfo_get(msg->select_jobinfo, SELECT_JOBDATA_RESV_ID,
&job->resv_id);
#endif
return job;
}
开发者ID:Cray,项目名称:slurm,代码行数:101,代码来源:slurmstepd_job.c
示例11: slurm_sprint_job_step_info
/*
* slurm_sprint_job_step_info - output information about a specific Slurm
* job step based upon message as loaded using slurm_get_job_steps
* IN job_ptr - an individual job step information record pointer
* IN one_liner - print as a single line if true
* RET out - char * containing formatted output (must be freed after call)
* NULL is returned on failure.
*/
char *
slurm_sprint_job_step_info ( job_step_info_t * job_step_ptr,
int one_liner )
{
char tmp_node_cnt[40];
char time_str[32];
char limit_str[32];
char tmp_line[128];
char *out = NULL;
uint32_t cluster_flags = slurmdb_setup_cluster_flags();
/****** Line 1 ******/
slurm_make_time_str ((time_t *)&job_step_ptr->start_time, time_str,
sizeof(time_str));
if (job_step_ptr->time_limit == INFINITE)
sprintf(limit_str, "UNLIMITED");
else
secs2time_str ((time_t)job_step_ptr->time_limit * 60,
limit_str, sizeof(limit_str));
if (job_step_ptr->array_job_id) {
if (job_step_ptr->step_id == INFINITE) { /* Pending */
snprintf(tmp_line, sizeof(tmp_line),
"StepId=%u_%u.TBD ",
job_step_ptr->array_job_id,
job_step_ptr->array_task_id);
} else {
snprintf(tmp_line, sizeof(tmp_line), "StepId=%u_%u.%u ",
job_step_ptr->array_job_id,
job_step_ptr->array_task_id,
job_step_ptr->step_id);
}
out = xstrdup(tmp_line);
} else {
if (job_step_ptr->step_id == INFINITE) { /* Pending */
snprintf(tmp_line, sizeof(tmp_line), "StepId=%u.TBD ",
job_step_ptr->job_id);
} else {
snprintf(tmp_line, sizeof(tmp_line), "StepId=%u.%u ",
job_step_ptr->job_id, job_step_ptr->step_id);
}
out = xstrdup(tmp_line);
}
snprintf(tmp_line, sizeof(tmp_line),
"UserId=%u StartTime=%s TimeLimit=%s",
job_step_ptr->user_id, time_str, limit_str);
xstrcat(out, tmp_line);
if (one_liner)
xstrcat(out, " ");
else
xstrcat(out, "\n ");
/****** Line 2 ******/
snprintf(tmp_line, sizeof(tmp_line),
"State=%s ",
job_state_string(job_step_ptr->state));
xstrcat(out, tmp_line);
if (cluster_flags & CLUSTER_FLAG_BG) {
char *io_nodes = NULL;
select_g_select_jobinfo_get(job_step_ptr->select_jobinfo,
SELECT_JOBDATA_IONODES,
&io_nodes);
if (io_nodes) {
snprintf(tmp_line, sizeof(tmp_line),
"Partition=%s MidplaneList=%s[%s] Gres=%s",
job_step_ptr->partition,
job_step_ptr->nodes, io_nodes,
job_step_ptr->gres);
xfree(io_nodes);
} else
snprintf(tmp_line, sizeof(tmp_line),
"Partition=%s MidplaneList=%s Gres=%s",
job_step_ptr->partition,
job_step_ptr->nodes,
job_step_ptr->gres);
} else {
snprintf(tmp_line, sizeof(tmp_line),
"Partition=%s NodeList=%s Gres=%s",
job_step_ptr->partition, job_step_ptr->nodes,
job_step_ptr->gres);
}
xstrcat(out, tmp_line);
if (one_liner)
xstrcat(out, " ");
else
xstrcat(out, "\n ");
/****** Line 3 ******/
if (cluster_flags & CLUSTER_FLAG_BGQ) {
uint32_t nodes = 0;
select_g_select_jobinfo_get(job_step_ptr->select_jobinfo,
SELECT_JOBDATA_NODE_CNT,
&nodes);
//.........这里部分代码省略.........
开发者ID:beninim,项目名称:slurm_simulator,代码行数:101,代码来源:job_step_info.c
示例12: as_mysql_job_start
//.........这里部分代码省略.........
xfree(query);
} else
slurm_mutex_unlock(&rollup_lock);
no_rollup_change:
if (job_ptr->name && job_ptr->name[0])
jname = slurm_add_slash_to_quotes(job_ptr->name);
else {
jname = xstrdup("allocation");
track_steps = 1;
}
if (job_ptr->nodes && job_ptr->nodes[0])
nodes = job_ptr->nodes;
else
nodes = "None assigned";
if (job_ptr->batch_flag)
track_steps = 1;
if (slurmdbd_conf) {
block_id = xstrdup(job_ptr->comment);
node_cnt = job_ptr->total_nodes;
node_inx = job_ptr->network;
} else {
char temp_bit[BUF_SIZE];
if (job_ptr->node_bitmap) {
node_inx = bit_fmt(temp_bit, sizeof(temp_bit),
job_ptr->node_bitmap);
}
#ifdef HAVE_BG
select_g_select_jobinfo_get(job_ptr->select_jobinfo,
SELECT_JOBDATA_BLOCK_ID,
&block_id);
select_g_select_jobinfo_get(job_ptr->select_jobinfo,
SELECT_JOBDATA_NODE_CNT,
&node_cnt);
#else
node_cnt = job_ptr->total_nodes;
#endif
}
/* If there is a start_time get the wckeyid. If the job is
* cancelled before the job starts we also want to grab it. */
if (job_ptr->assoc_id
&& (job_ptr->start_time || IS_JOB_CANCELLED(job_ptr)))
wckeyid = _get_wckeyid(mysql_conn, &job_ptr->wckey,
job_ptr->user_id,
mysql_conn->cluster_name,
job_ptr->assoc_id);
if (job_ptr->partition)
partition = slurm_add_slash_to_quotes(job_ptr->partition);
if (job_ptr->gres_req)
gres_req = slurm_add_slash_to_quotes(job_ptr->gres_req);
if (job_ptr->gres_alloc)
gres_alloc = slurm_add_slash_to_quotes(job_ptr->gres_alloc);
if (!job_ptr->db_index) {
if (!begin_time)
begin_time = submit_time;
query = xstrdup_printf(
开发者ID:BYUHPC,项目名称:slurm,代码行数:67,代码来源:as_mysql_job.c
示例13: allocate_nodes
//.........这里部分代码省略.........
callbacks.node_fail = _node_fail_handler;
/* create message thread to handle pings and such from slurmctld */
msg_thr = slurm_allocation_msg_thr_create(&j->other_port, &callbacks);
/* NOTE: Do not process signals in separate pthread. The signal will
* cause slurm_allocate_resources_blocking() to exit immediately. */
if (handle_signals) {
xsignal_unblock(sig_array);
for (i = 0; sig_array[i]; i++)
xsignal(sig_array[i], _signal_while_allocating);
}
while (!resp) {
resp = slurm_allocate_resources_blocking(j,
opt_local->immediate,
_set_pending_job_id);
if (destroy_job) {
/* cancelled by signal */
break;
} else if (!resp && !_retry()) {
break;
}
}
if (resp)
print_multi_line_string(resp->job_submit_user_msg, -1);
if (resp && !destroy_job) {
/*
* Allocation granted!
*/
pending_job_id = resp->job_id;
/*
* These values could be changed while the job was
* pending so overwrite the request with what was
* allocated so we don't have issues when we use them
* in the step creation.
*/
opt_local->pn_min_memory = NO_VAL64;
opt_local->mem_per_cpu = NO_VAL64;
if (resp->pn_min_memory != NO_VAL64) {
if (resp->pn_min_memory & MEM_PER_CPU) {
opt_local->mem_per_cpu = (resp->pn_min_memory &
(~MEM_PER_CPU));
} else {
opt_local->pn_min_memory = resp->pn_min_memory;
}
}
#ifdef HAVE_BG
uint32_t node_cnt = 0;
select_g_select_jobinfo_get(resp->select_jobinfo,
SELECT_JOBDATA_NODE_CNT,
&node_cnt);
if ((node_cnt == 0) || (node_cnt == NO_VAL)) {
opt_local->min_nodes = node_cnt;
opt_local->max_nodes = node_cnt;
} /* else we just use the original request */
if (!_wait_bluegene_block_ready(resp)) {
if (!destroy_job)
error("Something is wrong with the "
"boot of the block.");
goto relinquish;
}
#else
opt_local->min_nodes = resp->node_cnt;
opt_local->max_nodes = resp->node_cnt;
if (resp->working_cluster_rec)
slurm_setup_remote_working_cluster(resp);
if (!_wait_nodes_ready(resp)) {
if (!destroy_job)
error("Something is wrong with the boot of the nodes.");
goto relinquish;
}
#endif
} else if (destroy_job) {
goto relinquish;
}
if (handle_signals)
xsignal_block(sig_array);
job_desc_msg_destroy(j);
return resp;
relinquish:
if (resp) {
if (!destroy_job)
slurm_complete_job(resp->job_id, 1);
slurm_free_resource_allocation_response_msg(resp);
}
exit(error_exit);
return NULL;
}
开发者ID:miguelgila,项目名称:slurm,代码行数:101,代码来源:allocate.c
示例14: _print_text_job
static int _print_text_job(job_info_t * job_ptr)
{
time_t time_diff;
int printed = 0;
int tempxcord;
int prefixlen = 0;
int i = 0;
int width = 0;
char time_buf[20];
char tmp_cnt[8];
uint32_t node_cnt = 0;
char *ionodes = NULL, *uname;
if (params.cluster_flags & CLUSTER_FLAG_BG) {
select_g_select_jobinfo_get(job_ptr->select_jobinfo,
SELECT_JOBDATA_IONODES,
&ionodes);
select_g_select_jobinfo_get(job_ptr->select_jobinfo,
SELECT_JOBDATA_NODE_CNT,
&node_cnt);
if (!xstrcasecmp(job_ptr->nodes,"waiting..."))
xfree(ionodes);
} else
node_cnt = job_ptr->num_nodes;
if ((node_cnt == 0) || (node_cnt == NO_VAL))
node_cnt = job_ptr->num_nodes;
if (params.cluster_flags & CLUSTER_FLAG_BG)
convert_num_unit((float)node_cnt, tmp_cnt, sizeof(tmp_cnt),
UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT);
else
snprintf(tmp_cnt, sizeof(tmp_cnt), "%d", node_cnt);
if (!params.commandline) {
mvwprintw(text_win, main_ycord,
main_xcord, "%c", job_ptr->num_cpus);
main_xcord += 3;
if (job_ptr->array_task_str) {
mvwprintw(text_win, main_ycord,
main_xcord, "%u_[%s]",
job_ptr->array_job_id,
job_ptr->array_task_str);
} else if (job_ptr->array_task_id != NO_VAL) {
mvwprintw(text_win, main_ycord,
main_xcord, "%u_%u (%u)",
job_ptr->array_job_id,
job_ptr->array_task_id, job_ptr->job_id);
} else if (job_ptr->pack_job_id) {
mvwprintw(text_win, main_ycord, main_xcord, "%u+%u ",
job_ptr->pack_job_id,
job_ptr->pack_job_offset);
} else {
mvwprintw(text_win, main_ycord, main_xcord, "%u",
job_ptr->job_id);
}
main_xcord += 19;
mvwprintw(text_win, main_ycord,
main_xcord, "%.10s", job_ptr->partition);
main_xcord += 10;
if (params.cluster_flags & CLUSTER_FLAG_BG) {
mvwprintw(text_win, main_ycord,
main_xcord, "%.16s",
select_g_select_jobinfo_sprint(
job_ptr->select_jobinfo,
time_buf,
sizeof(time_buf),
SELECT_PRINT_BG_ID));
main_xcord += 18;
}
if (params.cluster_flags & CLUSTER_FLAG_CRAY_A) {
mvwprintw(text_win, main_ycord,
main_xcord, "%.16s",
select_g_select_jobinfo_sprint(
job_ptr->select_jobinfo,
time_buf, sizeof(time_buf),
SELECT_PRINT_DATA));
main_xcord += 18;
}
uname = uid_to_string_cached((uid_t) job_ptr->user_id);
mvwprintw(text_win, main_ycord,
main_xcord, "%.8s", uname);
main_xcord += 9;
mvwprintw(text_win, main_ycord,
main_xcord, "%.9s", job_ptr->name);
main_xcord += 10;
mvwprintw(text_win, main_ycord,
main_xcord, "%.2s",
job_state_string_compact(job_ptr->job_state));
main_xcord += 2;
if (!xstrcasecmp(job_ptr->nodes,"waiting...")) {
sprintf(time_buf,"00:00:00");
} else {
time_diff = (time_t) _job_time_used(job_ptr);
secs2time_str(time_diff, time_buf, sizeof(time_buf));
}
width = strlen(time_buf);
mvwprintw(text_win, main_ycord,
main_xcord + (10 - width), "%s",
time_buf);
//.........这里部分代码省略.........
开发者ID:HPCNow,项目名称:slurm,代码行数:101,代码来源:job_functions.c
示例15: slurm_sprint_job_info
/*
* slurm_sprint_job_info - output information about a specific Slurm
* job based upon message as loaded using slurm_load_jobs
* IN job_ptr - an individual job information record pointer
* IN one_liner - print as a single line if true
* RET out - char * containing formatted output (must be freed after call)
* NULL is returned on failure.
*/
extern char *
slurm_sprint_job_info ( job_info_t * job_ptr, int one_liner )
{
int i, j, k;
char time_str[32], *group_name, *user_name;
char *gres_last = "", tmp1[128], tmp2[128];
char *tmp6_ptr;
char tmp_line[1024 * 128];
char tmp_path[MAXPATHLEN];
char *ionodes = NULL;
uint16_t exit_status = 0, term_sig = 0;
job_resources_t *job_resrcs = job_ptr->job_resrcs;
char *out = NULL;
time_t run_time;
uint32_t min_nodes, max_nodes = 0;
char *nodelist = "NodeList";
bitstr_t *cpu_bitmap;
char *host;
int sock_inx, sock_reps, last;
int abs_node_inx, rel_node_inx;
int64_t nice;
int bit_inx, bit_reps;
uint64_t *last_mem_alloc_ptr = NULL;
uint64_t last_mem_alloc = NO_VAL64;
char *last_hosts;
hostlist_t hl, hl_last;
char select_buf[122];
uint32_t cluster_flags = slurmdb_setup_cluster_flags();
uint32_t threads;
char *line_end = (one_liner) ? " " : "\n ";
if (cluster_flags & CLUSTER_FLAG_BG) {
nodelist = "MidplaneList";
select_g_select_jobinfo_get(job_ptr->select_jobinfo,
SELECT_JOBDATA_IONODES,
&ionodes);
}
/****** Line 1 ******/
xstrfmtcat(out, "JobId=%u ", job_ptr->job_id);
if (job_ptr->array_job_id) {
if (job_ptr->array_task_str) {
xstrfmtcat(out, "ArrayJobId=%u ArrayTaskId=%s ",
job_ptr->array_job_id,
job_ptr->array_task_str);
} else {
xstrfmtcat(out, "ArrayJobId=%u ArrayTaskId=%u ",
job_ptr->array_job_id,
job_ptr->array_task_id);
}
}
xstrfmtcat(out, "JobName=%s", job_ptr->name);
xstrcat(out, line_end);
/****** Line 2 ******/
user_name = uid_to_string((uid_t) job_ptr->user_id);
group_name = gid_to_string((gid_t) job_ptr->group_id);
xstrfmtcat(out, "UserId=%s(%u) GroupId=%s(%u) MCS_label=%s",
user_name, job_ptr->user_id, group_name, job_ptr->group_id,
(job_ptr->mcs_label==NULL) ? "N/A" : job_ptr->mcs_label);
xfree(user_name);
xfree(group_name);
xstrcat(out, line_end);
/****** Line 3 ******/
nice = ((int64_t)job_ptr->nice) - NICE_OFFSET;
xstrfmtcat(out, "Priority=%u Nice=%"PRIi64" Account=%s QOS=%s",
job_ptr->priority, nice, job_ptr->account, job_ptr->qos);
if (slurm_get_track_wckey())
xstrfmtcat(out, " WCKey=%s", job_ptr->wckey);
xstrcat(out, line_end);
/****** Line 4 ******/
xstrfmtcat(out, "JobState=%s ", job_state_string(job_ptr->job_state));
if (job_ptr->state_desc) {
/* Replace white space with underscore for easier parsing */
for (j=0; job_ptr->state_desc[j]; j++) {
if (isspace((int)job_ptr->state_desc[j]))
job_ptr->state_desc[j] = '_';
}
xstrfmtcat(out, "Reason=%s ", job_ptr->state_desc);
} else
xstrfmtcat(out, "Reason=%s ", job_reason_string(job_ptr->state_reason));
xstrfmtcat(out, "Dependency=%s", job_ptr->dependency);
xstrcat(out, line_end);
/****** Line 5 ******/
xstrfmtcat(out, "Requeue=%u Restarts=%u BatchFlag=%u Reboot=%u ",
job_ptr->requeue, job_ptr->restart_cnt, job_ptr->batch_flag,
//.........这里部分代码省略.........
开发者ID:fafik23,项目名称:slurm,代码行数:101,代码来源:job_info.c
示例16: jobacct_storage_p_step_start
/*
* load into the storage the start of a job step
*/
extern int jobacct_storage_p_step_start(void *db_conn,
struct step_record *step_ptr)
{
char buf[BUFFER_SIZE];
int cpus = 0, rc;
char node_list[BUFFER_SIZE];
#ifdef HAVE_BG
char *ionodes = NULL;
#endif
float float_tmp = 0;
char *account, *step_name;
if (!storage_init) {
debug("jobacct init was not called or it failed");
return SLURM_ERROR;
}
#ifdef HAVE_BG
if (step_ptr->job_ptr->details)
cpus = step_ptr->job_ptr->details->min_cpus;
else
cpus = step_ptr->job_ptr->cpu_cnt;
select_g_select_jobinfo_get(step_ptr->job_ptr->select_jobinfo,
SELECT_JOBDATA_IONODES,
&ionodes);
if (ionodes) {
snprintf(node_list, BUFFER_SIZE,
"%s[%s]", step_ptr->job_ptr->nodes, ionodes);
xfree(ionodes);
} else
snprintf(node_list, BUFFER_SIZE, "%s",
step_ptr->job_ptr->nodes);
#else
if (!step_ptr->step_layout || !step_ptr->step_layout->task_cnt) {
cpus = step_ptr->job_ptr->total_cpus;
snprintf(node_list, BUFFER_SIZE, "%s", step_ptr->job_ptr->nodes);
} else {
cpus = step_ptr->step_layout->task_cnt;
snprintf(node_list, BUFFER_SIZE, "%s",
step_ptr->step_layout->node_list);
}
#endif
account = _safe_dup(step_ptr->job_ptr->account);
step_name = _safe_dup(step_ptr->name);
step_ptr->job_ptr->requid = -1; /* force to -1 for stats to know this
* hasn't been set yet */
snprintf(buf, BUFFER_SIZE, _jobstep_format,
JOB_STEP,
step_ptr->step_id, /* stepid */
JOB_RUNNING, /* completion status */
0, /* completion code */
cpus, /* number of tasks */
cpus, /* number of cpus */
0, /* elapsed seconds */
0, /* total cputime seconds */
0, /* total cputime seconds */
0, /* user seconds */
0, /* user microseconds */
0, /* system seconds */
0, /* system microsecs */
0, /* max rss */
0, /* max ixrss */
0, /* max idrss */
0, /* max isrss */
0, /* max minflt */
0, /* max majflt */
0, /* max nswap */
0, /* total inblock */
0, /* total outblock */
0, /* total msgsnd */
0, /* total msgrcv */
0, /* total nsignals */
0, /* total nvcsw */
0, /* total nivcsw */
0, /* max vsize */
0, /* max vsize task */
float_tmp, /* ave vsize */
0, /* max rss */
0, /* max rss task */
float_tmp, /* ave rss */
0, /* max pages */
0, /* max pages task */
float_tmp, /* ave pages */
0, /* min cpu */
0, /* min cpu task */
float_tmp, /* ave cpu */
step_name, /* step exe name */
node_list, /* name of nodes step running on */
0, /* max vsize node */
0, /* max rss node */
0, /* max pages node */
0, /* min cpu node */
account,
step_ptr->job_ptr->requid); /* requester user id */
//.........这里部分代码省略.........
开发者ID:jsollom,项目名称:slurm,代码行数:101,代码来源:accounting_storage_filetxt.c
示例17: slurm_sprint_job_step_info
/*
* slurm_sprint_job_step_info - output information about a specific Slurm
* job step based upon message as loaded using slurm_get_job_steps
* IN job_ptr - an individual job step information record pointer
* IN one_liner - print as a single line if true
* RET out - char * containing formatted output (must be freed after call)
* NULL is returned on failure.
*/
char *
slurm_sprint_job_step_info ( job_step_info_t * job_step_ptr,
int one_liner )
{
char time_str[32];
char limit_str[32];
char tmp_line[128];
char *out = NULL;
uint32_t cluster_flags = slurmdb_setup_cluster_flags();
/****** Line 1 ******/
slurm_make_time_str ((time_t *)&job_step_ptr->start_time, time_str,
sizeof(time_str));
if (job_step_ptr->time_limit == INFINITE)
sprintf(limit_str, "UNLIMITED");
else
secs2time_str ((time_t)job_step_ptr->time_limit * 60,
limit_str, sizeof(limit_str));
snprintf(tmp_line, sizeof(tmp_line),
"StepId=%u.%u UserId=%u StartTime=%s TimeLimit=%s",
job_step_ptr->job_id, job_step_ptr->step_id,
job_step_ptr->user_id, time_str, limit_str);
out = xstrdup(tmp_line);
if (one_liner)
xstrcat(out, " ");
else
xstrcat(out, "\n ");
/****** Line 2 ******/
if (cluster_flags & CLUSTER_FLAG_BG) {
char *io_nodes;
select_g_select_jobinfo_get(job_step_ptr->select_jobinfo,
SELECT_JOBDATA_IONODES,
&io_nodes);
snprintf(tmp_line, sizeof(tmp_line),
"Partition=%s BP_List=%s[%s] Gres=%s",
job_step_ptr->partition,
job_step_ptr->nodes, io_nodes,
job_step_ptr->gres);
xfree(io_nodes);
} else {
snprintf(tmp_line, sizeof(tmp_line),
"Partition=%s Nodes=%s Gres=%s",
job_step_ptr->partition, job_step_ptr->nodes,
job_step_ptr->gres);
}
xstrcat(out, tmp_line);
if (one_liner)
xstrcat(out, " ");
else
xstrcat(out, "\n ");
/****** Line 3 ******/
snprintf(tmp_line, sizeof(tmp_line),
"Tasks=%u Name=%s Network=%s",
job_step_ptr->num_tasks, job_step_ptr->name,
job_step_ptr->network);
xstrcat(out, tmp_line);
if (one_liner)
xstrcat(out, " ");
else
xstrcat(out, "\n ");
/****** Line 4 ******/
snprintf(tmp_line, sizeof(tmp_line),
"ResvPorts=%s Checkpoint=%u CheckpointDir=%s\n\n",
job_step_ptr->resv_ports,
job_step_ptr->ckpt_interval, job_step_ptr->ckpt_dir);
xstrcat(out, tmp_line);
return out;
}
开发者ID:jianjinxu,项目名称:slurm,代码行数:80,代码来源:job_step_info.c
示例18: _will_run_test
//.........这里部分代码省略.........
/* Consider only nodes in this job's partition */
if (part_ptr->node_bitmap)
bit_and(avail_bitmap, part_ptr->node_bitmap);
else {
*err_code = -730;
*err_msg = "Job's partition has no nodes";
error("wiki: no nodes in partition %s for job %u",
part_ptr->name, jobid);
FREE_NULL_BITMAP(avail_bitmap);
return NULL;
}
if (job_req_node_filter(job_ptr, avail_bitmap) != SLURM_SUCCESS) {
/* Job probably has invalid feature list */
*err_code = -730;
*err_msg = "Job's required features not available "
"on selected nodes";
error("wiki: job %u not runnable on hosts=%s",
jobid, node_list);
FREE_NULL_BITMAP(avail_bitmap);
return NULL;
}
if (job_ptr->details->exc_node_bitmap) {
bit_not(job_ptr->details->exc_node_bitmap);
bit_and(avail_bitmap, job_ptr->details->exc_node_bitmap);
bit_not(job_ptr->details->exc_node_bitmap);
}
if ((job_ptr->details->req_node_bitmap) &&
(!bit_super_set(job_ptr->details->req_node_bitmap,
avail_bitmap))) {
*err_code = -730;
*err_msg = "Job's required nodes not available";
error("wiki: job %u not runnable on hosts=%s",
jobid, node_list);
FREE_NULL_BITMAP(avail_bitmap);
return NULL;
}
min_nodes = MAX(job_ptr->details->min_nodes, part_ptr->min_nodes);
if (job_ptr->details->max_nodes == 0)
max_nodes = part_ptr->max_nodes;
else
max_nodes = MIN(job_ptr->details->max_nodes,
part_ptr->max_nodes);
max_nodes = MIN(max_nodes, 500000); /* prevent overflows */
if (job_ptr->details->max_nodes)
req_nodes = max_nodes;
else
req_nodes = min_nodes;
if (min_n
|
请发表评论