8202 ingest prog bars on EDT; job cancel off EDT

This commit is contained in:
Richard Cordovano 2021-11-29 14:39:48 -05:00
parent cd3f1a58ec
commit 087c70d492
3 changed files with 113 additions and 105 deletions

View File

@ -173,7 +173,7 @@ public final class IngestJob {
void processStreamingIngestDataSource() {
if (ingestMode == Mode.STREAMING) {
if (ingestModuleExecutor != null) {
ingestModuleExecutor.startStreamingModeDataSourceAnalysis();
ingestModuleExecutor.addStreamedDataSource();
} else {
logger.log(Level.SEVERE, "Attempted to start data source analaysis with no ingest pipeline");
}

View File

@ -541,7 +541,7 @@ final class IngestJobExecutor {
}
/**
* Determnines which inges job stage to start in and starts up the ingest
* Determnines which ingets job stage to start in and starts up the ingest
* module pipelines.
*
* @return A collection of ingest module startup errors, empty on success.
@ -671,7 +671,7 @@ final class IngestJobExecutor {
*/
private void startBatchModeAnalysis() {
synchronized (stageTransitionLock) {
logInfoMessage(String.format("Starting analysis in batch mode for %s (objID=%d, jobID=%d)", dataSource.getName(), dataSource.getId(), ingestJob.getId())); //NON-NLS
logInfoMessage("Starting ingest job in batch mode"); //NON-NLS
stage = IngestJobStage.FILE_AND_HIGH_PRIORITY_DATA_SRC_LEVEL_ANALYSIS;
if (hasFileIngestModules()) {
@ -686,23 +686,16 @@ final class IngestJobExecutor {
} else {
estimatedFilesToProcess = files.size();
}
}
if (usingNetBeansGUI) {
/*
* Start ingest progress bars in the lower right hand corner of
* the main application window.
*/
if (hasFileIngestModules()) {
startFileIngestProgressBar();
}
if (hasHighPriorityDataSourceIngestModules()) {
startDataSourceIngestProgressBar();
}
if (hasDataArtifactIngestModules()) {
startArtifactIngestProgressBar();
}
}
/*
* Make the high priority data source level ingest module pipeline
@ -711,60 +704,69 @@ final class IngestJobExecutor {
currentDataSourceIngestPipeline = highPriorityDataSourceIngestPipeline;
/*
* Schedule ingest tasks and then immediately check for stage
* completion. This is necessary because it is possible that zero
* tasks will actually make it to task execution due to the file
* filter or other ingest job settings. In that case, there will
* never be a stage completion check in an ingest thread executing
* an ingest task, so such a job would run forever without a check
* here.
* Schedule ingest tasks.
*/
if (!files.isEmpty() && hasFileIngestModules()) {
taskScheduler.scheduleFileIngestTasks(this, files);
} else if (hasHighPriorityDataSourceIngestModules() || hasFileIngestModules() || hasDataArtifactIngestModules()) {
taskScheduler.scheduleIngestTasks(this);
}
/*
* Check for stage completion. This is necessary because it is
* possible that none of the tasks that were just scheduled will
* actually make it to task execution due to the file filter or
* other ingest job settings. In that case, there will never be a
* stage completion check in an ingest thread executing an ingest
* task, so such a job would run forever without a check here.
*/
checkForStageCompleted();
}
}
/**
* Starts analysis for a streaming mode ingest job. For a streaming mode
* job, the data source processor streams files in as it adds them to the
* case database and file analysis can begin before data source level
* analysis.
* job, a data source processor streams files to this ingest job executor as
* it adds the files to the case database, and file level analysis can begin
* before data source level analysis.
*/
private void startStreamingModeAnalysis() {
synchronized (stageTransitionLock) {
logInfoMessage("Starting data source level analysis in streaming mode"); //NON-NLS
logInfoMessage("Starting ingest job in streaming mode"); //NON-NLS
stage = IngestJobStage.STREAMED_FILE_ANALYSIS_ONLY;
if (usingNetBeansGUI) {
/*
* Start ingest progress bars in the lower right hand corner of
* the main application window.
*/
if (hasFileIngestModules()) {
/*
* Note that because estimated files remaining to process
* still has its initial value of zero, the progress bar
* will start in the "indeterminate" state. An estimate of
* the files to process can be computed later, when all of
* the files have been added ot the case database.
* Start the file ingest progress bar, but do not schedule any
* file or data source ingest tasks. File ingest tasks will
* instead be scheduled as files are streamed in via
* addStreamedFiles(), and a data source ingest task will be
* scheduled later, via addStreamedDataSource().
*
* Note that because estimated files remaining to process still
* has its initial value of zero, the fle ingest progress bar
* will start in the "indeterminate" state. A rough estimate of
* the files to processed will be computed later, when all of
* the files have been added to the case database, as signaled
* by a call to the addStreamedDataSource().
*/
estimatedFilesToProcess = 0;
startFileIngestProgressBar();
}
if (hasDataArtifactIngestModules()) {
startArtifactIngestProgressBar();
}
}
if (hasDataArtifactIngestModules()) {
startArtifactIngestProgressBar();
/*
* Schedule artifact ingest tasks for any artifacts currently in
* the case database. This needs to be done before any files or
* the data source are streamed in to avoid analyzing the data
* artifacts added to the case database by those tasks twice.
* This constraint is implemented by restricting construction of
* a streaming mode IngestJob to
* IngestManager.openIngestStream(), which constructs and starts
* the job before returning the IngestStream that is used to
* stream in the files and data source.
*/
taskScheduler.scheduleDataArtifactIngestTasks(this);
}
@ -776,7 +778,7 @@ final class IngestJobExecutor {
* case database and streamed in, and the data source is now ready for
* analysis.
*/
void startStreamingModeDataSourceAnalysis() {
void addStreamedDataSource() {
synchronized (stageTransitionLock) {
logInfoMessage("Starting full first stage analysis in streaming mode"); //NON-NLS
stage = IngestJobExecutor.IngestJobStage.FILE_AND_HIGH_PRIORITY_DATA_SRC_LEVEL_ANALYSIS;
@ -858,6 +860,7 @@ final class IngestJobExecutor {
* discarded.
*/
private void startArtifactIngestProgressBar() {
if (usingNetBeansGUI) {
if (usingNetBeansGUI) {
SwingUtilities.invokeLater(() -> {
String displayName = NbBundle.getMessage(this.getClass(), "IngestJob.progress.dataArtifactIngest.displayName", this.dataSource.getName());
@ -875,6 +878,7 @@ final class IngestJobExecutor {
});
}
}
}
/**
* Starts a data source level analysis NetBeans progress bar in the lower
@ -885,18 +889,19 @@ final class IngestJobExecutor {
* cancellation occurs is NOT discarded.
*/
private void startDataSourceIngestProgressBar() {
if (usingNetBeansGUI) {
SwingUtilities.invokeLater(() -> {
String displayName = NbBundle.getMessage(this.getClass(), "IngestJob.progress.dataSourceIngest.initialDisplayName", dataSource.getName());
dataSourceIngestProgressBar = ProgressHandle.createHandle(displayName, new Cancellable() {
@Override
public boolean cancel() {
/*
* The user has already pressed the cancel button on this
* progress bar, and the OK button of a cancelation
* The user has already pressed the cancel button on
* this progress bar, and the OK button of a cancelation
* confirmation dialog supplied by NetBeans. Find out
* whether the user wants to cancel only the currently
* executing data source ingest module or the entire ingest
* job.
* executing data source ingest module or the entire
* ingest job.
*/
DataSourceIngestCancellationPanel panel = new DataSourceIngestCancellationPanel();
String dialogTitle = NbBundle.getMessage(IngestJobExecutor.this.getClass(), "IngestJob.cancellationDialog.title");
@ -917,6 +922,7 @@ final class IngestJobExecutor {
dataSourceIngestProgressBar.switchToIndeterminate();
});
}
}
private void finishProgressIndicators() {
if (usingNetBeansGUI) {
@ -947,6 +953,7 @@ final class IngestJobExecutor {
* discarded.
*/
private void startFileIngestProgressBar() {
if (usingNetBeansGUI) {
SwingUtilities.invokeLater(() -> {
String displayName = NbBundle.getMessage(getClass(), "IngestJob.progress.fileIngest.displayName", dataSource.getName());
fileIngestProgressBar = ProgressHandle.createHandle(displayName, new Cancellable() {
@ -962,6 +969,7 @@ final class IngestJobExecutor {
fileIngestProgressBar.switchToDeterminate((int) estimatedFilesToProcess);
});
}
}
/**
* Checks to see if the ingest tasks for the current stage of this job are
@ -1478,7 +1486,7 @@ final class IngestJobExecutor {
* @param message The message.
*/
private void logInfoMessage(String message) {
logger.log(Level.INFO, String.format("%s (data source = %s, object Id = %d, job id = %d)", message, dataSource.getName(), dataSource.getId(), getIngestJobId())); //NON-NLS
logger.log(Level.INFO, String.format("%s (data source = %s, data source object Id = %d, job id = %d)", message, dataSource.getName(), dataSource.getId(), getIngestJobId())); //NON-NLS
}
/**
@ -1490,7 +1498,7 @@ final class IngestJobExecutor {
* @param throwable The throwable associated with the error.
*/
private void logErrorMessage(Level level, String message, Throwable throwable) {
logger.log(level, String.format("%s (data source = %s, object Id = %d, ingest job id = %d)", message, dataSource.getName(), dataSource.getId(), getIngestJobId()), throwable); //NON-NLS
logger.log(level, String.format("%s (data source = %s, data source object Id = %d, ingest job id = %d)", message, dataSource.getName(), dataSource.getId(), getIngestJobId()), throwable); //NON-NLS
}
/**
@ -1501,7 +1509,7 @@ final class IngestJobExecutor {
* @param message The message.
*/
private void logErrorMessage(Level level, String message) {
logger.log(level, String.format("%s (data source = %s, object Id = %d, ingest job id %d)", message, dataSource.getName(), dataSource.getId(), getIngestJobId())); //NON-NLS
logger.log(level, String.format("%s (data source = %s, data source object Id = %d, ingest job id %d)", message, dataSource.getName(), dataSource.getId(), getIngestJobId())); //NON-NLS
}
/**
@ -1523,7 +1531,7 @@ final class IngestJobExecutor {
*/
private void logIngestModuleErrors(List<IngestModuleError> errors, AbstractFile file) {
for (IngestModuleError error : errors) {
logErrorMessage(Level.SEVERE, String.format("%s experienced an error during analysis while processing file %s, object ID %d", error.getModuleDisplayName(), file.getName(), file.getId()), error.getThrowable()); //NON-NLS
logErrorMessage(Level.SEVERE, String.format("%s experienced an error during analysis while processing file %s (object ID = %d)", error.getModuleDisplayName(), file.getName(), file.getId()), error.getThrowable()); //NON-NLS
}
}

View File

@ -1050,7 +1050,7 @@ public class IngestManager implements IngestProgressSnapshotProvider {
}
/**
* Creates and starts an ingest job for a collection of data sources.
* Creates and starts an ingest job.
*/
private final class StartIngestJobTask implements Callable<Void> {