sparqlGraphLibrary/src/main/java/com/ge/research/semtk/fdccache/FdcCacheSpecRunner.java
public void run() {
		ThreadAuthenticator.authenticateThisThread(this.headerTable);
		
		try {
			// iff there is a bootstrap table, check age
			if (this.bootstrapTable != null) {
				String bootstrapTableHash = this.getBootstrapTableHash();
				if (this.checkAlreadyCached(bootstrapTableHash)) {
					return;
				} else {
					// clear and timestamp data graph[0]
					this.clearAndHashGraph(bootstrapTableHash);
				}
			} 
			
			FdcClient fdcClient = null;
			int percentStep = 100 / this.getNumSteps();
			int percentComplete = 0;
			
			for (this.curStep = 0; this.curStep < this.getNumSteps(); this.curStep++) {
				
				//----- get fdc inputs -----
				if (curStep == 0 && bootstrapTable != null) {
					tracker.setJobPercentComplete(jobId, percentComplete, "loading bootstrap table");
					fdcClient = getStepFdcClient(this.bootstrapTable);
					
				} else {
					// normal select 
					tracker.setJobPercentComplete(jobId, percentComplete, "run select, nodegroup = " + this.getStepInputNg());
					
					// try retrieving nodegroup from fdcClient first, failures will be silent
					String selectId = this.getStepInputNg();
					
					FdcClient fdcGetNgClient = new FdcClient(FdcClientConfig.buildGetNodegroup(this.getStepServiceUrl(), selectId));
					SparqlGraphJson sgjson = fdcGetNgClient.executeGetNodegroup();
					Table selectTab = null;
					if (sgjson != null) {
						// run nodegroup from fdcClient
						sgjson.setSparqlConn(this.conn);
						selectTab = this.ngExecClient.dispatchSelectFromNodeGroup(sgjson, null, null);
					} else {
						// run from nodegroup store instead
						selectTab = this.ngExecClient.execDispatchSelectByIdToTable(
								selectId, 
								this.conn,
								null,null);
					}
					fdcClient = getStepFdcClient(selectTab);
				}
				percentComplete += percentStep/3;
				
				
				//----- run fdc client -----
				tracker.setJobPercentComplete(jobId, percentComplete, "run client = " + this.getStepServiceUrl());
				TableResultSet res = fdcClient.executeWithTableResultReturn();
				res.throwExceptionIfUnsuccessful();
				percentComplete += percentStep/3;

				
				//----- ingest results -----
				if (res.getTable().getNumRows() > 0) {
					String ingestId = this.getStepIngestNgId();
					tracker.setJobPercentComplete(jobId, percentComplete, "ingest nodegroup = " + ingestId);
					
					// try retrieving nodegroup from fdcClient first, failures will be silent
					FdcClient fdcGetNgClient = new FdcClient(FdcClientConfig.buildGetNodegroup(this.getStepServiceUrl(), ingestId));
					SparqlGraphJson sgjson = fdcGetNgClient.executeGetNodegroup();
					if (sgjson != null) {
						// run nodegroup from fdcClient
						sgjson.setSparqlConn(this.conn);
						this.ngExecClient.dispatchIngestFromCsvStringsSync(sgjson, res.getTableCSVString());
					} else {
						// else run nodegroup from store by id
						this.ngExecClient.dispatchIngestFromCsvStringsByIdSync(
								this.getStepIngestNgId(), 
								res.getTableCSVString(), 
								this.conn);
					}
				}
				percentComplete += percentStep/3;

			}
			
			this.tracker.setJobSuccess(jobId, "Successfully cached data");
			
		} catch (Exception e) {
			// finish job on any exception
			try {
				LocalLogger.printStackTrace(e);
				this.tracker.setJobFailure(this.jobId, e.getMessage() == null ? "null" : e.getMessage());
			} catch (Exception ee) {
				LocalLogger.printStackTrace(ee);
			}
			
		}
	}
/**
	 * Run the thread.
	 * Note: always produces a status message in the job tracker.
	 */
