Exemplo n.º 1
0
Arquivo: bb_info.c Projeto: HDOD/slurm
/* updates the burst buffer record on sview */
static void _update_bb_record(sview_bb_info_t *sview_bb_info_ptr,
			      GtkTreeStore *treestore)
{
	char tmp_create_time[40];
	char tmp_size[20], tmp_user_id[60], bb_name_id[32];
	char *tmp_state, *tmp_user_name;
	burst_buffer_resv_t *bb_ptr = sview_bb_info_ptr->bb_ptr;

	if (bb_ptr->name) {
		strncpy(bb_name_id, bb_ptr->name, sizeof(bb_name_id));
	} else if (bb_ptr->array_task_id == NO_VAL) {
		convert_num_unit(bb_ptr->job_id, bb_name_id,
				 sizeof(bb_name_id),
				 UNIT_NONE, working_sview_config.convert_flags);
	} else {
		snprintf(bb_name_id, sizeof(bb_name_id),
			 "%u_%u(%u)",
			 bb_ptr->array_job_id,
			 bb_ptr->array_task_id,
			 bb_ptr->job_id);
	}

	if (bb_ptr->create_time) {
		slurm_make_time_str((time_t *)&bb_ptr->create_time,
				    tmp_create_time, sizeof(tmp_create_time));
	} else {
		time_t now = time(NULL);
		slurm_make_time_str(&now, tmp_create_time,
				    sizeof(tmp_create_time));
	}

	_get_size_str(tmp_size, sizeof(tmp_size), bb_ptr->size);

	tmp_state = bb_state_string(bb_ptr->state);

	tmp_user_name = uid_to_string(bb_ptr->user_id);
	snprintf(tmp_user_id, sizeof(tmp_user_id), "%s(%u)", tmp_user_name,
		 bb_ptr->user_id);
	xfree(tmp_user_name);

	/* Combining these records provides a slight performance improvement */
	gtk_tree_store_set(treestore, &sview_bb_info_ptr->iter_ptr,
			   SORTID_COLOR,
			   sview_colors[sview_bb_info_ptr->color_inx],
			   SORTID_COLOR_INX,     sview_bb_info_ptr->color_inx,
			   SORTID_PLUGIN,        sview_bb_info_ptr->plugin,
			   SORTID_ACCOUNT,       bb_ptr->account,
			   SORTID_CREATE_TIME,   tmp_create_time,
			   SORTID_NAME,          bb_name_id,
			   SORTID_PARTITION,     bb_ptr->partition,
			   SORTID_POOL,          bb_ptr->pool,
			   SORTID_QOS,           bb_ptr->qos,
			   SORTID_SIZE,          tmp_size,
			   SORTID_STATE,         tmp_state,
			   SORTID_UPDATED,       1,
			   SORTID_USERID,        tmp_user_id,
			   -1);

	return;
}
Exemplo n.º 2
0
static void _print_burst_buffer_resv(FILE *out,
				     burst_buffer_resv_t* burst_buffer_ptr,
				     int one_liner, bool verbose)
{
	char sz_buf[32], time_buf[64], tmp_line[512];
	char *out_buf = NULL;

	/****** Line 1 ******/
	if (burst_buffer_ptr->job_id &&
	    (burst_buffer_ptr->array_task_id == NO_VAL)) {
		snprintf(tmp_line, sizeof(tmp_line),
			"    JobID=%u ", burst_buffer_ptr->job_id);
	} else if (burst_buffer_ptr->job_id) {
		snprintf(tmp_line, sizeof(tmp_line),
			"    JobID=%u_%u(%u) ",
			burst_buffer_ptr->array_job_id,
		        burst_buffer_ptr->array_task_id,
		        burst_buffer_ptr->job_id);
	} else {
		snprintf(tmp_line, sizeof(tmp_line),
			"    Name=%s ", burst_buffer_ptr->name);
	}
	xstrcat(out_buf, tmp_line);
	_get_size_str(sz_buf, sizeof(sz_buf), burst_buffer_ptr->size);
	if (burst_buffer_ptr->create_time) {
		slurm_make_time_str(&burst_buffer_ptr->create_time, time_buf,
				    sizeof(time_buf));
	} else {
		time_t now = time(NULL);
		slurm_make_time_str(&now, time_buf, sizeof(time_buf));
	}
	if (verbose) {
		snprintf(tmp_line, sizeof(tmp_line),
			 "Account=%s CreateTime=%s Partition=%s Pool=%s QOS=%s "
			 "Size=%s State=%s UserID=%s(%u)",
			 burst_buffer_ptr->account, time_buf,
			 burst_buffer_ptr->partition, burst_buffer_ptr->pool,
			 burst_buffer_ptr->qos,
			 sz_buf, bb_state_string(burst_buffer_ptr->state),
			 uid_to_string(burst_buffer_ptr->user_id),
			 burst_buffer_ptr->user_id);
	} else {
		snprintf(tmp_line, sizeof(tmp_line),
			 "CreateTime=%s Pool=%s Size=%s State=%s UserID=%s(%u)",
			 time_buf, burst_buffer_ptr->pool, sz_buf,
			 bb_state_string(burst_buffer_ptr->state),
			 uid_to_string(burst_buffer_ptr->user_id),
			 burst_buffer_ptr->user_id);
	}
	xstrcat(out_buf, tmp_line);

	xstrcat(out_buf, "\n");
	fprintf(out, "%s", out_buf);
	xfree(out_buf);
}
Exemplo n.º 3
0
static void _print_burst_buffer_use(FILE *out,
				    burst_buffer_use_t* usage_ptr,
				    int one_liner)
{
	char tmp_line[512], sz_buf[32];
	char *out_buf = NULL;

	_get_size_str(sz_buf, sizeof(sz_buf), usage_ptr->used);
	snprintf(tmp_line, sizeof(tmp_line),
		 "    UserID=%s(%u) Used=%s",
	         uid_to_string(usage_ptr->user_id), usage_ptr->user_id, sz_buf);

	xstrcat(out_buf, tmp_line);
	xstrcat(out_buf, "\n");
	fprintf(out, "%s", out_buf);
	xfree(out_buf);
}
Exemplo n.º 4
0
Arquivo: bb_info.c Projeto: HDOD/slurm
/* Function creates the record menu when you double click on a record */
static void _layout_bb_record(GtkTreeView *treeview,
			      sview_bb_info_t *sview_bb_info, int update)
{
	GtkTreeIter iter;
	char time_buf[20], tmp_user_id[60], tmp_size[20];
	char bb_name_id[32];
	char *tmp_state, *tmp_user_name;
	burst_buffer_resv_t *bb_ptr = sview_bb_info->bb_ptr;
	GtkTreeStore *treestore;

	treestore = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));

	if (bb_ptr->name) {
		strncpy(bb_name_id, bb_ptr->name, sizeof(bb_name_id));
	} else if (bb_ptr->array_task_id == NO_VAL) {
		convert_num_unit(bb_ptr->job_id, bb_name_id,
				 sizeof(bb_name_id),
				 UNIT_NONE, working_sview_config.convert_flags);
	} else {
		snprintf(bb_name_id, sizeof(bb_name_id),
			 "%u_%u(%u)",
			 bb_ptr->array_job_id,
			 bb_ptr->array_task_id,
			 bb_ptr->job_id);
	}
	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_NAME),
				   bb_name_id);

	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_PLUGIN),
				   sview_bb_info->plugin);

	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_ACCOUNT),
				   bb_ptr->account);

	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_PARTITION),
				   bb_ptr->partition);

	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_POOL),
				   bb_ptr->pool);

	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_QOS),
				   bb_ptr->qos);

	tmp_state = bb_state_string(bb_ptr->state);
	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_STATE),
				   tmp_state);

	_get_size_str(tmp_size, sizeof(tmp_size), bb_ptr->size);
	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_SIZE),
				   tmp_size);

	if (bb_ptr->create_time) {
		slurm_make_time_str((time_t *)&bb_ptr->create_time, time_buf,
				    sizeof(time_buf));
	} else {
		time_t now = time(NULL);
		slurm_make_time_str(&now, time_buf, sizeof(time_buf));
	}
	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_CREATE_TIME),
				   time_buf);

	tmp_user_name = uid_to_string(bb_ptr->user_id);
	snprintf(tmp_user_id, sizeof(tmp_user_id), "%s(%u)", tmp_user_name,
		 bb_ptr->user_id);
	xfree(tmp_user_name);
	add_display_treestore_line(update, treestore, &iter,
				   find_col_name(display_data_bb,
						 SORTID_USERID),
				   tmp_user_id);
}
Exemplo n.º 5
0
/*
 * slurm_print_burst_buffer_record - output information about a specific Slurm
 *	burst_buffer record based upon message as loaded using
 *	slurm_load_burst_buffer_info()
 * IN out - file to write to
 * IN burst_buffer_ptr - an individual burst buffer record pointer
 * IN one_liner - print as a single line if not zero
 * IN verbose - higher values to log additional details
 * RET out - char * containing formatted output (must be freed after call)
 *	   NULL is returned on failure.
 */
