本文整理汇总了C++中CondorError::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CondorError::clear方法的具体用法?C++ CondorError::clear怎么用?C++ CondorError::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CondorError
的用法示例。
在下文中一共展示了CondorError::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dir
/**
* Process the history directory and maintain the history file map
*
* Only handle rotated history files, those history.* that are not an
* index. For each one that is not in the history file map, create a
* new HistoryFile, poll it for entries to process, and add it to the
* map.
*/
void
aviary::history::processHistoryDirectory()
{
const char *file = NULL;
// each time through we rebuild our set of inodes
if (force_reset) {
m_historyFiles.clear();
}
Directory dir ( m_path.Value() );
dir.Rewind();
while ( ( file = dir.Next() ) )
{
// Skip all non-history files, e.g. history and history.*.idx
if ( strncmp ( file, "history.", 8 ) ||
!strncmp ( file + ( strlen ( file ) - 4 ), HISTORY_INDEX_SUFFIX, 4 ) ) continue;
HistoryFile h_file ( ( m_path + DIR_DELIM_STRING + file ).Value() );
CondorError errstack;
if ( !h_file.init ( errstack ) )
{
dprintf ( D_ALWAYS, "%s\n", errstack.getFullText().c_str() );
return;
}
errstack.clear();
long unsigned int id;
ASSERT ( h_file.getId ( id ) );
HistoryFileListType::iterator entry = m_historyFiles.find ( id );
if ( m_historyFiles.end() == entry )
{
HistoryFile::HistoryEntriesTypeIterators ij = h_file.poll ( errstack );
for ( HistoryFile::HistoryEntriesTypeIterator i = ij.first;
i != ij.second;
i++ )
{
process ( ( *i ) );
}
m_historyFiles.insert ( id );
}
}
}
示例2: dc_schedd
//.........这里部分代码省略.........
// Create a batch of commands with the same command type AND the same reason
command_queue.Rewind();
while (command_queue.Next(current_command)) {
if (current_command->status != SchedDRequest::SDCS_NEW)
continue;
if (current_command->command != this_command)
continue;
if ((this_reason != NULL) && (strcmp (current_command->reason, this_reason) != 0))
continue;
if (this_reason == NULL)
this_reason = current_command->reason;
char job_id_buff[30];
sprintf (job_id_buff, "%d.%d",
current_command->cluster_id,
current_command->proc_id);
id_list.append (job_id_buff);
this_batch.Append (current_command);
}
// If we haven't found any....
if (id_list.isEmpty()) {
i++;
continue; // ... then try the next command
}
// Perform the appropriate command on the current batch
ClassAd * result_ad= NULL;
if (this_command == SchedDRequest::SDC_REMOVE_JOB) {
errstack.clear();
result_ad=
dc_schedd.removeJobs (
&id_list,
this_reason,
&errstack);
} else if (this_command == SchedDRequest::SDC_HOLD_JOB) {
errstack.clear();
result_ad=
dc_schedd.holdJobs (
&id_list,
this_reason,
NULL,
&errstack);
} else if (this_command == SchedDRequest::SDC_RELEASE_JOB) {
errstack.clear();
result_ad=
dc_schedd.releaseJobs (
&id_list,
this_reason,
&errstack);
} else {
EXCEPT( "Unexpected command type %d in doContactSchedd",
this_command );
}
// Analyze the result ad
if (!result_ad) {
error = TRUE;
sprintf( error_msg, "Error connecting to schedd %s %s: %s",
ScheddAddr, dc_schedd.addr(), errstack.getFullText() );
}
else {
示例3: currentHistory
/**
* Process the current history file.
*
* 1) check to see if it is properly initialized, recording id (inode)
* 2) stat the current history file
* 3) poll for new entries and process them
* 4) detect rotations
*/
void
aviary::history::processCurrentHistory()
{
static MyString currentHistoryFilename = m_path + DIR_DELIM_STRING + "history";
static HistoryFile currentHistory ( currentHistoryFilename.Value() );
CondorError errstack;
if (force_reset) {
currentHistory.cleanup();
}
// (1)
long unsigned int id;
if ( !currentHistory.getId ( id ) || force_reset)
{
// at this point adjust the reset flag
force_reset = false;
if ( !currentHistory.init ( errstack ) )
{
dprintf ( D_ALWAYS, "%s\n", errstack.getFullText().c_str() );
return;
}
ASSERT ( currentHistory.getId ( id ) );
m_historyFiles.insert ( id );
}
// (2)
// Stat before poll to handle race of: poll + write + rotate + stat
StatWrapper stat_wrapper;
if ( stat_wrapper.Stat ( currentHistoryFilename ) )
{
dprintf ( D_ALWAYS, "Failed to stat %s: %d (%s)\n",
currentHistoryFilename.Value(),
stat_wrapper.GetErrno(), strerror ( stat_wrapper.GetErrno() ) );
return;
}
const StatStructType *stat = stat_wrapper.GetBuf();
ASSERT ( currentHistory.getId ( id ) );
// (3)
errstack.clear();
HistoryFile::HistoryEntriesTypeIterators poll = currentHistory.poll ( errstack );
for ( HistoryFile::HistoryEntriesTypeIterator i = poll.first;
i != poll.second;
i++ )
{
process ( ( *i ) );
}
// (4)
// If different the file has rotated
if ( id != stat->st_ino )
{
currentHistory = HistoryFile ( currentHistoryFilename.Value() );
if ( !currentHistory.init ( errstack ) )
{
dprintf ( D_ALWAYS, "%s\n", errstack.getFullText().c_str() );
return;
}
ASSERT ( currentHistory.getId ( id ) );
m_historyFiles.insert ( id );
force_reset = true;
return;
}
}