Ejemplo n.º 1
0
extern "C" void 
initializeUserLog ()
{
	MyString logfilename;
	MyString gjid;
	int use_xml;
	bool have_a_log = false;
	if ( getPathToUserLog(JobAd, logfilename) ) {
		have_a_log = true;	
		if(JobAd->LookupString(ATTR_GLOBAL_JOB_ID, gjid) != 1) {
			gjid = "Unknown";
		}
		std::string logfile(logfilename.Value());
		WriteUserLog* ulogi = new WriteUserLog;
		if( !ulogi ) {
			EXCEPT("Out of memory!\n");
		}
		if (!ulogi->initialize (Proc->owner, NULL, logfilename.Value(),
					Proc->id.cluster, Proc->id.proc, 0, gjid.Value())) {
			EXCEPT("Failed to initialize user log!\n");
		}
		ulogi->setUseXML(JobAd->LookupBool(ATTR_ULOG_USE_XML, use_xml)
				&& use_xml);
		dprintf(D_FULLDEBUG, "%s = %s\n", ATTR_ULOG_FILE, logfilename.Value());
		ULog.push_back(ulogi);
	}
	if ( getPathToUserLog(JobAd, logfilename, ATTR_DAGMAN_WORKFLOW_LOG) ) {
		have_a_log = true;	
		if(JobAd->LookupString(ATTR_GLOBAL_JOB_ID, gjid) != 1) {
			gjid = "Unknown";
		}
		std::string logfile(logfilename.Value());
		WriteUserLog* ulogi = new WriteUserLog;
		if( !ulogi ) {
			EXCEPT("Out of memory!\n");
		}
		ulogi->setUseXML(false);
		if (!ulogi->initialize (Proc->owner, NULL, logfilename.Value(),
					Proc->id.cluster, Proc->id.proc, 0, gjid.Value())) {
			EXCEPT("Failed to initialize user log!\n");
		}
		dprintf(D_FULLDEBUG, "%s = %s\n", ATTR_ULOG_FILE, logfilename.Value());
		if(!ULog.empty()){ // Only write to global event log once
			ulogi->setEnableGlobalLog( false );	
		}
		ULog.push_back(ulogi);
	}
	if( !have_a_log ) {
		dprintf(D_FULLDEBUG, "no %s found\n", ATTR_ULOG_FILE);
		dprintf(D_FULLDEBUG, "Also, no %s found\n", ATTR_DAGMAN_WORKFLOW_LOG);
	}
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
//-------------------------------------------------------------------------
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;
}