Run the thread.
Note: always produces a status message in the job tracker.
Run the thread . Note : always produces a status message in the job tracker .
public void run() {
		ThreadAuthenticator.authenticateThisThread(this.headerTable);
		try {
			if (this.bootstrapTable != null) {
				String bootstrapTableHash = this.getBootstrapTableHash();
				if (this.checkAlreadyCached(bootstrapTableHash)) {
					return;
				} else {
					this.clearAndHashGraph(bootstrapTableHash);
				}
			} 
			FdcClient fdcClient = null;
			int percentStep = 100 / this.getNumSteps();
			int percentComplete = 0;
			for (this.curStep = 0; this.curStep < this.getNumSteps(); this.curStep++) {
				if (curStep == 0 && bootstrapTable != null) {
					tracker.setJobPercentComplete(jobId, percentComplete, "loading bootstrap table");
					fdcClient = getStepFdcClient(this.bootstrapTable);
				} else {
					tracker.setJobPercentComplete(jobId, percentComplete, "run select, nodegroup = " + this.getStepInputNg());
					String selectId = this.getStepInputNg();
					FdcClient fdcGetNgClient = new FdcClient(FdcClientConfig.buildGetNodegroup(this.getStepServiceUrl(), selectId));
					SparqlGraphJson sgjson = fdcGetNgClient.executeGetNodegroup();
					Table selectTab = null;
					if (sgjson != null) {
						sgjson.setSparqlConn(this.conn);
						selectTab = this.ngExecClient.dispatchSelectFromNodeGroup(sgjson, null, null);
					} else {
						selectTab = this.ngExecClient.execDispatchSelectByIdToTable(
								selectId, 
								this.conn,
								null,null);
					}
					fdcClient = getStepFdcClient(selectTab);
				}
				percentComplete += percentStep/3;
				tracker.setJobPercentComplete(jobId, percentComplete, "run client = " + this.getStepServiceUrl());
				TableResultSet res = fdcClient.executeWithTableResultReturn();
				res.throwExceptionIfUnsuccessful();
				percentComplete += percentStep/3;
				if (res.getTable().getNumRows() > 0) {
					String ingestId = this.getStepIngestNgId();
					tracker.setJobPercentComplete(jobId, percentComplete, "ingest nodegroup = " + ingestId);
					FdcClient fdcGetNgClient = new FdcClient(FdcClientConfig.buildGetNodegroup(this.getStepServiceUrl(), ingestId));
					SparqlGraphJson sgjson = fdcGetNgClient.executeGetNodegroup();
					if (sgjson != null) {
						sgjson.setSparqlConn(this.conn);
						this.ngExecClient.dispatchIngestFromCsvStringsSync(sgjson, res.getTableCSVString());
					} else {
						this.ngExecClient.dispatchIngestFromCsvStringsByIdSync(
								this.getStepIngestNgId(), 
								res.getTableCSVString(), 
								this.conn);
					}
				}
				percentComplete += percentStep/3;
			}
			this.tracker.setJobSuccess(jobId, "Successfully cached data");
		} catch (Exception e) {
			try {
				LocalLogger.printStackTrace(e);
				this.tracker.setJobFailure(this.jobId, e.getMessage() == null ? "null" : e.getMessage());
			} catch (Exception ee) {
				LocalLogger.printStackTrace(ee);
			}
		}
	}
public void run ( ) { ThreadAuthenticator . authenticateThisThread ( this . headerTable ) ; try { if ( this . bootstrapTable != null ) { String bootstrapTableHash = this . getBootstrapTableHash ( ) ; if ( this . checkAlreadyCached ( bootstrapTableHash ) ) { return ; } else { this . clearAndHashGraph ( bootstrapTableHash ) ; } } FdcClient fdcClient = null ; int percentStep = 100 / this . getNumSteps ( ) ; int percentComplete = 0 ; for ( this . curStep = 0 ; this . curStep < this . getNumSteps ( ) ; this . curStep ++ ) { if ( curStep == 0 && bootstrapTable != null ) { tracker . setJobPercentComplete ( jobId , percentComplete , "loading bootstrap table" ) ; fdcClient = getStepFdcClient ( this . bootstrapTable ) ; } else { tracker . setJobPercentComplete ( jobId , percentComplete , "run select, nodegroup = " + this . getStepInputNg ( ) ) ; String selectId = this . getStepInputNg ( ) ; FdcClient fdcGetNgClient = new FdcClient ( FdcClientConfig . buildGetNodegroup ( this . getStepServiceUrl ( ) , selectId ) ) ; SparqlGraphJson sgjson = fdcGetNgClient . executeGetNodegroup ( ) ; Table selectTab = null ; if ( sgjson != null ) { sgjson . setSparqlConn ( this . conn ) ; selectTab = this . ngExecClient . dispatchSelectFromNodeGroup ( sgjson , null , null ) ; } else { selectTab = this . ngExecClient . execDispatchSelectByIdToTable ( selectId , this . conn , null , null ) ; } fdcClient = getStepFdcClient ( selectTab ) ; } percentComplete += percentStep / 3 ; tracker . setJobPercentComplete ( jobId , percentComplete , "run client = " + this . getStepServiceUrl ( ) ) ; TableResultSet res = fdcClient . executeWithTableResultReturn ( ) ; res . throwExceptionIfUnsuccessful ( ) ; percentComplete += percentStep / 3 ; if ( res . getTable ( ) . getNumRows ( ) > 0 ) { String ingestId = this . getStepIngestNgId ( ) ; tracker . setJobPercentComplete ( jobId , percentComplete , "ingest nodegroup = " + ingestId ) ; FdcClient fdcGetNgClient = new FdcClient ( FdcClientConfig . buildGetNodegroup ( this . getStepServiceUrl ( ) , ingestId ) ) ; SparqlGraphJson sgjson = fdcGetNgClient . executeGetNodegroup ( ) ; if ( sgjson != null ) { sgjson . setSparqlConn ( this . conn ) ; this . ngExecClient . dispatchIngestFromCsvStringsSync ( sgjson , res . getTableCSVString ( ) ) ; } else { this . ngExecClient . dispatchIngestFromCsvStringsByIdSync ( this . getStepIngestNgId ( ) , res . getTableCSVString ( ) , this . conn ) ; } } percentComplete += percentStep / 3 ; } this . tracker . setJobSuccess ( jobId , "Successfully cached data" ) ; } catch ( Exception e ) { try { LocalLogger . printStackTrace ( e ) ; this . tracker . setJobFailure ( this . jobId , e . getMessage ( ) == null ? "null" : e . getMessage ( ) ) ; } catch ( Exception ee ) { LocalLogger . printStackTrace ( ee ) ; } } }
Run the thread.
Run the thread .
// iff there is a bootstrap table, check age // clear and timestamp data graph[0] //----- get fdc inputs ----- // normal select  // try retrieving nodegroup from fdcClient first, failures will be silent // run nodegroup from fdcClient // run from nodegroup store instead //----- run fdc client ----- //----- ingest results ----- // try retrieving nodegroup from fdcClient first, failures will be silent // run nodegroup from fdcClient // else run nodegroup from store by id // finish job on any exception