示例#1
0
void
main_shutdown_graceful()
{
	dprintf( D_ALWAYS, "shutdown graceful\n" );

		// Shut down the cron logic
	if( cron_job_mgr ) {
		cron_job_mgr->Shutdown( false );
	}

		// Shut down the benchmark logic
	if( bench_job_mgr ) {
		bench_job_mgr->Shutdown( false );
	}

		// If the machine is free, we can just exit right away.
	startd_check_free();

		// Remember that we're in shutdown-mode so we will refuse
		// various commands. 
	resmgr->markShutdown();

	daemonCore->Reset_Reaper( main_reaper, "shutdown_reaper", 
								 (ReaperHandler)shutdown_reaper,
								 "shutdown_reaper" );

		// Release all claims, active or not
	resmgr->walk( &Resource::releaseAllClaims );

	daemonCore->Register_Timer( 0, 5, 
								startd_check_free,
								 "startd_check_free" );
}
示例#2
0
int
shutdown_reaper(Service *, int pid, int status)
{
	reaper(NULL,pid,status);
	startd_check_free();
	return TRUE;
}
bool
StartdBenchJobMgr::BenchmarksFinished( void )
{
	m_rip->benchmarks_finished( );
	resmgr->update_all();
	if ( m_shutting_down ) {
		startd_check_free();
	}
	else if ( NULL != cron_job_mgr ) {
		cron_job_mgr->ScheduleAllJobs();
	}
	return true;
}
示例#4
0
int
do_cleanup(int,int,const char*)
{
	static int already_excepted = FALSE;

	if ( already_excepted == FALSE ) {
		already_excepted = TRUE;
			// If the machine is already free, we can exit right away.
		startd_check_free();		
			// Otherwise, quickly kill all the active starters.
		resmgr->walk( &Resource::void_kill_claim );
		dprintf( D_FAILURE|D_ALWAYS, "startd exiting because of fatal exception.\n" );
	}

	return TRUE;
}
示例#5
0
void PREFAST_NORETURN
startd_exit() 
{
	// Shut down the cron logic
	if( cron_job_mgr ) {
		dprintf( D_ALWAYS, "Deleting cron job manager\n" );
		cron_job_mgr->Shutdown( true );
		delete cron_job_mgr;
	}

	// Shut down the benchmark job manager
	if( bench_job_mgr ) {
		dprintf( D_ALWAYS, "Deleting benchmark job mgr\n" );
		bench_job_mgr->Shutdown( true );
		delete bench_job_mgr;
	}

	// Cleanup the resource manager
	if ( resmgr ) {
#if HAVE_HIBERNATION
		// don't want the final update, since it will overwrite 
		// our off-line ad
		if ( !resmgr->hibernating () ) {
#else
		if ( true ) {
#endif /* HAVE_HIBERNATION */
			dprintf( D_FULLDEBUG, "About to send final update to the central manager\n" );	
			resmgr->final_update();
			if ( resmgr->m_attr ) {
				resmgr->m_attr->final_idle_dprintf();
			}
		}
		
			// clean-up stale claim-id files
		int i;
		char* filename;
		for( i = 0; i <= resmgr->numSlots(); i++ ) { 
			filename = startdClaimIdFile( i );
			if (unlink(filename) < 0) {
				dprintf( D_FULLDEBUG, "startd_exit: Failed to remove file '%s'\n", filename );
			}
			free( filename );
			filename = NULL;
		}

		delete resmgr;
		resmgr = NULL;
	}

#ifdef WIN32
	systray_notifier.notifyCondorOff();
#endif

#if defined(WANT_CONTRIB) && defined(WITH_MANAGEMENT)
#if defined(HAVE_DLOPEN) || defined(WIN32)
	StartdPluginManager::Shutdown();
#endif
#endif

	dprintf( D_ALWAYS, "All resources are free, exiting.\n" );
	DC_Exit(0);
}

void
main_shutdown_fast()
{
	dprintf( D_ALWAYS, "shutdown fast\n" );

		// Shut down the cron logic
	if( cron_job_mgr ) {
		cron_job_mgr->Shutdown( true );
	}

		// Shut down the benchmark logic
	if( bench_job_mgr ) {
		bench_job_mgr->Shutdown( true );
	}

		// If the machine is free, we can just exit right away.
	startd_check_free();

		// Remember that we're in shutdown-mode so we will refuse
		// various commands. 
	resmgr->markShutdown();

	daemonCore->Reset_Reaper( main_reaper, "shutdown_reaper", 
								 (ReaperHandler)shutdown_reaper,
								 "shutdown_reaper" );

		// Quickly kill all the starters that are running
	resmgr->walk( &Resource::killAllClaims );

	daemonCore->Register_Timer( 0, 5, 
								startd_check_free,
								 "startd_check_free" );
}