int LogNewClassAd::Play(void *data_structure) { int result; ClassAdHashTable *table = (ClassAdHashTable *)data_structure; ClassAd *ad = new ClassAd(); ad->SetMyTypeName(mytype); ad->SetTargetTypeName(targettype); result = table->insert(HashKey(key), ad); #if defined(HAVE_DLOPEN) ClassAdLogPluginManager::NewClassAd(key); #endif return result; }
void XferSummary::time_out(time_t now, char *hostaddr) { ClassAd info; char line[128], *tmp; char *str = NULL; info.SetMyTypeName("CkptServer"); info.SetTargetTypeName("CkptFile"); sprintf(line, "%s = \"%s\"", ATTR_NAME, my_full_hostname() ); 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); sprintf(line, "Disk = %d", sysapi_disk_space(pwd.Value()) ); info.Insert(line); // Send to collector if ( Collectors ) { dprintf(D_NETWORK, "Sending CkptServer ClassAd:\n"); info.dPrint(D_NETWORK); Collectors->sendUpdates (UPDATE_CKPT_SRVR_AD, &info, NULL, true); } init(); }
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(); jobAd->SetMyTypeName("Job"); jobAd->SetTargetTypeName("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_JOB_STATUS, jobStatus); 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() ); cleanup_execute_dir( s_pid, executeDir() ); #if defined(LINUX) if( param_boolean( "GLEXEC_STARTER", false ) ) { cleanupAfterGlexec(); } #endif }
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 queryAd.SetMyTypeName (QUERY_ADTYPE); switch (queryType) { #ifdef HAVE_EXT_POSTGRESQL case QUILL_AD: queryAd.SetTargetTypeName (QUILL_ADTYPE); break; #endif /* HAVE_EXT_POSTGRESQL */ case STARTD_AD: case STARTD_PVT_AD: queryAd.SetTargetTypeName (STARTD_ADTYPE); break; case SCHEDD_AD: queryAd.SetTargetTypeName (SCHEDD_ADTYPE); break; case SUBMITTOR_AD: queryAd.SetTargetTypeName (SUBMITTER_ADTYPE); break; case LICENSE_AD: queryAd.SetTargetTypeName (LICENSE_ADTYPE); break; case MASTER_AD: queryAd.SetTargetTypeName (MASTER_ADTYPE); break; case CKPT_SRVR_AD: queryAd.SetTargetTypeName (CKPT_SRVR_ADTYPE); break; case COLLECTOR_AD: queryAd.SetTargetTypeName (COLLECTOR_ADTYPE); break; case NEGOTIATOR_AD: queryAd.SetTargetTypeName (NEGOTIATOR_ADTYPE); break; case STORAGE_AD: queryAd.SetTargetTypeName (STORAGE_ADTYPE); break; case CREDD_AD: queryAd.SetTargetTypeName (CREDD_ADTYPE); break; case GENERIC_AD: if ( genericQueryType ) { queryAd.SetTargetTypeName (genericQueryType); } else { queryAd.SetTargetTypeName (GENERIC_ADTYPE); } break; case XFER_SERVICE_AD: queryAd.SetTargetTypeName (XFER_SERVICE_ADTYPE); break; case LEASE_MANAGER_AD: queryAd.SetTargetTypeName (LEASE_MANAGER_ADTYPE); break; case ANY_AD: queryAd.SetTargetTypeName (ANY_ADTYPE); break; case DATABASE_AD: queryAd.SetTargetTypeName (DATABASE_ADTYPE); break; case DBMSD_AD: queryAd.SetTargetTypeName (DBMSD_ADTYPE); break; case TT_AD: queryAd.SetTargetTypeName (TT_ADTYPE); break; case GRID_AD: queryAd.SetTargetTypeName (GRID_ADTYPE); break; case HAD_AD: queryAd.SetTargetTypeName (HAD_ADTYPE); break; default: return Q_INVALID_QUERY; } return Q_OK; }