本文整理汇总了C++中WriteUserLog::initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ WriteUserLog::initialize方法的具体用法?C++ WriteUserLog::initialize怎么用?C++ WriteUserLog::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WriteUserLog
的用法示例。
在下文中一共展示了WriteUserLog::initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
extern "C" void
initializeUserLog ()
{
std::string logfilename,dagmanLogName;
int use_xml;
std::vector<const char*> logfiles;
if ( getPathToUserLog(JobAd, logfilename) ) {
logfiles.push_back(logfilename.c_str());
dprintf(D_FULLDEBUG, "%s = %s\n", ATTR_ULOG_FILE, logfilename.c_str());
}
if ( getPathToUserLog(JobAd, dagmanLogName, ATTR_DAGMAN_WORKFLOW_LOG) ) {
logfiles.push_back(dagmanLogName.c_str());
dprintf(D_FULLDEBUG, "%s = %s\n", ATTR_DAGMAN_WORKFLOW_LOG,
dagmanLogName.c_str());
}
if(!logfiles.empty()) {
if ( !ULog.initialize (Proc->owner, NULL, logfiles,
Proc->id.cluster, Proc->id.proc, 0)) {
EXCEPT("Failed to initialize user log!");
} else {
ULog.setUseXML(JobAd->LookupBool(ATTR_ULOG_USE_XML, use_xml) && use_xml);
}
} else {
dprintf(D_FULLDEBUG, "no %s found and no %s found\n", ATTR_ULOG_FILE,
ATTR_DAGMAN_WORKFLOW_LOG);
}
}
示例2: writePreSkipEvent
bool writePreSkipEvent( CondorID& condorID, Job* job, const char* DAGNodeName,
const char* directory, const char *logFile )
{
TmpDir tmpDir;
MyString errMsg;
if ( !tmpDir.Cd2TmpDir( directory, errMsg ) ) {
debug_printf( DEBUG_QUIET,
"Could not change to node directory %s: %s\n",
directory, errMsg.Value() );
return false;
}
// Special HTCondorID for NOOP jobs -- actually indexed by
// otherwise-unused subprocID.
condorID._cluster = 0;
condorID._proc = Job::NOOP_NODE_PROCID;
condorID._subproc = 1+get_fake_condorID();
// Increment this value
set_fake_condorID(condorID._subproc);
if( job ) {
job->SetCondorID( condorID );
}
WriteUserLog ulog;
ulog.setEnableGlobalLog( false );
ulog.setUseXML( false );
ulog.initialize( std::vector<const char*>(1,logFile), condorID._cluster,
condorID._proc, condorID._subproc, NULL );
PreSkipEvent pEvent;
pEvent.cluster = condorID._cluster;
pEvent.proc = condorID._proc;
pEvent.subproc = condorID._subproc;
MyString pEventNotes("DAG Node: " );
pEventNotes += DAGNodeName;
// skipEventLogNotes gets deleted in PreSkipEvent destructor.
pEvent.skipEventLogNotes = strnewp( pEventNotes.Value() );
if ( !ulog.writeEvent( &pEvent ) ) {
EXCEPT( "Error: writing PRESKIP event failed!" );
return false;
}
return true;
}
示例3: subEventNotes
//-------------------------------------------------------------------------
bool
fake_condor_submit( CondorID& condorID, Job* job, const char* DAGNodeName,
const char* directory, const char *logFile )
{
TmpDir tmpDir;
MyString errMsg;
if ( !tmpDir.Cd2TmpDir( directory, errMsg ) ) {
debug_printf( DEBUG_QUIET,
"Could not change to node directory %s: %s\n",
directory, errMsg.Value() );
return false;
}
_subprocID++;
// Special HTCondorID for NOOP jobs -- actually indexed by
// otherwise-unused subprocID.
condorID._cluster = 0;
condorID._proc = Job::NOOP_NODE_PROCID;
condorID._subproc = _subprocID;
// Make sure that this job gets marked as a NOOP
if( job ) {
job->SetCondorID( condorID );
}
WriteUserLog ulog;
ulog.setEnableGlobalLog( false );
ulog.setUseXML( false );
ulog.initialize( logFile, condorID._cluster,
condorID._proc, condorID._subproc, NULL );
SubmitEvent subEvent;
subEvent.cluster = condorID._cluster;
subEvent.proc = condorID._proc;
subEvent.subproc = condorID._subproc;
// We need some value for submitHost for the event to be read
// correctly.
subEvent.setSubmitHost( "<dummy-submit-for-noop-job>" );
MyString subEventNotes("DAG Node: " );
subEventNotes += DAGNodeName;
// submitEventLogNotes get deleted in SubmitEvent destructor.
subEvent.submitEventLogNotes = strnewp( subEventNotes.Value() );
if ( !ulog.writeEvent( &subEvent ) ) {
EXCEPT( "Error: writing dummy submit event for NOOP node failed!" );
return false;
}
JobTerminatedEvent termEvent;
termEvent.cluster = condorID._cluster;
termEvent.proc = condorID._proc;
termEvent.subproc = condorID._subproc;
termEvent.normal = true;
termEvent.returnValue = 0;
termEvent.signalNumber = 0;
if ( !ulog.writeEvent( &termEvent ) ) {
EXCEPT( "Error: writing dummy terminated event for NOOP node failed!" );
return false;
}
return true;
}