Merge pull request #4071 from eugene7646/input_scan_time_fix

Input scan time fix
This commit is contained in:
esaunders 2018-08-28 13:52:07 -04:00 committed by GitHub
commit b6ddd6e39b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1398,10 +1398,6 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
AutoIngestJob job; AutoIngestJob job;
if (nodeData.getVersion() == AutoIngestJobNodeData.getCurrentVersion()) { if (nodeData.getVersion() == AutoIngestJobNodeData.getCurrentVersion()) {
job = new AutoIngestJob(nodeData); job = new AutoIngestJob(nodeData);
Path caseDirectory = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName());
if (null != caseDirectory) {
job.setCaseDirectoryPath(caseDirectory);
}
} else { } else {
job = new AutoIngestJob(manifest); job = new AutoIngestJob(manifest);
job.setPriority(nodeData.getPriority()); // Retain priority, present in all versions of the node data. job.setPriority(nodeData.getPriority()); // Retain priority, present in all versions of the node data.
@ -1431,10 +1427,6 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex); sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
} }
} }
Path caseDirectory = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName());
if (null != caseDirectory) {
job.setCaseDirectoryPath(caseDirectory);
}
newPendingJobsList.add(job); newPendingJobsList.add(job);
} }
@ -1595,54 +1587,53 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* @throws InterruptedException * @throws InterruptedException
*/ */
private void addCompletedJob(Manifest manifest, AutoIngestJobNodeData nodeData) throws CoordinationServiceException, InterruptedException, AutoIngestJobException { private void addCompletedJob(Manifest manifest, AutoIngestJobNodeData nodeData) throws CoordinationServiceException, InterruptedException, AutoIngestJobException {
Path caseDirectoryPath = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName()); Path caseDirectoryPath = nodeData.getCaseDirectoryPath();
if (null != caseDirectoryPath) { if (!caseDirectoryPath.toFile().exists()) {
AutoIngestJob job; sysLogger.log(Level.WARNING, String.format("Job completed for %s, but cannot find case directory %s, ignoring job", nodeData.getManifestFilePath(), caseDirectoryPath.toString()));
if (nodeData.getVersion() == AutoIngestJobNodeData.getCurrentVersion()) { return;
job = new AutoIngestJob(nodeData); }
job.setCaseDirectoryPath(caseDirectoryPath);
} else {
/**
* Use the manifest rather than the node data here to create
* a new AutoIngestJob instance because the AutoIngestJob
* constructor that takes a node data object expects the
* node data to have fields that do not exist in earlier
* versions.
*/
job = new AutoIngestJob(manifest);
job.setCaseDirectoryPath(caseDirectoryPath);
/** AutoIngestJob job;
* Update the job with the fields that exist in all versions if (nodeData.getVersion() == AutoIngestJobNodeData.getCurrentVersion()) {
* of the nodeData. job = new AutoIngestJob(nodeData);
*/ job.setCaseDirectoryPath(caseDirectoryPath);
job.setCompletedDate(nodeData.getCompletedDate()); } else {
job.setErrorsOccurred(nodeData.getErrorsOccurred()); /**
job.setPriority(nodeData.getPriority()); * Use the manifest rather than the node data here to create a
job.setNumberOfCrashes(nodeData.getNumberOfCrashes()); * new AutoIngestJob instance because the AutoIngestJob
job.setProcessingStage(AutoIngestJob.Stage.COMPLETED, nodeData.getCompletedDate()); * constructor that takes a node data object expects the node
job.setProcessingStatus(AutoIngestJob.ProcessingStatus.COMPLETED); * data to have fields that do not exist in earlier versions.
*/
job = new AutoIngestJob(manifest);
job.setCaseDirectoryPath(caseDirectoryPath);
/* /**
* Update the job with the fields that exist in all versions of
* the nodeData.
*/
job.setCompletedDate(nodeData.getCompletedDate());
job.setErrorsOccurred(nodeData.getErrorsOccurred());
job.setPriority(nodeData.getPriority());
job.setNumberOfCrashes(nodeData.getNumberOfCrashes());
job.setProcessingStage(AutoIngestJob.Stage.COMPLETED, nodeData.getCompletedDate());
job.setProcessingStatus(AutoIngestJob.ProcessingStatus.COMPLETED);
/*
* Try to upgrade/update the coordination service manifest * Try to upgrade/update the coordination service manifest
* node data for the job. It is possible that two hosts will * node data for the job. It is possible that two hosts will
* both try to obtain the lock to do the upgrade operation * both try to obtain the lock to do the upgrade operation
* at the same time. If this happens, the host that is * at the same time. If this happens, the host that is
* holding the lock will complete the upgrade operation. * holding the lock will complete the upgrade operation.
*/ */
try (Lock manifestLock = coordinationService.tryGetExclusiveLock(CoordinationService.CategoryNode.MANIFESTS, manifest.getFilePath().toString())) { try (Lock manifestLock = coordinationService.tryGetExclusiveLock(CoordinationService.CategoryNode.MANIFESTS, manifest.getFilePath().toString())) {
if (null != manifestLock) { if (null != manifestLock) {
updateCoordinationServiceManifestNode(job); updateCoordinationServiceManifestNode(job);
}
} catch (CoordinationServiceException ex) {
sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
} }
} catch (CoordinationServiceException ex) {
sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
} }
newCompletedJobsList.add(job);
} else {
sysLogger.log(Level.WARNING, String.format("Job completed for %s, but cannot find case directory, ignoring job", nodeData.getManifestFilePath()));
} }
newCompletedJobsList.add(job);
} }
/** /**
@ -2456,6 +2447,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
Thread.sleep(AutoIngestUserPreferences.getSecondsToSleepBetweenCases() * 1000); Thread.sleep(AutoIngestUserPreferences.getSecondsToSleepBetweenCases() * 1000);
} }
currentJob.setCaseDirectoryPath(caseDirectoryPath); currentJob.setCaseDirectoryPath(caseDirectoryPath);
updateCoordinationServiceManifestNode(currentJob); // update case directory path
Case caseForJob = Case.getCurrentCase(); Case caseForJob = Case.getCurrentCase();
sysLogger.log(Level.INFO, "Opened case {0} for {1}", new Object[]{caseForJob.getName(), manifest.getFilePath()}); sysLogger.log(Level.INFO, "Opened case {0} for {1}", new Object[]{caseForJob.getName(), manifest.getFilePath()});
return caseForJob; return caseForJob;