Ejemplo n.º 1
0
/* returns 1 if job and nodes are ready for job to begin, 0 otherwise */
static int _wait_part_ready(uint32_t job_id)
{
	int is_ready = 0, i, rc;

	max_delay = BG_FREE_PREVIOUS_BLOCK + BG_MIN_BLOCK_BOOT +
		(BG_INCR_BLOCK_BOOT * _get_job_size(job_id));

#if _DEBUG
	printf("Waiting for job %u to become ready.", job_id);
#endif

	for (i=0; (cur_delay < max_delay); i++) {
		if (i) {
			sleep(POLL_SLEEP);
			rc = _partitions_dealloc();
			if ((rc == 0) || (rc == -1))
				cur_delay += POLL_SLEEP;
#if _DEBUG
			printf(".");
#endif
		}

		rc = slurm_job_node_ready(job_id);
		if (rc == READY_JOB_FATAL)
			break;				/* fatal error */
		if (rc == READY_JOB_ERROR)		/* error */
			continue;			/* retry */
		if ((rc & READY_JOB_STATE) == 0) {	/* job killed */
			/* return 1 so we don't get a prolog error */
			is_ready = 1;
			break;
		}
		if (rc & READY_NODE_STATE) {		/* job and node ready */
			is_ready = 1;
			break;
		}
	}

#if _DEBUG
	if (is_ready == 0)
		printf("\n");
	else
     		printf("\nJob %u is ready.\n", job_id);
#endif
	if (is_ready == 0)
		fprintf(stderr, "Job %u is not ready.\n", job_id);
	return is_ready;
}
Ejemplo n.º 2
0
static void _wait_part_not_ready(uint32_t job_id)
{
	int is_ready = 1, i, rc;

	max_delay = MIN_DELAY + (INCR_DELAY * _get_job_size(job_id));

#if _DEBUG
	printf("Waiting for job %u to be not ready.", job_id);
#endif

	for (i=0; (cur_delay < max_delay); i++) {
		if (i) {
			sleep(POLL_SLEEP);
			cur_delay += POLL_SLEEP;
#if _DEBUG
			printf(".");
#endif
		}

		rc = slurm_job_node_ready(job_id);
		if (rc == READY_JOB_FATAL)
			break;				/* fatal error */
		if (rc == READY_JOB_ERROR)		/* error */
			continue;			/* retry */
		if ((rc & READY_NODE_STATE) == 0) {
			is_ready = 0;
			break;
		}
	}

#if _DEBUG
	if (is_ready == 1)
		printf("\n");
	else
     		printf("\nJob %u is not ready.\n", job_id);
#endif
	if (is_ready == 1)
		fprintf(stderr, "Job %u is still ready.\n", job_id);

}