Merge pull request #6813 from rcordovano/7314-fix-file-ingest-module-progress-reporting

7314 fix file ingest module progress reporting
This commit is contained in:
Richard Cordovano 2021-03-23 16:14:40 -04:00 committed by GitHub
commit 240ca5c3b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 43 deletions

View File

@ -1,4 +1,5 @@
CTL_RunIngestAction=Run Ingest
FileIngestPipeline_SaveResults_Activity=Saving Results
IngestJobSettingsPanel.IngestModulesTableRenderer.info.message=A previous version of this ingest module has been run before on this data source.
IngestJobSettingsPanel.IngestModulesTableRenderer.warning.message=This ingest module has been run before on this data source.
IngestJobSettingsPanel.noPerRunSettings=The selected module has no per-run settings.

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.ingest;
import java.util.List;
import java.util.Optional;
import org.openide.util.NbBundle;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskCoreException;
@ -60,7 +61,11 @@ final class FileIngestPipeline extends IngestTaskPipeline<FileIngestTask> {
}
@Override
@NbBundle.Messages({
"FileIngestPipeline_SaveResults_Activity=Saving Results"
})
void completeTask(FileIngestTask task) throws IngestTaskPipelineException {
ingestManager.setIngestTaskProgress(task, Bundle.FileIngestPipeline_SaveResults_Activity());
AbstractFile file = null;
try {
file = task.getFile();

View File

@ -769,67 +769,65 @@ public class IngestManager implements IngestProgressSnapshotProvider {
}
/**
* Updates the ingest job snapshot when a data source level ingest job task
* starts to be processd by a data source ingest module in the data source
* ingest modules pipeline of an ingest job.
* Updates the ingest progress snapshot when a new ingest module starts
* working on a data source level ingest task.
*
* @param task The data source level ingest job task that
* was started.
* @param ingestModuleDisplayName The dislpay name of the data source level
* ingest module that has started processing
* the task.
* @param task The data source ingest task.
* @param currentModuleName The display name of the currently processing
* module.
*/
void setIngestTaskProgress(DataSourceIngestTask task, String ingestModuleDisplayName) {
ingestThreadActivitySnapshots.put(task.getThreadId(), new IngestThreadActivitySnapshot(task.getThreadId(), task.getIngestJobPipeline().getId(), ingestModuleDisplayName, task.getDataSource()));
}
/**
* Updates the ingest job snapshot when a file source level ingest job task
* starts to be processed by a file level ingest module in the file ingest
* modules pipeline of an ingest job.
*
* @param task The file level ingest job task that was
* started.
* @param ingestModuleDisplayName The dislpay name of the file level ingest
* module that has started processing the
* task.
*/
void setIngestTaskProgress(FileIngestTask task, String ingestModuleDisplayName) {
void setIngestTaskProgress(DataSourceIngestTask task, String currentModuleName) {
IngestThreadActivitySnapshot prevSnap = ingestThreadActivitySnapshots.get(task.getThreadId());
IngestThreadActivitySnapshot newSnap;
try {
newSnap = new IngestThreadActivitySnapshot(task.getThreadId(), task.getIngestJobPipeline().getId(), ingestModuleDisplayName, task.getDataSource(), task.getFile());
} catch (TskCoreException ex) {
// In practice, this task would never have been enqueued or processed since the file
// lookup would have failed.
newSnap = new IngestThreadActivitySnapshot(task.getThreadId(), task.getIngestJobPipeline().getId(), ingestModuleDisplayName, task.getDataSource());
}
IngestThreadActivitySnapshot newSnap = new IngestThreadActivitySnapshot(task.getThreadId(), task.getIngestJobPipeline().getId(), currentModuleName, task.getDataSource());
ingestThreadActivitySnapshots.put(task.getThreadId(), newSnap);
/*
* Update the total run time for the PREVIOUS ingest module in the
* pipeline, which has now finished its processing for the task.
*/
incrementModuleRunTime(prevSnap.getActivity(), newSnap.getStartTime().getTime() - prevSnap.getStartTime().getTime());
}
/**
* Updates the ingest job snapshot when a data source level ingest job task
* is completed by the data source ingest modules in the data source ingest
* modules pipeline of an ingest job.
* Updates the ingest progress snapshot when a new ingest module starts
* working on a file ingest task.
*
* @param task The data source level ingest job task that was completed.
* @param task The file ingest task.
* @param currentModuleName The display name of the currently processing
* module.
*/
void setIngestTaskProgressCompleted(DataSourceIngestTask task) {
ingestThreadActivitySnapshots.put(task.getThreadId(), new IngestThreadActivitySnapshot(task.getThreadId()));
void setIngestTaskProgress(FileIngestTask task, String currentModuleName) {
IngestThreadActivitySnapshot prevSnap = ingestThreadActivitySnapshots.get(task.getThreadId());
IngestThreadActivitySnapshot newSnap;
try {
newSnap = new IngestThreadActivitySnapshot(task.getThreadId(), task.getIngestJobPipeline().getId(), currentModuleName, task.getDataSource(), task.getFile());
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error getting file from file ingest task", ex);
newSnap = new IngestThreadActivitySnapshot(task.getThreadId(), task.getIngestJobPipeline().getId(), currentModuleName, task.getDataSource());
}
ingestThreadActivitySnapshots.put(task.getThreadId(), newSnap);
/*
* Update the total run time for the PREVIOUS ingest module in the
* pipeline, which has now finished its processing for the task.
*/
incrementModuleRunTime(prevSnap.getActivity(), newSnap.getStartTime().getTime() - prevSnap.getStartTime().getTime());
}
/**
* Updates the ingest job snapshot when a file level ingest job task is
* completed by the file ingest modules in the file ingest modules pipeline
* of an ingest job.
* Updates the ingest progress snapshot when an ingest task is completed.
*
* @param task The file level ingest job task that was completed.
* @param task The ingest task.
*/
void setIngestTaskProgressCompleted(FileIngestTask task) {
void setIngestTaskProgressCompleted(IngestTask task) {
IngestThreadActivitySnapshot prevSnap = ingestThreadActivitySnapshots.get(task.getThreadId());
IngestThreadActivitySnapshot newSnap = new IngestThreadActivitySnapshot(task.getThreadId());
ingestThreadActivitySnapshots.put(task.getThreadId(), newSnap);
/*
* Update the total run time for the LAST ingest module in the pipeline,
* which has now finished its processing for the task.
*/
incrementModuleRunTime(prevSnap.getActivity(), newSnap.getStartTime().getTime() - prevSnap.getStartTime().getTime());
}