/* Function   : finalizeDelta
 * Description: clears and resets all inner structures and data members declared
 *				in this class only (excluding inherited classes)
 */
void
ReplicatorStateMachine::finalizeDelta( )
{
    ClassAd invalidate_ad;
    MyString line;

    dprintf( D_ALWAYS, "ReplicatorStateMachine::finalizeDelta started\n" );
    utilCancelTimer(m_replicationTimerId);
    utilCancelTimer(m_versionRequestingTimerId);
    utilCancelTimer(m_versionDownloadingTimerId);
    utilCancelTimer(m_updateCollectorTimerId);
    m_replicationInterval               = -1;
    m_hadAliveTolerance                 = -1;
    m_maxTransfererLifeTime             = -1;
    m_newlyJoinedWaitingVersionInterval = -1;
    m_lastHadAliveTime                  = -1;
    m_updateInterval                    = -1;

    if ( m_classAd != NULL ) {
        delete m_classAd;
        m_classAd = NULL;
    }

    SetMyTypeName( invalidate_ad, QUERY_ADTYPE );
    SetTargetTypeName( invalidate_ad, "Replication" );
    line.formatstr( "TARGET.%s == \"%s\"", ATTR_NAME, m_name.Value( ) );
    invalidate_ad.AssignExpr( ATTR_REQUIREMENTS, line.Value( ) );
	invalidate_ad.Assign( ATTR_NAME, m_name.Value() );
    daemonCore->sendUpdates( INVALIDATE_ADS_GENERIC, &invalidate_ad, NULL, false );
}
Ejemplo n.º 2
0
static void
serialize_input( void )
{

	char sinful[16 + 10];
	int  found_eof		= 0,
		 found_error	= 0,
		 empty			= 0;

	/**	Determine if we are using the command-line options, a file,
		or standard input as input */
	if ( !stdio ) {

		/**	Contrive a sinful string based on our IP address */
		sprintf ( sinful, "<255.255.255.255:1234>" );

		/**	We were give all the raw data, so we're going to create
			a fake machine ad that we will use when invoking the waking
			mechanism */
		ad = new ClassAd ();
		SetMyTypeName ( *ad, STARTD_ADTYPE );
		SetTargetTypeName ( *ad, JOB_ADTYPE );
		ad->Assign ( ATTR_HARDWARE_ADDRESS, mac );
		ad->Assign ( ATTR_SUBNET_MASK, mask );
		ad->Assign ( ATTR_MY_ADDRESS, sinful );
		ad->Assign ( ATTR_WOL_PORT, port );

	} else {

		/**	Open the machine ad file or read it from stdin */
		if ( fn_in && *fn_in ) {
			in = safe_fopen_wrapper ( fn_in, "r" );
		} else {
			in = stdin;
			fn_in = "<stdin>";
		}

		if ( !in ) {
			error ( E_FOPEN, fn_in, strerror ( errno ), errno );
		}

		/**	Serialize the machine ad from a file */
		ad = new ClassAd (
			in,
			"?$#%^&*@", /* sufficiently random garbage? */
			found_eof,
			found_error,
			empty );

		if ( found_error ) {
			error (
				E_CLASSAD,
				found_error );
		}

	}

}
Ejemplo n.º 3
0
void
Defrag::invalidatePublicAd() {
	ClassAd invalidate_ad;
	std::string line;

	SetMyTypeName(invalidate_ad, QUERY_ADTYPE);
	SetTargetTypeName(invalidate_ad, "Defrag");

	formatstr(line,"%s == \"%s\"", ATTR_NAME, m_daemon_name.c_str());
	invalidate_ad.AssignExpr(ATTR_REQUIREMENTS, line.c_str());
	invalidate_ad.Assign(ATTR_NAME, m_daemon_name.c_str());
	daemonCore->sendUpdates(INVALIDATE_ADS_GENERIC, &invalidate_ad, NULL, false);
}
Ejemplo n.º 4
0
void
Defrag::publish(ClassAd *ad)
{
	char *valid_name = build_valid_daemon_name(m_defrag_name.c_str());
	ASSERT( valid_name );
	m_daemon_name = valid_name;
	delete [] valid_name;

	SetMyTypeName(*ad, "Defrag");
	SetTargetTypeName(*ad, "");

	ad->Assign(ATTR_NAME,m_daemon_name.c_str());

	m_stats.Tick();
	m_stats.Publish(*ad);
	daemonCore->publish(ad);
}
Ejemplo n.º 5
0
void
DBMSManager::InitPublicAd() {
    m_public_ad = ClassAd();

    //TODO: this is the wrong ADTYPE.
    //Use the new generic ad type when it becomes available.
    //Until then, actual writes to the collector are disabled,
    //because it conflicts with the schedd on the same host..

    SetMyTypeName( m_public_ad, DBMSD_ADTYPE );
    SetTargetTypeName( m_public_ad, "" );

    m_public_ad.Assign(ATTR_MACHINE,get_local_fqdn());
    m_public_ad.Assign(ATTR_NAME,m_name.Value());

    config_fill_ad( &m_public_ad );
}
Ejemplo n.º 6
0
int
LogNewClassAd::Play(void *data_structure)
{
	int result;
	ClassAdHashTable *table = (ClassAdHashTable *)data_structure;
	ClassAd	*ad = new ClassAd();
	SetMyTypeName(*ad, mytype);
	SetTargetTypeName(*ad, targettype);
	ad->EnableDirtyTracking();
	result = table->insert(HashKey(key), ad);

#if defined(HAVE_DLOPEN)
	ClassAdLogPluginManager::NewClassAd(key);
#endif

	return result;
}
Ejemplo n.º 7
0
void
DBMSManager::InvalidatePublicAd() {
    ClassAd query_ad;
    SetMyTypeName(query_ad, QUERY_ADTYPE);
    SetTargetTypeName(query_ad, DBMSD_ADTYPE);

    MyString line;
    line.formatstr("%s = TARGET.%s == \"%s\"", ATTR_REQUIREMENTS, ATTR_NAME, m_name.Value());
    query_ad.Insert(line.Value());
    query_ad.Assign(ATTR_NAME,m_name.Value());

    m_collectors->sendUpdates(INVALIDATE_ADS_GENERIC, &query_ad, NULL, true);

    //TODO/FIXME - delete the ads of the databases we're advertising

    return;
}
void
ReplicatorStateMachine::initializeClassAd()
{
    if( m_classAd != NULL) {
        delete m_classAd;
        m_classAd = NULL;
    }

    m_classAd = new ClassAd();

    SetMyTypeName(*m_classAd, "Replication");
    SetTargetTypeName(*m_classAd, "");

    m_name.formatstr( "replication@%s -p %d", get_local_fqdn().Value(),
				  daemonCore->InfoCommandPort( ) );
    m_classAd->Assign( ATTR_NAME, m_name.Value( ) );
    m_classAd->Assign( ATTR_MY_ADDRESS,
					   daemonCore->InfoCommandSinfulString( ) );

    // publish list of replication nodes
    char* buffer = param( "REPLICATION_LIST" );
	if ( NULL == buffer ) {
		EXCEPT( "ReplicatorStateMachine: No replication list!!" );
	}
    char* replAddress = NULL;
    StringList replList;
    MyString attrReplList;
    MyString comma;

    replList.initializeFromString( buffer );
    replList.rewind( );

    while( ( replAddress = replList.next() ) ) {
        attrReplList += comma;
        attrReplList += replAddress;
        comma = ",";
    }
    m_classAd->Assign( ATTR_REPLICATION_LIST, attrReplList.Value( ) );

    // publish DC attributes
    daemonCore->publish(m_classAd);
	free(buffer);
}
Ejemplo n.º 9
0
void
invalidate_ads() {
	ClassAd cmd_ad;
	SetMyTypeName( cmd_ad, QUERY_ADTYPE );
	SetTargetTypeName( cmd_ad, MASTER_ADTYPE );
	
	MyString line;
	std::string escaped_name;
	char* default_name = ::strnewp(MasterName);
	if(!default_name) {
		default_name = default_daemon_name();
	}
	
	EscapeAdStringValue( default_name, escaped_name );
	line.formatstr( "( TARGET.%s == \"%s\" )", ATTR_NAME, escaped_name.c_str() );
	cmd_ad.AssignExpr( ATTR_REQUIREMENTS, line.Value() );
	cmd_ad.Assign( ATTR_NAME, default_name );
	cmd_ad.Assign( ATTR_MY_ADDRESS, daemonCore->publicNetworkIpAddr());
	daemonCore->sendUpdates( INVALIDATE_MASTER_ADS, &cmd_ad, NULL, false );
	delete [] default_name;
}
Ejemplo n.º 10
0
ClassAd * ProcAd::dumpToAd( piPTR pi ) {

  char line[128];
  ClassAd *ad = new ClassAd;

  SetMyTypeName( *ad, "PROCESS_INFORMATION" );
  SetTargetTypeName( *ad, "ENQUIRING_MINDS_WANT_TO_KNOW" );

  sprintf ( line, "THIS_PID = %d", pi->pid );
  ad->Insert(line);
  sprintf ( line, "PARENT_PID = %ld", (long)pi->ppid );
  ad->Insert(line);
  sprintf ( line, "IMAGE_SIZE = %ld", (long)pi->imgsize );
  ad->Insert(line);
  sprintf ( line, "RESIDENT_SET_SIZE = %ld", (long)pi->rssize );
  ad->Insert(line);
#if HAVE_PSS
  if( pi->pssize_available ) {
	  sprintf ( line, "PROPORTIONAL_SET_SIZE = %ld", (long)pi->pssize );
	  ad->Insert(line);
  }
#endif
  sprintf ( line, "MAJOR_PAGE_FAULTS = %ld", (long)pi->majfault );
  ad->Insert(line);
  sprintf ( line, "MINOR_PAGE_FAULTS = %ld", (long)pi->minfault );
  ad->Insert(line);
  sprintf ( line, "USER_TIME = %ld", (long)pi->user_time );
  ad->Insert(line);
  sprintf ( line, "SYSTEM_TIME = %ld", (long)pi->sys_time );
  ad->Insert(line);
  sprintf ( line, "PROCESS_AGE = %ld", (long)pi->age );
  ad->Insert(line);
  sprintf ( line, "PERCENT_CPU_USAGE = %6.2f",  pi->cpuusage );
  ad->Insert(line);

  return ad;
}
Ejemplo n.º 11
0
void
init_classad()
{
	if( ad ) delete( ad );
	ad = new ClassAd();

	SetMyTypeName(*ad, MASTER_ADTYPE);
	SetTargetTypeName(*ad, "");

	if (MasterName) {
		ad->Assign(ATTR_NAME, MasterName);
	} else {
		char* default_name = default_daemon_name();
		if( ! default_name ) {
			EXCEPT( "default_daemon_name() returned NULL" );
		}
		ad->Assign(ATTR_NAME, default_name);
		delete [] default_name;
	}

#if !defined(WIN32)
	ad->Assign(ATTR_REAL_UID, (int)getuid());
#endif
}
Ejemplo n.º 12
0
/*! handle a log Entry: work with a job queue collection.
 *  (not with DBMS directry)
 */
