コード例 #1
0
ファイル: bg_job_info.c プロジェクト: jsollom/slurm
/* pack a select job credential into a buffer in machine independent form
 * IN jobinfo  - the select job credential to be saved
 * OUT buffer  - buffer with select credential appended
 * IN protocol_version - slurm protocol version of client
 * RET         - slurm error code
 */
extern int  pack_select_jobinfo(select_jobinfo_t *jobinfo, Buf buffer,
				uint16_t protocol_version)
{
	int i;
	int dims = slurmdb_setup_cluster_dims();

	if (protocol_version >= SLURM_2_5_PROTOCOL_VERSION) {
		if (jobinfo) {
			if (jobinfo->dim_cnt)
				dims = jobinfo->dim_cnt;
			else if (bg_recover != NOT_FROM_CONTROLLER)
				xassert(0);

			pack16(dims, buffer);
			/* NOTE: If new elements are added here, make sure to
			 * add equivalant pack of zeros below for NULL
			 * pointer */
			for (i=0; i<dims; i++) {
				pack16(jobinfo->geometry[i], buffer);
				pack16(jobinfo->conn_type[i], buffer);
				pack16(jobinfo->start_loc[i], buffer);
			}
			pack16(jobinfo->reboot, buffer);
			pack16(jobinfo->rotate, buffer);

			pack32(jobinfo->block_cnode_cnt, buffer);
			pack32(jobinfo->cnode_cnt, buffer);

			packstr(jobinfo->bg_block_id, buffer);
			packstr(jobinfo->mp_str, buffer);
			packstr(jobinfo->ionode_str, buffer);

			packstr(jobinfo->blrtsimage, buffer);
			packstr(jobinfo->linuximage, buffer);
			packstr(jobinfo->mloaderimage, buffer);
			packstr(jobinfo->ramdiskimage, buffer);
			if (bg_conf) {
				pack16(bg_conf->mp_cnode_cnt, buffer);
				pack_bit_fmt(jobinfo->units_avail, buffer);
				pack_bit_fmt(jobinfo->units_used, buffer);
			} else {
				pack16(0, buffer);
				packnull(buffer);
				packnull(buffer);
			}
		} else {
			pack16(dims, buffer);
			/* pack space for 3 positions for geo
			 * conn_type and start_loc and then, reboot, and rotate
			 */
			for (i=0; i<((dims*3)+2); i++) {
				pack16((uint16_t) 0, buffer);
			}
			pack32((uint32_t) 0, buffer); //block_cnode_cnt
			pack32((uint32_t) 0, buffer); //cnode_cnt
			packnull(buffer); //bg_block_id
			packnull(buffer); //nodes
			packnull(buffer); //ionodes

			packnull(buffer); //blrts
			packnull(buffer); //linux
			packnull(buffer); //mloader
			packnull(buffer); //ramdisk
			pack16((uint16_t) 0, buffer); //mp_cnode_cnt
			packnull(buffer); //units_avail
			packnull(buffer); //units_used
		}
	} else {
 		error("pack_select_jobinfo: protocol_version "
 		      "%hu not supported", protocol_version);
	}
	return SLURM_SUCCESS;
}
コード例 #2
0
ファイル: slurmdbd_pack.c プロジェクト: SchedMD/slurm
static void _pack_job_start_msg(void *in,
				uint16_t rpc_version, Buf buffer)
{
	dbd_job_start_msg_t *msg = (dbd_job_start_msg_t *)in;

	if (rpc_version >= SLURM_19_05_PROTOCOL_VERSION) {
		packstr(msg->account, buffer);
		pack32(msg->alloc_nodes, buffer);
		pack32(msg->array_job_id, buffer);
		pack32(msg->array_max_tasks, buffer);
		pack32(msg->array_task_id, buffer);
		packstr(msg->array_task_str, buffer);
		pack32(msg->array_task_pending, buffer);
		pack32(msg->assoc_id, buffer);
		packstr(msg->constraints, buffer);
		pack32(msg->db_flags, buffer);
		pack64(msg->db_index, buffer);
		pack_time(msg->eligible_time, buffer);
		pack32(msg->gid, buffer);
		packstr(msg->gres_alloc, buffer);
		packstr(msg->gres_req, buffer);
		packstr(msg->gres_used, buffer);
		pack32(msg->job_id, buffer);
		pack32(msg->job_state, buffer);
		pack32(msg->state_reason_prev, buffer);
		packstr(msg->mcs_label, buffer);
		packstr(msg->name, buffer);
		packstr(msg->nodes, buffer);
		packstr(msg->node_inx, buffer);
		pack32(msg->pack_job_id, buffer);
		pack32(msg->pack_job_offset, buffer);
		packstr(msg->partition, buffer);
		pack32(msg->priority, buffer);
		pack32(msg->qos_id, buffer);
		pack32(msg->req_cpus, buffer);
		pack64(msg->req_mem, buffer);
		pack32(msg->resv_id, buffer);
		pack_time(msg->start_time, buffer);
		pack_time(msg->submit_time, buffer);
		pack32(msg->timelimit, buffer);
		packstr(msg->tres_alloc_str, buffer);
		packstr(msg->tres_req_str, buffer);
		pack32(msg->uid, buffer);
		packstr(msg->wckey, buffer);
		packstr(msg->work_dir, buffer);
	} else if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) {
		packstr(msg->account, buffer);
		pack32(msg->alloc_nodes, buffer);
		pack32(msg->array_job_id, buffer);
		pack32(msg->array_max_tasks, buffer);
		pack32(msg->array_task_id, buffer);
		packstr(msg->array_task_str, buffer);
		pack32(msg->array_task_pending, buffer);
		pack32(msg->assoc_id, buffer);
		packnull(buffer); /* block_id */
		pack64(msg->db_index, buffer);
		pack_time(msg->eligible_time, buffer);
		pack32(msg->gid, buffer);
		packstr(msg->gres_alloc, buffer);
		packstr(msg->gres_req, buffer);
		packstr(msg->gres_used, buffer);
		pack32(msg->job_id, buffer);
		pack32(msg->job_state, buffer);
		packstr(msg->mcs_label, buffer);
		packstr(msg->name, buffer);
		packstr(msg->nodes, buffer);
		packstr(msg->node_inx, buffer);
		pack32(msg->pack_job_id, buffer);
		pack32(msg->pack_job_offset, buffer);
		packstr(msg->partition, buffer);
		pack32(msg->priority, buffer);
		pack32(msg->qos_id, buffer);
		pack32(msg->req_cpus, buffer);
		pack64(msg->req_mem, buffer);
		pack32(msg->resv_id, buffer);
		pack_time(msg->start_time, buffer);
		pack_time(msg->submit_time, buffer);
		pack32(msg->timelimit, buffer);
		packstr(msg->tres_alloc_str, buffer);
		packstr(msg->tres_req_str, buffer);
		pack32(msg->uid, buffer);
		packstr(msg->wckey, buffer);
		packstr(msg->work_dir, buffer);
	}
}