extern void slurm_print_burst_buffer_record(FILE *out,
		burst_buffer_info_t *burst_buffer_ptr, int one_liner,
		int verbose)
{
	char tmp_line[512];
	char g_sz_buf[32],t_sz_buf[32], u_sz_buf[32];
	char *out_buf = NULL;
	burst_buffer_resv_t *bb_resv_ptr;
	burst_buffer_use_t  *bb_use_ptr;
	bool has_acl = false;
	int i;

	/****** Line ******/
	_get_size_str(g_sz_buf, sizeof(g_sz_buf),
		      burst_buffer_ptr->granularity);
	_get_size_str(t_sz_buf, sizeof(t_sz_buf),
		      burst_buffer_ptr->total_space);
	_get_size_str(u_sz_buf, sizeof(u_sz_buf),
		      burst_buffer_ptr->used_space);
	snprintf(tmp_line, sizeof(tmp_line),
		 "Name=%s DefaultPool=%s Granularity=%s TotalSpace=%s "
		 "UsedSpace=%s",
		 burst_buffer_ptr->name, burst_buffer_ptr->default_pool,
		 g_sz_buf, t_sz_buf, u_sz_buf);
	xstrcat(out_buf, tmp_line);
	if (!one_liner)
		xstrcat(out_buf, "\n");

	/****** Line (optional) ******/
	/* Alternate pool information */
	for (i = 0; i < burst_buffer_ptr->pool_cnt; i++) {
		_get_size_str(g_sz_buf, sizeof(g_sz_buf),
			      burst_buffer_ptr->pool_ptr[i].granularity);
		_get_size_str(t_sz_buf, sizeof(t_sz_buf),
			      burst_buffer_ptr->pool_ptr[i].total_space);
		_get_size_str(u_sz_buf, sizeof(u_sz_buf),
			      burst_buffer_ptr->pool_ptr[i].used_space);
		snprintf(tmp_line, sizeof(tmp_line),
			 "  AltPoolName[%d]=%s Granularity=%s TotalSpace=%s "
			 "UsedSpace=%s",
			 i, burst_buffer_ptr->pool_ptr[i].name,
			 g_sz_buf, t_sz_buf, u_sz_buf);
		xstrcat(out_buf, tmp_line);
		if (!one_liner)
			xstrcat(out_buf, "\n");
	}

	/****** Line ******/
	snprintf(tmp_line, sizeof(tmp_line),
		"  Flags=%s",
		slurm_bb_flags2str(burst_buffer_ptr->flags));
	xstrcat(out_buf, tmp_line);
	if (!one_liner)
		xstrcat(out_buf, "\n");

	/****** Line ******/
	snprintf(tmp_line, sizeof(tmp_line),
		"  StageInTimeout=%u StageOutTimeout=%u ValidateTimeout=%u "
		"OtherTimeout=%u",
		burst_buffer_ptr->stage_in_timeout,
		burst_buffer_ptr->stage_out_timeout,
		burst_buffer_ptr->validate_timeout,
		burst_buffer_ptr->other_timeout);
	xstrcat(out_buf, tmp_line);
	if (!one_liner)
		xstrcat(out_buf, "\n");

	/****** Line (optional) ******/
	if (burst_buffer_ptr->allow_users) {
		snprintf(tmp_line, sizeof(tmp_line),
			"  AllowUsers=%s", burst_buffer_ptr->allow_users);
		xstrcat(out_buf, tmp_line);
		has_acl = true;
	} else if (burst_buffer_ptr->deny_users) {
		snprintf(tmp_line, sizeof(tmp_line),
			"  DenyUsers=%s", burst_buffer_ptr->deny_users);
		xstrcat(out_buf, tmp_line);
		has_acl = true;
	}
	if (has_acl && !one_liner)
		xstrcat(out_buf, "\n");

	/****** Line (optional) ******/
	if (burst_buffer_ptr->create_buffer) {
		snprintf(tmp_line, sizeof(tmp_line),
			"  CreateBuffer=%s", burst_buffer_ptr->create_buffer);
		xstrcat(out_buf, tmp_line);
		if (!one_liner)
			xstrcat(out_buf, "\n");
	}

	/****** Line (optional) ******/
	if (burst_buffer_ptr->destroy_buffer) {
		snprintf(tmp_line, sizeof(tmp_line),
			"  DestroyBuffer=%s", burst_buffer_ptr->destroy_buffer);
		xstrcat(out_buf, tmp_line);
		if (!one_liner)
			xstrcat(out_buf, "\n");
	}

	/****** Line ******/
	snprintf(tmp_line, sizeof(tmp_line),
		"  GetSysState=%s", burst_buffer_ptr->get_sys_state);
	xstrcat(out_buf, tmp_line);
	if (!one_liner)
		xstrcat(out_buf, "\n");

	/****** Line (optional) ******/
	if (burst_buffer_ptr->start_stage_in) {
		snprintf(tmp_line, sizeof(tmp_line),
			"  StartStageIn=%s", burst_buffer_ptr->start_stage_in);
		xstrcat(out_buf, tmp_line);
		if (!one_liner)
			xstrcat(out_buf, "\n");
	}

	/****** Line ******/
	if (burst_buffer_ptr->start_stage_out) {
		snprintf(tmp_line, sizeof(tmp_line),
			"  StartStageIn=%s", burst_buffer_ptr->start_stage_out);
		xstrcat(out_buf, tmp_line);
		if (!one_liner)
			xstrcat(out_buf, "\n");
	}

	/****** Line (optional) ******/
	if (burst_buffer_ptr->stop_stage_in) {
		snprintf(tmp_line, sizeof(tmp_line),
			"  StopStageIn=%s", burst_buffer_ptr->stop_stage_in);
		xstrcat(out_buf, tmp_line);
		if (!one_liner)
			xstrcat(out_buf, "\n");
	}

	/****** Line (optional) ******/
	if (burst_buffer_ptr->stop_stage_out) {
		snprintf(tmp_line, sizeof(tmp_line),
			"  StopStageIn=%s", burst_buffer_ptr->stop_stage_out);
		xstrcat(out_buf, tmp_line);
		if (!one_liner)
			xstrcat(out_buf, "\n");
	}

	if (one_liner)
		xstrcat(out_buf, "\n");
	fprintf(out, "%s", out_buf);
	xfree(out_buf);

	/****** Lines (optional) ******/
	if (burst_buffer_ptr->buffer_count)
		fprintf(out, "  Allocated Buffers:\n");
	for (i = 0, bb_resv_ptr = burst_buffer_ptr->burst_buffer_resv_ptr;
	     i < burst_buffer_ptr->buffer_count; i++, bb_resv_ptr++) {
		 _print_burst_buffer_resv(out, bb_resv_ptr, one_liner, verbose);
	}

	/****** Lines (optional) ******/
	if (burst_buffer_ptr->use_count)
		fprintf(out, "  Per User Buffer Use:\n");
	for (i = 0, bb_use_ptr = burst_buffer_ptr->burst_buffer_use_ptr;
	     i < burst_buffer_ptr->use_count; i++, bb_use_ptr++) {
		 _print_burst_buffer_use(out, bb_use_ptr, one_liner);
	}
}