QuillErrCode
JobQueueDBManager::processLogEntry(int op_type, JobQueueCollection* jobQueue)
{
	char *key, *mytype, *targettype, *name, *value;
	key = mytype = targettype = name = value = NULL;
	QuillErrCode st = QUILL_SUCCESS;

	int job_id_type;
	char cid[512];
	char pid[512];

		// REMEMBER:
		//	each get*ClassAdBody() funtion allocates the memory of 
		// 	parameters. Therefore, they all must be deallocated here,
		// and they are at the end of the routine
	switch(op_type) {
	case CondorLogOp_NewClassAd: {
		if (caLogParser->getNewClassAdBody(key, mytype, targettype) == QUILL_FAILURE)
			{
				st = QUILL_FAILURE;
				break;
			}
		job_id_type = getProcClusterIds(key, cid, pid);
		ClassAd* ad = new ClassAd();
		SetMyTypeName(*ad, "Job");
		SetTargetTypeName(*ad, "Machine");

		switch(job_id_type) {
		case IS_CLUSTER_ID:
			jobQueue->insertClusterAd(cid, ad);
			break;

		case IS_PROC_ID:
			jobQueue->insertProcAd(cid, pid, ad);
			break;

		default:
			dprintf(D_ALWAYS, "[QUILL++] New ClassAd --- ERROR\n");
			st = QUILL_FAILURE; 
			break;
		}

		break;
	}
	case CondorLogOp_DestroyClassAd: {
		if (caLogParser->getDestroyClassAdBody(key) == QUILL_FAILURE) {
			st = QUILL_FAILURE; 
			break;		
		}

		job_id_type = getProcClusterIds(key, cid, pid);

		switch(job_id_type) {
		case IS_CLUSTER_ID:
			jobQueue->removeClusterAd(cid);
			break;

		case IS_PROC_ID: {
			ClassAd *clusterad = jobQueue->find(cid);
			ClassAd *procad = jobQueue->find(cid,pid);
			if(!clusterad || !procad) {
			    dprintf(D_ALWAYS, 
						"[QUILL++] Destroy ClassAd --- Cannot find clusterad "
						"or procad in memory job queue");
				st = QUILL_FAILURE; 
				break;
			}

			jobQueue->removeProcAd(cid, pid);
			
			break;
		}
		default:
			dprintf(D_ALWAYS, "[QUILL++] Destroy ClassAd --- ERROR\n");
			st = QUILL_FAILURE; 
			break;
		}

		break;
	}
	case CondorLogOp_SetAttribute: {	
		if (caLogParser->getSetAttributeBody(key, name, value) == QUILL_FAILURE) {
			st = QUILL_FAILURE; 
			break;
		}
						
		job_id_type = getProcClusterIds(key, cid, pid);

		char tmp[512];

		snprintf(tmp, 512, "%s = %s", name, value);

		switch (job_id_type) {
		case IS_CLUSTER_ID: {
			ClassAd* ad = jobQueue->findClusterAd(cid);
			if (ad != NULL) {
				ad->Insert(tmp);
			}
			else {
				dprintf(D_ALWAYS, "[QUILL++] ERROR: There is no such Cluster Ad[%s]\n", cid);
			}
			break;
		}
		case IS_PROC_ID: {
			ClassAd* ad = jobQueue->findProcAd(cid, pid);
			if (ad != NULL) {
				ad->Insert(tmp);
			}
			else {
				dprintf(D_ALWAYS, "[QUILL++] ERROR: There is no such Proc Ad[%s.%s]\n", cid, pid);
			}
			break;
		}
		default:
			dprintf(D_ALWAYS, "[QUILL++] Set Attribute --- ERROR\n");
			st = QUILL_FAILURE; 
			break;
		}
		break;
	}
	case CondorLogOp_DeleteAttribute: {
		if (caLogParser->getDeleteAttributeBody(key, name) == QUILL_FAILURE) {
			st = QUILL_FAILURE; 
			break;
		}

		job_id_type = getProcClusterIds(key, cid, pid);

		switch(job_id_type) {
		case IS_CLUSTER_ID: {
			ClassAd* ad = jobQueue->findClusterAd(cid);
			ad->Delete(name);
			break;
		}
		case IS_PROC_ID: {
			ClassAd* ad = jobQueue->findProcAd(cid, pid);
			ad->Delete(name);
			break;
		}
		default:
			dprintf(D_ALWAYS, "[QUILL++] Delete Attribute --- ERROR\n");
			st = QUILL_FAILURE; 
		}
		break;
	}
	case CondorLogOp_BeginTransaction:
		st = processBeginTransaction(true);
		break;
	case CondorLogOp_EndTransaction:
		st = processEndTransaction(true);
		break;
			// skip the log historical sequence number command
	case CondorLogOp_LogHistoricalSequenceNumber:
		break;
	default:
		printf("[QUILL++] Unsupported Job Queue Command\n");
		st = QUILL_FAILURE; 
		break;
	}

		// pointers are release
	if (key != NULL) free(key);
	if (mytype != NULL) free(mytype);
	if (targettype != NULL) free(targettype);
	if (name != NULL) free(name);
	if (value != NULL) free(value);
	return st;
}
Ejemplo n.º 13
0
void
XferSummary::time_out(time_t now, char *hostaddr)
{
	ClassAd	   	info;
	char		line[128], *tmp;
	char		*str = NULL;

	SetMyTypeName(info, "CkptServer");
	SetTargetTypeName(info, "CkptFile");

	sprintf(line, "%s = \"%s\"", ATTR_NAME, get_local_fqdn().Value());
	info.Insert(line);
    sprintf(line, "%s = \"%s\"", ATTR_MACHINE, hostaddr );
	info.Insert(line);
	sprintf(line, "%s = \"%s\"", ATTR_VERSION, CondorVersion() );
	info.Insert(line);
	sprintf(line, "%s = \"%s\"", ATTR_PLATFORM, CondorPlatform() );
	info.Insert(line);
	sprintf(line, "NumSends = %d", num_sends);
	info.Insert(line);
	sprintf(line, "BytesSent = %d", (int) bytes_sent);
	info.Insert(line);
	sprintf(line, "TimeSending = %d", time_sending);
	info.Insert(line);
	sprintf(line, "AvgSendBandwidth = %f", num_sends ?
			tot_send_bandwidth / num_sends : 0.0);
	info.Insert(line);
	sprintf(line, "NumRecvs = %d", num_recvs);
	info.Insert(line);
	sprintf(line, "BytesReceived = %d", (int) bytes_recv);
	info.Insert(line);
	sprintf(line, "TimeReceiving = %d", time_recving);
	info.Insert(line);
	sprintf(line, "AvgReceiveBandwidth = %f", num_recvs ?
			tot_recv_bandwidth / num_recvs : 0.0);
	info.Insert(line);

	/* ctime adds a newline at the end of the ascii conversion.... */
	str = ctime(&start_time);
	sprintf(line, "CkptServerIntervalStart = \"%s\"", str ? str : "Unknown\n");
	tmp = strchr( line, '\n' );
	if (tmp != NULL) {
		/* delete the newline */
		*tmp = '\"';
		tmp++;
		*tmp = '\0';
	}
	info.Insert(line);

	/* ctime adds a newline at the end of the ascii conversion.... */
	str = ctime(&now);
	sprintf(line, "CkptServerIntervalEnd = \"%s\"", str ? str : "Unknown\n");
	tmp = strchr( line, '\n' );
	if (tmp != NULL) {
		/* delete the newline */
		*tmp = '\"';
		tmp++;
		*tmp = '\0';
	}
	info.Insert(line);

	info.Assign("Disk", sysapi_disk_space(pwd.Value()));
	
	// Send to collector
	if ( Collectors ) {
        dprintf(D_NETWORK, "Sending CkptServer ClassAd:\n");
        dPrintAd(D_NETWORK, info);
		Collectors->sendUpdates (UPDATE_CKPT_SRVR_AD, &info, NULL, true);
	}

	init();
}
Ejemplo n.º 14
0
void
Starter::exited(int status)
{
	ClassAd *jobAd = NULL;
	bool jobAdNeedsFree = true;

	if (s_claim && s_claim->ad()) {
		// real jobs in the startd have claims and job ads, boinc and perhaps others won't
		jobAd = s_claim->ad();
		jobAdNeedsFree = false;
	} else {
		// Dummy up an ad
		int now = (int) time(0);
		jobAd = new ClassAd();
		SetMyTypeName(*jobAd, "Job");
		SetTargetTypeName(*jobAd, "Machine");
		jobAd->Assign(ATTR_CLUSTER_ID, now);
		jobAd->Assign(ATTR_PROC_ID, 1);
		jobAd->Assign(ATTR_OWNER, "boinc");
		jobAd->Assign(ATTR_Q_DATE, (int)s_birthdate);
		jobAd->Assign(ATTR_JOB_PRIO, 0);
		jobAd->Assign(ATTR_IMAGE_SIZE, 0);
		jobAd->Assign(ATTR_JOB_CMD, "boinc");
		MyString gjid;
		gjid.formatstr("%s#%d#%d#%d", get_local_hostname().Value(), 
					 now, 1, now);
		jobAd->Assign(ATTR_GLOBAL_JOB_ID, gjid);
	}

	// First, patch up the ad a little bit 
	jobAd->Assign(ATTR_COMPLETION_DATE, (int)time(0));
	int runtime = time(0) - s_birthdate;
	
	jobAd->Assign(ATTR_JOB_REMOTE_WALL_CLOCK, runtime);
	int jobStatus = COMPLETED;
	if (WIFSIGNALED(status)) {
		jobStatus = REMOVED;
	}

	jobAd->Assign(ATTR_STARTER_EXIT_STATUS, status);
	jobAd->Assign(ATTR_JOB_STATUS, jobStatus);

	if (s_claim) {
		bool badputFromDraining = s_claim->getBadputCausedByDraining();
		jobAd->Assign(ATTR_BADPUT_CAUSED_BY_DRAINING, badputFromDraining);
		bool badputFromPreemption = s_claim->getBadputCausedByPreemption();
		jobAd->Assign(ATTR_BADPUT_CAUSED_BY_PREEMPTION, badputFromPreemption);
	}
	AppendHistory(jobAd);
	WritePerJobHistoryFile(jobAd, true /* use gjid for filename*/);

	if (jobAdNeedsFree) {
		delete jobAd;
	}

		// Make sure our time isn't going to go off.
	cancelKillTimer();

		// Just for good measure, try to kill what's left of our whole
		// pid family.
	if (daemonCore->Kill_Family(s_pid) == FALSE) {
		dprintf(D_ALWAYS,
		        "error killing process family of starter with pid %u\n",
		        s_pid);
	}

		// Now, delete any files lying around.
	ASSERT( executeDir() );
	if ( encryptedExecuteDir() ) {
		// Remove $EXECUTE/encryptedX/dir_pid/*
		cleanup_execute_dir( s_pid, encryptedExecuteDir(), true );
		s_encrypted_execute_dir = "";
	} else {
		// Remove $EXECUTE/dir_pid/*
		cleanup_execute_dir( s_pid, executeDir() );
	}

#if defined(LINUX)
	if( param_boolean( "GLEXEC_STARTER", false ) ) {
		cleanupAfterGlexec();
	}
#endif
}
Ejemplo n.º 15
0
/* Utility function to create a generic job ad. The caller can then fill
 * in the relevant details.
 */
