/* get details about this slurm job: jobid and allocated node */ static void _get_job_info(void) { xassert(params.job_id != NO_VAL); if (slurm_sbcast_lookup(params.job_id, params.step_id, &sbcast_cred) != SLURM_SUCCESS) { if (params.step_id == NO_VAL) { error("Slurm job ID %u lookup error: %s", params.job_id, slurm_strerror(slurm_get_errno())); } else { error("Slurm step ID %u.%u lookup error: %s", params.job_id, params.step_id, slurm_strerror(slurm_get_errno())); } exit(1); } if (params.step_id == NO_VAL) verbose("jobid = %u", params.job_id); else verbose("jobid = %u.%u", params.job_id, params.step_id); verbose("node_cnt = %u", sbcast_cred->node_cnt); verbose("node_list = %s", sbcast_cred->node_list); /* also see sbcast_cred->node_addr (array) */ if (params.verbose) print_sbcast_cred(sbcast_cred->sbcast_cred); /* do not bother to release the return message, * we need to preserve and use most of the information later */ }
/* get details about this slurm job: jobid and allocated node */ static int _get_job_info(struct bcast_parameters *params) { int rc; xassert(params->job_id != NO_VAL); rc = slurm_sbcast_lookup(params->job_id, params->step_id, &sbcast_cred); if (rc != SLURM_SUCCESS) { if (params->step_id == NO_VAL) { error("Slurm job ID %u lookup error: %s", params->job_id, slurm_strerror(slurm_get_errno())); } else { error("Slurm step ID %u.%u lookup error: %s", params->job_id, params->step_id, slurm_strerror(slurm_get_errno())); } return rc; } if (params->step_id == NO_VAL) verbose("jobid = %u", params->job_id); else verbose("stepid = %u.%u", params->job_id, params->step_id); verbose("node_cnt = %u", sbcast_cred->node_cnt); verbose("node_list = %s", sbcast_cred->node_list); /* also see sbcast_cred->node_addr (array) */ if (params->verbose) print_sbcast_cred(sbcast_cred->sbcast_cred); /* do not bother to release the return message, * we need to preserve and use most of the information later */ return rc; }
/* get details about this slurm job: jobid and allocated node */ static void _get_job_info(void) { char *jobid_str; uint32_t jobid; jobid_str = getenv("SLURM_JOB_ID"); if (!jobid_str) { error("Command only valid from within SLURM job"); exit(1); } jobid = (uint32_t) atol(jobid_str); verbose("jobid = %u", jobid); if (slurm_sbcast_lookup(jobid, &sbcast_cred) != SLURM_SUCCESS) { error("SLURM jobid %u lookup error: %s", jobid, slurm_strerror(slurm_get_errno())); exit(1); } verbose("node_cnt = %u", sbcast_cred->node_cnt); verbose("node_list = %s", sbcast_cred->node_list); /* also see sbcast_cred->node_addr (array) */ if (params.verbose) print_sbcast_cred(sbcast_cred->sbcast_cred); /* do not bother to release the return message, * we need to preserve and use most of the information later */ }