当前位置: 首页>>代码示例>>C++>>正文


C++ WriteUserLog类代码示例

本文整理汇总了C++中WriteUserLog的典型用法代码示例。如果您正苦于以下问题:C++ WriteUserLog类的具体用法?C++ WriteUserLog怎么用?C++ WriteUserLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WriteUserLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:Clusterforge,项目名称:htcondor,代码行数:47,代码来源:dagman_submit.cpp

示例2:

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);
	}
}
开发者ID:bbockelm,项目名称:htcondor,代码行数:27,代码来源:log_events.cpp

示例3: strlen

extern "C" void
log_old_starter_shadow_suspend_event_hack (char *s1, char *s2)
{
	const char *magic_suspend = "TISABH Starter: Suspended user job: ";
	const char *magic_unsuspend = "TISABH Starter: Unsuspended user job.";

	/* This should be bug enough to hold the two string params */
	char buffer[BUFSIZ * 2 + 2];

	int size_suspend, size_unsuspend;

	size_suspend = strlen(magic_suspend);
	size_unsuspend = strlen(magic_unsuspend);
	sprintf(buffer, "%s%s", s1, s2);

	/* depending on if it is a suspend or unsuspend event, do something
		about it. */

	if (strncmp(buffer, magic_suspend, size_suspend) == 0)
	{
		/* matched a suspend event */
		JobSuspendedEvent event;
		sscanf(buffer,"TISABH Starter: Suspended user job: %d",&event.num_pids);

		if (!ULog.writeEvent (&event))
		{
			dprintf (D_ALWAYS, "Unable to log ULOG_JOB_SUSPENDED event\n");
		}

		record_suspension_hack(ULOG_JOB_SUSPENDED);
		return;
	}

	if (strncmp(buffer, magic_unsuspend, size_unsuspend) == 0)
	{
		/* matched an unsuspend event */

		JobUnsuspendedEvent event;

		if (!ULog.writeEvent (&event))
		{
			dprintf (D_ALWAYS, "Unable to log ULOG_JOB_UNSUSPENDED event\n");
		}
		record_suspension_hack(ULOG_JOB_UNSUSPENDED);
		return;
	}

	/* otherwise, do nothing */
}
开发者ID:bbockelm,项目名称:htcondor,代码行数:49,代码来源:log_events.cpp

示例4: sizeof

extern "C" void
log_except (const char *msg)
{
	check_execute_event();

	// log shadow exception event
	ShadowExceptionEvent event;
	if(!msg) msg = "";
	snprintf(event.message, sizeof(event.message), "%s", msg);
	event.message[sizeof(event.message)-1] = '\0';

	// we want to log the events from the perspective of the
	// user job, so if the shadow *sent* the bytes, then that
	// means the user job *received* the bytes

	event.recvd_bytes = BytesSent;
	event.sent_bytes = BytesRecvd;
	if (syscall_sock) {
		event.recvd_bytes += syscall_sock->get_bytes_sent();
		event.sent_bytes += syscall_sock->get_bytes_recvd();
	}

	if (!ULog.writeEvent (&event))
	{
		dprintf (D_ALWAYS, "Unable to log ULOG_SHADOW_EXCEPTION event\n");
	}
}
开发者ID:bbockelm,项目名称:htcondor,代码行数:27,代码来源:log_events.cpp

示例5: writeCheckpointedEvent

int writeCheckpointedEvent()
{
	CheckpointedEvent checkpoint;
	if ( !logFile.writeEvent(&checkpoint) ) {
		printf("Complain about bad checkpoint write\n");
		exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:9,代码来源:x_write_joblog.cpp

示例6: writeExecutableErrorEvent

int writeExecutableErrorEvent()
{
	ExecutableErrorEvent executeerror;
	executeerror.errType = CONDOR_EVENT_BAD_LINK;
	if ( !logFile.writeEvent(&executeerror) ) {
		printf("Complain about bad executeerror write\n");
		exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:10,代码来源:x_write_joblog.cpp

示例7: writeJobReleasedEvent

int writeJobReleasedEvent() 
{
	JobReleasedEvent jobreleasedevent;
	jobreleasedevent.setReason("MessinWithYou");
	if ( !logFile.writeEvent(&jobreleasedevent) ) {
		printf("Complain about bad jobreleasedevent write\n");
		exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:10,代码来源:x_write_joblog.cpp

示例8: writeJobUnsuspendedEvent

int writeJobUnsuspendedEvent()
{
	JobUnsuspendedEvent jobunsuspendevent;
	//jobunsuspendevent.num_pids = 99;
	if ( !logFile.writeEvent(&jobunsuspendevent) ) {
		printf("Complain about bad jobunsuspendevent write\n");
		exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:10,代码来源:x_write_joblog.cpp

示例9: writeJobImageSizeEvent

int writeJobImageSizeEvent()
{
	JobImageSizeEvent jobimagesizeevent;
	jobimagesizeevent.image_size_kb = 128;
	if ( !logFile.writeEvent(&jobimagesizeevent) ) {
		printf("Complain about bad jobimagesizeevent write\n");
		exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:10,代码来源:x_write_joblog.cpp

示例10: writeGlobusResourceDownEvent

int writeGlobusResourceDownEvent()
{
	GlobusResourceDownEvent globusresourcedownevent;
	globusresourcedownevent.rmContact = strdup("ResourceDown");;
	if ( !logFile.writeEvent(&globusresourcedownevent) ) {
	        printf("Complain about bad globusresourcedownevent write\n");
			exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:10,代码来源:x_write_joblog.cpp

示例11: writeGlobusSubmitFailedEvent

int writeGlobusSubmitFailedEvent()
{
	GlobusSubmitFailedEvent globussubmitfailedevent;
	globussubmitfailedevent.reason = strdup("Cause it could");;
	if ( !logFile.writeEvent(&globussubmitfailedevent) ) {
	        printf("Complain about bad globussubmitfailedevent write\n");
			exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:10,代码来源:x_write_joblog.cpp

示例12: writeJobAbortedEvent

int writeJobAbortedEvent()
{
	JobAbortedEvent jobabort;
	jobabort.setReason("cause I said so!");
	if ( !logFile.writeEvent(&jobabort) ) {
	        printf("Complain about bad jobabort write\n");
			exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:10,代码来源:x_write_joblog.cpp

示例13: writeExecuteEvent

int writeExecuteEvent()
{
	ExecuteEvent execute;
	execute.setExecuteHost("<128.105.165.12:32779>");
	if ( !logFile.writeEvent(&execute) ) {
		printf("Complain about bad execute write\n");
		exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:10,代码来源:x_write_joblog.cpp

示例14: writeNodeExecuteEvent

int writeNodeExecuteEvent()
{
	NodeExecuteEvent nodeexecuteevent;
	nodeexecuteevent.node = 49;
	nodeexecuteevent.setExecuteHost("<128.105.165.12:32779>");
	if ( !logFile.writeEvent(&nodeexecuteevent) ) {
		printf("Complain about bad nodeexecuteevent write\n");
		exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:11,代码来源:x_write_joblog.cpp

示例15: writeJobEvictedEvent

int writeJobEvictedEvent()
{
	JobEvictedEvent jobevicted;
	jobevicted.setReason("It misbehaved!");
	jobevicted.setCoreFile("corefile");
	if ( !logFile.writeEvent(&jobevicted) ) {
	        printf("Complain about bad jobevicted write\n");
			exit(1);
	}
	return(0);
}
开发者ID:AlanDeSmet,项目名称:htcondor,代码行数:11,代码来源:x_write_joblog.cpp


注:本文中的WriteUserLog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。