Exemplo n.º 1
0
drmaa2_r drmaa2_rsession_get_reservation(const drmaa2_rsession rs, const drmaa2_string reservationId) {
    if (!rsession_is_valid(rs)) {
        drmaa2_lasterror_v = DRMAA2_INVALID_SESSION;
        drmaa2_lasterror_text_v = "Reservation session is invalid.";
        return NULL;
    }

    drmaa2_r r = get_reservation(reservationId);
    if (r == NULL) {
        drmaa2_lasterror_v = DRMAA2_INVALID_ARGUMENT;
        drmaa2_lasterror_text_v = "Reservation ID is invalid.";
    }
    return r;    
}
Exemplo n.º 2
0
int
get_pooled(const unit * u, const resource_type * rtype, unsigned int mode,
int count)
{
    const faction *f = u->faction;
    unit *v;
    int use = 0;
    region *r = u->region;
    int have = get_resource(u, rtype);

    if ((u_race(u)->ec_flags & GETITEM) == 0) {
        mode &= (GET_SLACK | GET_RESERVE);
    }

    if ((mode & GET_SLACK) && (mode & GET_RESERVE))
        use = have;
    else if (rtype->itype && mode & (GET_SLACK | GET_RESERVE)) {
        int reserve = get_reservation(u, rtype->itype);
        int slack = _max(0, have - reserve);
        if (mode & GET_RESERVE)
            use = have - slack;
        else if (mode & GET_SLACK)
            use = slack;
    }
    if (rtype->flags & RTF_POOLED && mode & ~(GET_SLACK | GET_RESERVE)) {
        for (v = r->units; v && use < count; v = v->next)
            if (u != v && (v->items || rtype->uget)) {
                int mask;

                if ((urace(v)->ec_flags & ECF_KEEP_ITEM))
                    continue;

                if (v->faction == f) {
                    mask = (mode >> 3) & (GET_SLACK | GET_RESERVE);
                }
                else if (alliedunit(v, f, HELP_MONEY))
Exemplo n.º 3
0
int main(int argc, char **argv)
{
	log_options_t opts = LOG_OPTS_STDERR_ONLY;
	node_info_msg_t *node_info_ptr = NULL;
	node_info_msg_t *new_node_ptr = NULL;
	int error_code;
	int height = 40;
	int width = 100;
	int startx = 0;
	int starty = 0;
	int end = 0;
	int i;
	int rc;

	slurm_conf_init(NULL);
	log_init(xbasename(argv[0]), opts, SYSLOG_FACILITY_DAEMON, NULL);
	parse_command_line(argc, argv);
	if (params.verbose) {
		opts.stderr_level += params.verbose;
		log_alter(opts, SYSLOG_FACILITY_USER, NULL);
	}

	if (params.cluster_dims == 4) {
		min_screen_width = 92;
	} else if (params.cluster_dims == 3)
		min_screen_width = 92;

	/* no need for this if you are resolving */
	while (slurm_load_node((time_t) NULL,
			       &new_node_ptr, SHOW_ALL)) {
		if (params.resolve || (params.display == COMMANDS)) {
			new_node_ptr = NULL;
			break;		/* just continue */
		}
		error_code = slurm_get_errno();
		printf("slurm_load_node: %s\n",
		       slurm_strerror(error_code));
		if (params.iterate == 0)
			exit(1);
		sleep(10);	/* keep trying to reconnect */
	}

	select_g_ba_init(new_node_ptr, 0);

	if (dim_size == NULL) {
		dim_size = get_cluster_dims(new_node_ptr);
		if ((dim_size == NULL) || (dim_size[0] < 1))
			fatal("Invalid system dimensions");
	}
	_init_colors();

	if (params.resolve) {
		char *ret_str = resolve_mp(params.resolve, new_node_ptr);
		if (ret_str) {
			printf("%s", ret_str);
			xfree(ret_str);
		}
		_smap_exit(0);	/* Calls exit(), no return */
	}
	if (!params.commandline) {
		int check_width = min_screen_width;

		initscr();
		init_grid(new_node_ptr, COLS);
		signal(SIGWINCH, (void (*)(int))_resize_handler);

		if (params.cluster_dims == 4) {
			height = dim_size[2] * dim_size[3] + dim_size[2] + 3;
			width = (dim_size[1] + dim_size[3] + 1) * dim_size[0]
				 + 2;
			check_width += width;
		} else if (params.cluster_dims == 3) {
			height = dim_size[1] * dim_size[2] + dim_size[1] + 3;
			width = dim_size[0] + dim_size[2] + 3;
			check_width += width;
		} else {
			height = 10;
			width = COLS;
		}

	        if ((COLS < check_width) || (LINES < height)) {
			endwin();
			error("Screen is too small make sure the screen "
			      "is at least %dx%d\n"
			      "Right now it is %dx%d\n",
			      check_width,
			      height,
			      COLS,
			      LINES);
			_smap_exit(1);	/* Calls exit(), no return */
		}

		raw();
		keypad(stdscr, true);
		noecho();
		cbreak();
		curs_set(0);
		nodelay(stdscr, true);
		start_color();
		_set_pairs();

		grid_win = newwin(height, width, starty, startx);
		max_display = (getmaxy(grid_win) - 1) * (getmaxx(grid_win) - 1);

		if (params.cluster_dims == 4) {
			startx = width;
			width = COLS - width - 2;
			height = LINES;
		} else if (params.cluster_dims == 3) {
			startx = width;
			width = COLS - width - 2;
			height = LINES;
		} else {
			startx = 0;
			starty = height;
			height = LINES - height;
		}

		text_win = newwin(height, width, starty, startx);
        }
	while (!end) {
		if (!params.commandline) {
			_get_option();
redraw:
			clear_window(text_win);
			clear_window(grid_win);
			move(0, 0);

			update_grid(new_node_ptr);
			main_xcord = 1;
			main_ycord = 1;
		}

		if (!params.no_header)
			print_date();

		clear_grid();
		switch (params.display) {
		case JOBS:
			get_job();
			break;
		case RESERVATIONS:
			get_reservation();
			break;
		case SLURMPART:
			get_slurm_part();
			break;
		case COMMANDS:
#ifdef HAVE_BG
			wclear(text_win);
			get_command();
#else
			error("Must be on a real BG SYSTEM to "
			      "run this command");
			if (!params.commandline)
				endwin();
			_smap_exit(1);	/* Calls exit(), no return */
#endif
			break;
		case BGPART:
			if (params.cluster_flags & CLUSTER_FLAG_BG)
				get_bg_part();
			else {
				error("Must be on a BG SYSTEM to "
				      "run this command");
				if (!params.commandline)
					endwin();
				_smap_exit(1);	/* Calls exit(), no return */
			}
			break;
		}

		if (!params.commandline) {
			box(text_win, 0, 0);
			wnoutrefresh(text_win);

			print_grid();
			box(grid_win, 0, 0);
			wnoutrefresh(grid_win);

			doupdate();

			node_info_ptr = new_node_ptr;
			if (node_info_ptr) {
				error_code = slurm_load_node(
					node_info_ptr->last_update,
					&new_node_ptr, SHOW_ALL);
				if (error_code == SLURM_SUCCESS)
					slurm_free_node_info_msg(
						node_info_ptr);
				else if (slurm_get_errno()
					 == SLURM_NO_CHANGE_IN_DATA) {
					error_code = SLURM_SUCCESS;
					new_node_ptr = node_info_ptr;
				}
			} else {
				error_code = slurm_load_node(
					(time_t) NULL,
					&new_node_ptr, SHOW_ALL);
			}
			if (error_code && (quiet_flag != 1)) {
				if (!params.commandline) {
					mvwprintw(
						text_win,
						main_ycord,
						1,
						"slurm_load_node: %s",
						slurm_strerror(
							slurm_get_errno()));
					main_ycord++;
				} else {
					printf("slurm_load_node: %s",
					       slurm_strerror(
						       slurm_get_errno()));
				}
			}
		}

		if (params.iterate) {
			for (i = 0; i < params.iterate; i++) {
				sleep(1);
				if (!params.commandline) {
					if ((rc = _get_option()) == 1)
						goto redraw;
					else if (resize_screen) {
						resize_screen = 0;
						goto redraw;
					}
				}
			}
		} else
			break;

	}

	if (!params.commandline) {
		nodelay(stdscr, false);
		getch();
		endwin();
	}

	_smap_exit(0);	/* Calls exit(), no return */
	exit(0);	/* Redundant, but eliminates compiler warning */
}
Exemplo n.º 4
0
static void *_resize_handler(int sig)
{
	int startx = 0, starty = 0;
	int height = 40, width = 100;
	int check_width = min_screen_width;
	main_ycord = 1;

	/* clear existing data and update to avoid ghost during resize */
	clear_window(text_win);
	clear_window(grid_win);
	doupdate();
	delwin(grid_win);
	delwin(text_win);

	endwin();
	initscr();
	doupdate();	/* update now to make sure we get the new size */

	if (params.cluster_dims == 4) {
		height = dim_size[2] * dim_size[3] + dim_size[2] + 3;
		width = (dim_size[1] + dim_size[3] + 1) * dim_size[0];
		check_width += width;
	} else if (params.cluster_dims == 3) {
		height = dim_size[1] * dim_size[2] + dim_size[1] + 3;
		width = dim_size[0] + dim_size[2] + 3;
		check_width += width;
	} else {
		height = 10;
		width = COLS;
	}

	if (COLS < check_width || LINES < height) {
		endwin();
		error("Screen is too small make sure "
		      "the screen is at least %dx%d\n"
		      "Right now it is %dx%d\n", width, height, COLS, LINES);
		_smap_exit(0);	/* Calls exit(), no return */
	}

	grid_win = newwin(height, width, starty, startx);
	max_display = (getmaxy(grid_win) - 1) * (getmaxx(grid_win) - 1);

	if (params.cluster_dims == 4) {
		startx = width;
		width = COLS - width - 2;
		height = LINES;
	} else if (params.cluster_dims == 3) {
		startx = width;
		width = COLS - width - 2;
		height = LINES;
	} else {
		startx = 0;
		starty = height;
		height = LINES - height;
	}

	text_win = newwin(height, width, starty, startx);

	print_date();
	switch (params.display) {
	case JOBS:
		get_job();
		break;
	case RESERVATIONS:
		get_reservation();
		break;
	case SLURMPART:
		get_slurm_part();
		break;
	case COMMANDS:
#ifdef HAVE_BG
		get_command();
#endif
		break;
	case BGPART:
		if (params.cluster_flags & CLUSTER_FLAG_BG)
			get_bg_part();
		break;
	}

	print_grid();
	box(text_win, 0, 0);
	box(grid_win, 0, 0);
	wnoutrefresh(text_win);
	wnoutrefresh(grid_win);
	doupdate();
	resize_screen = 1;
	return NULL;
}
// Entry point of track-server
void track_server_entry() {

	RegisterAs(TRACK_SERVER);

	// Initialize the track
	track_init();

	// Initialize the reservation list
	reservation_init(train_reservations);

	// So we can update our own cached copy of the switch table
	int switch_courier_tid = CreateSwitchCourier(PRIORITY_HIGHEST - 1);

	int sender_tid;

	// Message buffer large enough to hold the largest message request
	char message_buffer[32];
	while (1) {
		Receive(&sender_tid, message_buffer, sizeof(message_buffer));

		if (sender_tid == switch_courier_tid) {
			// This is an update from the switch server, record the switch that changed
			// so that our cached table of switches is in sync
			int reply = 0;
			Reply(sender_tid, (char*)&reply, sizeof(reply));
			struct switch_report* report = (struct switch_report*)message_buffer;
			switch_table[(int)report->sw] = report->direction;
		} else {
			// API requests to the track_server

			struct track_reply_message reply = {-1, -1};
			int op = *(int*)message_buffer;

			switch(op) {

				// Handle track reservation requests
				case TRACK_OP_RESERVATION: {
					int reply = -1;
					struct reservation_request_message* reservation_msg = (struct reservation_request_message*)message_buffer;

					// Make the location be a sensor and positive offset that fits in the edge
					if (normalize_location(track, switch_table, &reservation_msg->position) != -1) {
						// Check if we can reserve this space for the train
						int status = reservation_verify(reservation_msg->train, &(reservation_msg->position), reservation_msg->length, reservation_msg->branch_safety);
						reply = status;

						if (status == 0) {
							// We succeeded. Reserve the track

							// Find the train's reservation_node
							struct reservation_node* train_r = get_reservation(train_reservations, reservation_msg->train);
							if (train_r != 0) {
								clear_train_reservations(train_r);

								// Add new reservation
								reservation_insert(train_r,
												&(reservation_msg->position),
												reservation_msg->length,
												reservation_msg->branch_safety);
							}
						} else if (status == -2) {
							// Reached max reservation
						}
					} else {
						Printf("Could not normalize\r");
					}

					Reply(sender_tid, (char*)&reply, sizeof(reply));
				} break;

				case TRACK_OP_RESERVATION_STRING: {
					struct reservation_request_message* reservation_msg = (struct reservation_request_message*)message_buffer;
					struct reservation_node* train_r = get_reservation(train_reservations, reservation_msg->train);

					char buf[300];
					*buf = 0; // null termination character
					int len = 0;
					if (train_r != 0) {
						len = reservation_print(train_r, buf);
					}

					Reply(sender_tid, (char*)buf, len); // +1 for null termination char
				} break;

				case TRACK_OP_NODE_IS_RESERVED: {

					struct reservation_request_message* reservation_msg = (struct reservation_request_message*)message_buffer;
					int reserved = node_is_reserved(reservation_msg->train, reservation_msg->position.node);

					Reply(sender_tid, (char*)&reserved, sizeof(reserved));
				} break;

				// Handle requests for calculating the distance between 2 nodes
				case TRACK_OP_TRACK_DISTANCE: {
					struct track_request_message* track_msg = (struct track_request_message*)message_buffer;
					if (track_msg->node1 < TRACK_MAX && track_msg->node2 < TRACK_MAX) {
						reply.distance = dist_between_nodes(track_msg->node1, track_msg->node2);
					}

					Reply(sender_tid, (char*)&reply, sizeof(reply));
				} break;

				case TRACK_OP_TRACK_DISTANCE_UNTIL_GOAL: {
					struct track_request_message* track_msg = (struct track_request_message*)message_buffer;
					int distance = 0;
					if (track_msg->node1 < TRACK_MAX && track_msg->node2 < TRACK_MAX) {
						distance = dist_until_goal(track_msg->node1, track_msg->offset1, track_msg->node2, track_msg->offset2, track_msg->distance);
					}

					Reply(sender_tid, (char*)&distance, sizeof(distance));
				} break;

				// Handle requests for getting the next sensor on the track
				case TRACK_OP_TRACK_NEXT_SENSOR: {
					struct track_request_message* track_msg = (struct track_request_message*)message_buffer;
					if (track_msg->node1 >= A1 && track_msg->node1 <= E16) {
						int distance;
						int next_sensor = next_sensor_node(track_msg->node1, track_msg->node2, &distance);

						reply.node = next_sensor;
						reply.distance = distance;
					}

					Reply(sender_tid, (char*)&reply, sizeof(reply));
				} break;

				case TRACK_OP_NORMALIZE: {
					struct track_request_message *msg = (struct track_request_message*)message_buffer;

					struct location loc;
					loc.node = msg->node1;
					loc.offset = msg->offset1;
					if (normalize_location(track, switch_table, &loc) == -1) {
						Reply(sender_tid, (char*)&loc, 0); // reply size 0 means error!
					}

					Reply(sender_tid, (char*)&loc, sizeof(loc));
				} break;

				// Handle requests for getting the reverse node of a given node
				case TRACK_OP_TRACK_REVERSE_NODE: {
					struct track_request_message* track_msg = (struct track_request_message*)message_buffer;
					if (track_msg->node1 < TRACK_MAX) {
						reply.node = track[track_msg->node1].reverse->num;
					}

					Reply(sender_tid, (char*)&reply, sizeof(reply));
				} break;

				case TRACK_OP_ROUTE: {
					struct track_request_message* track_msg = (struct track_request_message*)message_buffer;
					int train = track_msg->train;
					int start_node_num = track_msg->node1;
					int end_node_num = track_msg->node2;

					short path[TRACK_MAX];
					int num_nodes = 0;

					if (IS_SENSOR(start_node_num) && IS_SENSOR(end_node_num)) {
						struct track_node *start_node = &track[start_node_num];
						struct track_node *end_node = &track[end_node_num];
						mark_path(train, track, start_node, end_node);

						if (end_node->routing_info.visited == 1) {
							// we have a path!
							// store all nodes, from bottom up
							struct track_node *cur_node = end_node;
							struct location loc;
							while (cur_node->routing_info.previous != 0 && cur_node != start_node) {
								node_to_location(cur_node, &loc);
								path[num_nodes] = loc.node;
								num_nodes++;

								if (cur_node->routing_info.previous == cur_node->reverse) {
									// the next node is the reverse of this node, so we squeeze in a "REVERSE" in the path
									path[num_nodes] = -99; // magic number for REVERSE commands
									num_nodes++;
								}

								cur_node = cur_node->routing_info.previous;
							}

							// we didn't store the beginning node in our path, so we should do that now
							if (cur_node == start_node) {
								node_to_location(start_node, &loc);
								path[num_nodes] = loc.node;
								num_nodes++;
							}

						} else {
							Printf("Could not find route! num_nodes = %d\r", num_nodes);
						}

					}

					Reply(sender_tid, (char*)path, sizeof(short) * num_nodes);
				} break;

				case TRACK_OP_SWITCH_DIRECTION: {

					struct track_request_message* track_msg = (struct track_request_message*)message_buffer;

					int switch_node = track_msg->node1;
					int next_node = track_msg->node2;

					AssertF(track[switch_node].type == NODE_BRANCH, "TrackSwitchDirection not given a switch node! Given node num %d, type %d", track[switch_node].num, track[switch_node].type);

					int reserved = node_is_reserved(track_msg->train, switch_node);

					if (reserved) {
//						Printf("Attempting to switch %s if reserved .. \r", track[switch_node].name);
						int direction = -1;


						if (track[switch_node].edge[DIR_CURVED].dest == &(track[next_node])) {
							direction = SWITCH_CURVED;
						} else {
							direction = SWITCH_STRAIGHT;
						}

						SwitchSetDirection(track[switch_node].num, direction, WhoIs(SWITCH_SERVER));
						switch_table[track[switch_node].num] = direction;
					}

					Reply(sender_tid, (char*)&reserved, sizeof(reserved));
				} break;

				default:
					AssertF(0, "Invalid message %d to the track server from %d", op, sender_tid);
					Reply(sender_tid, (char*)&reply, sizeof(reply));
					break;
			}
		}
	}
	Assert("Track server is quitting");
	Exit();
}
Exemplo n.º 6
0
Arquivo: smap.c Projeto: VURM/slurm
int main(int argc, char *argv[])
{
	log_options_t opts = LOG_OPTS_STDERR_ONLY;
	node_info_msg_t *node_info_ptr = NULL;
	node_info_msg_t *new_node_ptr = NULL;
	int error_code;
	int height = 40;
	int width = 100;
	int startx = 0;
	int starty = 0;
	int end = 0;
	int i;
	int rc;
	int mapset = 0;

	log_init(xbasename(argv[0]), opts, SYSLOG_FACILITY_DAEMON, NULL);
	parse_command_line(argc, argv);
	if (params.verbose) {
		opts.stderr_level += params.verbose;
		log_alter(opts, SYSLOG_FACILITY_USER, NULL);
	}

	if (params.cluster_dims == 4) {
		min_screen_width = 92;
	} else if (params.cluster_dims == 3)
		min_screen_width = 92;

	while (slurm_load_node((time_t) NULL, &new_node_ptr, SHOW_ALL)) {
		error_code = slurm_get_errno();
		printf("slurm_load_node: %s\n", slurm_strerror(error_code));
		if (params.display == COMMANDS) {
			new_node_ptr = NULL;
			break;		/* just continue */
		}
		if (params.iterate == 0)
			_smap_exit(1);	/* Calls exit(), no return */
		sleep(10);	/* keep trying to reconnect */
	}

	_init_colors();
	select_g_ba_init(new_node_ptr, 0);
	init_grid(new_node_ptr);

	if (params.resolve) {
#if defined HAVE_BG_FILES && defined HAVE_BG_L_P
#if 1
		error("this doesn't work in the current 2.3 code. FIXME");
#else
		if (!have_db2) {
			printf("Required libraries can not be found "
			       "to access the Bluegene system.\nPlease "
			       "set your LD_LIBRARY_PATH correctly to "
			       "point to them.\n");
			goto part_fini;
		}

		if (!mapset)
			mapset = 1;
		if (params.resolve[0] != 'R') {
			i = strlen(params.resolve);
			i -= 3;
			if (i < 0) {
				printf("No real block was entered\n");
				goto part_fini;
			}
			char *rack_mid = find_bp_rack_mid(params.resolve+i);
			if (rack_mid) {
				printf("X=%c Y=%c Z=%c resolves to %s\n",
				       params.resolve[0+i],
				       params.resolve[1+i],
				       params.resolve[2+i],
				       rack_mid);
			} else {
				printf("X=%c Y=%c Z=%c has no resolve\n",
				       params.resolve[0+i],
				       params.resolve[1+i],
				       params.resolve[2+i]);
			}
		} else {
			uint16_t *coord = find_bp_loc(params.resolve);
			if (coord) {
				printf("%s resolves to X=%d Y=%d Z=%d\n",
				       params.resolve,
				       coord[0], coord[1], coord[2]);
			} else {
				printf("%s has no resolve.\n",
				       params.resolve);
			}
		}
part_fini:
#endif
#else
		printf("Must be physically on a BlueGene system for support "
		       "of resolve option.\n");
#endif
		_smap_exit(0);	/* Calls exit(), no return */
	}
	if (!params.commandline) {
		int check_width = min_screen_width;
		signal(SIGWINCH, (void (*)(int))_resize_handler);
		initscr();

		if (params.cluster_dims == 4) {
			height = dim_size[2] * dim_size[3] + dim_size[2] + 3;
			width = (dim_size[1] + dim_size[3] + 1) * dim_size[0]
				 + 2;
			check_width += width;
		} else if (params.cluster_dims == 3) {
			height = dim_size[1] * dim_size[2] + dim_size[1] + 3;
			width = dim_size[0] + dim_size[2] + 3;
			check_width += width;
		} else {
			height = 10;
			width = COLS;
		}

	        if ((COLS < check_width) || (LINES < height)) {
			endwin();
			error("Screen is too small make sure the screen "
			      "is at least %dx%d\n"
			      "Right now it is %dx%d\n",
			      check_width,
			      height,
			      COLS,
			      LINES);
			_smap_exit(1);	/* Calls exit(), no return */
		}

		raw();
		keypad(stdscr, TRUE);
		noecho();
		cbreak();
		curs_set(0);
		nodelay(stdscr, TRUE);
		start_color();
		_set_pairs();

		grid_win = newwin(height, width, starty, startx);
		max_display = grid_win->_maxy * grid_win->_maxx;

		if (params.cluster_dims == 4) {
			startx = width;
			COLS -= 2;
			width = COLS - width;
			height = LINES;
		} else if (params.cluster_dims == 3) {
			startx = width;
			COLS -= 2;
			width = COLS - width;
			height = LINES;
		} else {
			startx = 0;
			starty = height;
			height = LINES - height;
		}

		text_win = newwin(height, width, starty, startx);
        }
	while (!end) {
		if (!params.commandline) {
			_get_option();
redraw:
			clear_window(text_win);
			clear_window(grid_win);
			move(0, 0);

			main_xcord = 1;
			main_ycord = 1;
		}

		if (!params.no_header)
			print_date();

		clear_grid();
		switch (params.display) {
		case JOBS:
			get_job();
			break;
		case RESERVATIONS:
			get_reservation();
			break;
		case SLURMPART:
			get_slurm_part();
			break;
		case COMMANDS:
			if (params.cluster_flags & CLUSTER_FLAG_BG) {
				if (!mapset) {
					mapset = 1;
					wclear(text_win);
				}
				get_command();
			} else {
				error("Must be on a BG SYSTEM to "
				      "run this command");
				if (!params.commandline)
					endwin();
				_smap_exit(1);	/* Calls exit(), no return */
			}
			break;
		case BGPART:
			if (params.cluster_flags & CLUSTER_FLAG_BG)
				get_bg_part();
			else {
				error("Must be on a BG SYSTEM to "
				      "run this command");
				if (!params.commandline)
					endwin();
				_smap_exit(1);	/* Calls exit(), no return */
			}
			break;
		}

		if (!params.commandline) {
			box(text_win, 0, 0);
			wnoutrefresh(text_win);

			print_grid();
			box(grid_win, 0, 0);
			wnoutrefresh(grid_win);

			doupdate();

			node_info_ptr = new_node_ptr;
			if (node_info_ptr) {
				error_code = slurm_load_node(
					node_info_ptr->last_update,
					&new_node_ptr, SHOW_ALL);
				if (error_code == SLURM_SUCCESS)
					slurm_free_node_info_msg(
						node_info_ptr);
				else if (slurm_get_errno()
					 == SLURM_NO_CHANGE_IN_DATA) {
					error_code = SLURM_SUCCESS;
					new_node_ptr = node_info_ptr;
				}
			} else {
				error_code = slurm_load_node(
					(time_t) NULL,
					&new_node_ptr, SHOW_ALL);
			}
			if (error_code && (quiet_flag != 1)) {
				if (!params.commandline) {
					mvwprintw(
						text_win,
						main_ycord,
						1,
						"slurm_load_node: %s",
						slurm_strerror(
							slurm_get_errno()));
					main_ycord++;
				} else {
					printf("slurm_load_node: %s",
					       slurm_strerror(
						       slurm_get_errno()));
				}
			}
		}

		if (params.iterate) {
			for (i = 0; i < params.iterate; i++) {
				sleep(1);
				if (!params.commandline) {
					if ((rc = _get_option()) == 1)
						goto redraw;
					else if (resize_screen) {
						resize_screen = 0;
						goto redraw;
					}
				}
			}
		} else
			break;

	}

	if (!params.commandline) {
		nodelay(stdscr, FALSE);
		getch();
		endwin();
	}

	_smap_exit(0);	/* Calls exit(), no return */
	exit(0);	/* Redundant, but eliminates compiler warning */
}