ClassAd *CreateJobAd( const char *owner, int universe, const char *cmd )
{
	ClassAd *job_ad = new ClassAd();

	SetMyTypeName(*job_ad, JOB_ADTYPE);
	SetTargetTypeName(*job_ad, STARTD_ADTYPE);

	if ( owner ) {
		job_ad->Assign( ATTR_OWNER, owner );
	} else {
		job_ad->AssignExpr( ATTR_OWNER, "Undefined" );
	}
	job_ad->Assign( ATTR_JOB_UNIVERSE, universe );
	job_ad->Assign( ATTR_JOB_CMD, cmd );

	job_ad->Assign( ATTR_Q_DATE, (int)time(NULL) );
	job_ad->Assign( ATTR_COMPLETION_DATE, 0 );

	job_ad->Assign( ATTR_JOB_REMOTE_WALL_CLOCK, 0.0 );
	job_ad->Assign( ATTR_JOB_LOCAL_USER_CPU, 0.0 );
	job_ad->Assign( ATTR_JOB_LOCAL_SYS_CPU, 0.0 );
	job_ad->Assign( ATTR_JOB_REMOTE_USER_CPU, 0.0 );
	job_ad->Assign( ATTR_JOB_REMOTE_SYS_CPU, 0.0 );

		// This is a magic cookie, see how condor_submit sets it
	job_ad->Assign( ATTR_CORE_SIZE, -1 );

		// Are these ones really necessary?
	job_ad->Assign( ATTR_JOB_EXIT_STATUS, 0 );
	job_ad->Assign( ATTR_ON_EXIT_BY_SIGNAL, false );

	job_ad->Assign( ATTR_NUM_CKPTS, 0 );
	job_ad->Assign( ATTR_NUM_JOB_STARTS, 0 );
	job_ad->Assign( ATTR_NUM_RESTARTS, 0 );
	job_ad->Assign( ATTR_NUM_SYSTEM_HOLDS, 0 );
	job_ad->Assign( ATTR_JOB_COMMITTED_TIME, 0 );
	job_ad->Assign( ATTR_CUMULATIVE_SLOT_TIME, 0 );
	job_ad->Assign( ATTR_COMMITTED_SLOT_TIME, 0 );
	job_ad->Assign( ATTR_TOTAL_SUSPENSIONS, 0 );
	job_ad->Assign( ATTR_LAST_SUSPENSION_TIME, 0 );
	job_ad->Assign( ATTR_CUMULATIVE_SUSPENSION_TIME, 0 );
	job_ad->Assign( ATTR_COMMITTED_SUSPENSION_TIME, 0 );

	job_ad->Assign( ATTR_JOB_ROOT_DIR, "/" );

	job_ad->Assign( ATTR_MIN_HOSTS, 1 );
	job_ad->Assign( ATTR_MAX_HOSTS, 1 );
	job_ad->Assign( ATTR_CURRENT_HOSTS, 0 );

	job_ad->Assign( ATTR_WANT_REMOTE_SYSCALLS, false );
	job_ad->Assign( ATTR_WANT_CHECKPOINT, false );
	job_ad->Assign( ATTR_WANT_REMOTE_IO, true );

	job_ad->Assign( ATTR_JOB_STATUS, IDLE );
	job_ad->Assign( ATTR_ENTERED_CURRENT_STATUS, (int)time(NULL) );

	job_ad->Assign( ATTR_JOB_PRIO, 0 );
	job_ad->Assign( ATTR_NICE_USER, false );

	job_ad->Assign( ATTR_JOB_NOTIFICATION, NOTIFY_NEVER );

	

	job_ad->Assign( ATTR_IMAGE_SIZE, 100 );

	job_ad->Assign( ATTR_JOB_IWD, "/tmp" );
	job_ad->Assign( ATTR_JOB_INPUT, NULL_FILE );
	job_ad->Assign( ATTR_JOB_OUTPUT, NULL_FILE );
	job_ad->Assign( ATTR_JOB_ERROR, NULL_FILE );

		// Not sure what to do with these. If stdin/out/err is unset in the
		// submit file, condor_submit sets In/Out/Err to the NULL_FILE and
		// these transfer attributes to false. Otherwise, it leaves the
		// transfer attributes unset (which is treated as true). If we
		// explicitly set these to false here, our caller needs to reset
		// them to true if it changes In/Out/Err and wants the default
		// behavior of transfering them. This will probably be a common
		// oversite. Leaving them unset should be safe if our caller doesn't
		// change In/Out/Err.
	//job_ad->Assign( ATTR_TRANSFER_INPUT, false );
	//job_ad->Assign( ATTR_TRANSFER_OUTPUT, false );
	//job_ad->Assign( ATTR_TRANSFER_ERROR, false );
	//job_ad->Assign( ATTR_TRANSFER_EXECUTABLE, false );

	job_ad->Assign( ATTR_BUFFER_SIZE, 512*1024 );
	job_ad->Assign( ATTR_BUFFER_BLOCK_SIZE, 32*1024 );

	job_ad->Assign( ATTR_SHOULD_TRANSFER_FILES,
					getShouldTransferFilesString( STF_YES ) );
	job_ad->Assign( ATTR_WHEN_TO_TRANSFER_OUTPUT,
					getFileTransferOutputString( FTO_ON_EXIT ) );

	job_ad->Assign( ATTR_REQUIREMENTS, true );

	job_ad->Assign( ATTR_PERIODIC_HOLD_CHECK, false );
	job_ad->Assign( ATTR_PERIODIC_REMOVE_CHECK, false );
	job_ad->Assign( ATTR_PERIODIC_RELEASE_CHECK, false );

	job_ad->Assign( ATTR_ON_EXIT_HOLD_CHECK, false );
	job_ad->Assign( ATTR_ON_EXIT_REMOVE_CHECK, true );

	job_ad->Assign( ATTR_JOB_ARGUMENTS1, "" );

	job_ad->Assign( ATTR_JOB_LEAVE_IN_QUEUE, false );

	job_ad->AssignExpr( ATTR_REQUEST_MEMORY, "ifthenelse(MemoryUsage isnt undefined,MemoryUsage,( ImageSize + 1023 ) / 1024)" );
	job_ad->AssignExpr( ATTR_REQUEST_DISK, "DiskUsage" );
	job_ad->Assign( ATTR_DISK_USAGE, 1 );
	job_ad->Assign( ATTR_REQUEST_CPUS, 1 );

	// Without these, the starter will not automatically remap the stdout/err (look at sha 422735d9)
	// and possibly won't put them in the correct directory.
	job_ad->Assign( ATTR_STREAM_OUTPUT, false );
	job_ad->Assign( ATTR_STREAM_ERROR, false );

	job_ad->Assign( ATTR_VERSION, CondorVersion() );
	job_ad->Assign( ATTR_PLATFORM, CondorPlatform() );

	job_ad->Assign( ATTR_Q_DATE, time(NULL) );

	return job_ad;
}
Ejemplo n.º 16
0
QueryResult CondorQuery::
getQueryAd (ClassAd &queryAd)
{
	QueryResult	result;
	ExprTree *tree;

	queryAd = extraAttrs;

	result = (QueryResult) query.makeQuery (tree);
	if (result != Q_OK) return result;
	queryAd.Insert(ATTR_REQUIREMENTS, tree);

	// fix types
	SetMyTypeName (queryAd, QUERY_ADTYPE);
	switch (queryType) {
#ifdef HAVE_EXT_POSTGRESQL
	  case QUILL_AD:
		SetTargetTypeName (queryAd, QUILL_ADTYPE);
		break;
#endif /* HAVE_EXT_POSTGRESQL */

	  case DEFRAG_AD:
		SetTargetTypeName(queryAd, DEFRAG_ADTYPE);
		break;
	  case STARTD_AD:
	  case STARTD_PVT_AD:
		SetTargetTypeName (queryAd, STARTD_ADTYPE);
		break;

	  case SCHEDD_AD:
		SetTargetTypeName (queryAd, SCHEDD_ADTYPE);
		break;

	  case SUBMITTOR_AD:
		SetTargetTypeName (queryAd, SUBMITTER_ADTYPE);
		break;

	  case LICENSE_AD:
		SetTargetTypeName (queryAd, LICENSE_ADTYPE);
		break;

	  case MASTER_AD:
		SetTargetTypeName (queryAd, MASTER_ADTYPE);
		break;

	  case CKPT_SRVR_AD:
		SetTargetTypeName (queryAd, CKPT_SRVR_ADTYPE);
		break;

	  case COLLECTOR_AD:
		SetTargetTypeName (queryAd, COLLECTOR_ADTYPE);
		break;

	  case NEGOTIATOR_AD:
		SetTargetTypeName (queryAd, NEGOTIATOR_ADTYPE);
		break;

      case STORAGE_AD:
        SetTargetTypeName (queryAd, STORAGE_ADTYPE);
        break;

      case CREDD_AD:
        SetTargetTypeName (queryAd, CREDD_ADTYPE);
        break;

	  case GENERIC_AD:
		if ( genericQueryType ) {
			SetTargetTypeName (queryAd, genericQueryType);
		} else {
			SetTargetTypeName (queryAd, GENERIC_ADTYPE);
		}
		break;

      case XFER_SERVICE_AD:
        SetTargetTypeName (queryAd, XFER_SERVICE_ADTYPE);
        break;

      case LEASE_MANAGER_AD:
        SetTargetTypeName (queryAd, LEASE_MANAGER_ADTYPE);
        break;

	  case ANY_AD:
		SetTargetTypeName (queryAd, ANY_ADTYPE);
		break;

	  case DATABASE_AD:
		SetTargetTypeName (queryAd, DATABASE_ADTYPE);
		break;

	  case DBMSD_AD:
		SetTargetTypeName (queryAd, DBMSD_ADTYPE);
		break;

	  case TT_AD:
		SetTargetTypeName (queryAd, TT_ADTYPE);
		break;

      case GRID_AD:
        SetTargetTypeName (queryAd, GRID_ADTYPE);
        break;

	  case HAD_AD:
		SetTargetTypeName (queryAd, HAD_ADTYPE);
		break;

	  default:
		return Q_INVALID_QUERY;
	}

	return Q_OK;
}
Ejemplo n.º 17
0
QueryResult CondorQuery::
getQueryAd (ClassAd &queryAd)
{
	QueryResult	result;
	ExprTree *tree;

	queryAd = extraAttrs;
	if (resultLimit > 0) { queryAd.Assign(ATTR_LIMIT_RESULTS, resultLimit); }

	result = (QueryResult) query.makeQuery (tree);
	if (result != Q_OK) return result;
	queryAd.Insert(ATTR_REQUIREMENTS, tree);

	// fix types
	SetMyTypeName (queryAd, QUERY_ADTYPE);
	switch (queryType) {

	  case DEFRAG_AD:
		SetTargetTypeName(queryAd, DEFRAG_ADTYPE);
		break;
	  case STARTD_AD:
	  case STARTD_PVT_AD:
		SetTargetTypeName (queryAd, STARTD_ADTYPE);
		break;

	  case SCHEDD_AD:
		SetTargetTypeName (queryAd, SCHEDD_ADTYPE);
		break;

	  case SUBMITTOR_AD:
		SetTargetTypeName (queryAd, SUBMITTER_ADTYPE);
		break;

	  case LICENSE_AD:
		SetTargetTypeName (queryAd, LICENSE_ADTYPE);
		break;

	  case MASTER_AD:
		SetTargetTypeName (queryAd, MASTER_ADTYPE);
		break;

	  case CKPT_SRVR_AD:
		SetTargetTypeName (queryAd, CKPT_SRVR_ADTYPE);
		break;

	  case COLLECTOR_AD:
		SetTargetTypeName (queryAd, COLLECTOR_ADTYPE);
		break;

	  case NEGOTIATOR_AD:
		SetTargetTypeName (queryAd, NEGOTIATOR_ADTYPE);
		break;

      case STORAGE_AD:
        SetTargetTypeName (queryAd, STORAGE_ADTYPE);
        break;

      case CREDD_AD:
        SetTargetTypeName (queryAd, CREDD_ADTYPE);
        break;

	  case GENERIC_AD:
		if ( genericQueryType ) {
			SetTargetTypeName (queryAd, genericQueryType);
		} else {
			SetTargetTypeName (queryAd, GENERIC_ADTYPE);
		}
		break;

	  case ANY_AD:
		SetTargetTypeName (queryAd, ANY_ADTYPE);
		break;

	  case DATABASE_AD:
		SetTargetTypeName (queryAd, DATABASE_ADTYPE);
		break;

	  case TT_AD:
		SetTargetTypeName (queryAd, TT_ADTYPE);
		break;

      case GRID_AD:
        SetTargetTypeName (queryAd, GRID_ADTYPE);
        break;

	  case HAD_AD:
		SetTargetTypeName (queryAd, HAD_ADTYPE);
		break;

	  case ACCOUNTING_AD:
		SetTargetTypeName(queryAd, ACCOUNTING_ADTYPE);
		break;
	  default:
		return Q_INVALID_QUERY;
	}

	return Q_OK;
}