Skip to content

Commit 875ff79

Browse files
Fix FileWatcherAssayIntegrationTest after FileLike refactor (#7244)
1 parent a73f7b3 commit 875ff79

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

api/src/org/labkey/api/reader/ExcelLoader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555

5656
import javax.xml.parsers.SAXParser;
5757
import javax.xml.parsers.SAXParserFactory;
58+
import java.io.BufferedInputStream;
5859
import java.io.File;
5960
import java.io.IOException;
6061
import java.io.InputStream;
@@ -114,7 +115,7 @@ public static boolean isExcel(final FileLike dataFile)
114115
{
115116
try
116117
{
117-
try (InputStream inputStream = dataFile.openInputStream())
118+
try (InputStream inputStream = new BufferedInputStream(dataFile.openInputStream()))
118119
{
119120
return ExcelLoader.FILE_TYPE.isType(dataFile.toNioPathForRead(), null, FileUtil.readHeader(inputStream, 8 * 1024));
120121
}

assay/src/org/labkey/assay/pipeline/AssayImportRunTask.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.labkey.api.exp.api.ExpProtocol;
3636
import org.labkey.api.exp.api.ExpRun;
3737
import org.labkey.api.exp.api.ExperimentService;
38-
import org.labkey.api.exp.pipeline.XarGeneratorId;
3938
import org.labkey.api.module.Module;
4039
import org.labkey.api.module.ModuleLoader;
4140
import org.labkey.api.pipeline.AbstractTaskFactory;
@@ -46,7 +45,6 @@
4645
import org.labkey.api.pipeline.PipelineValidationException;
4746
import org.labkey.api.pipeline.RecordedAction;
4847
import org.labkey.api.pipeline.RecordedActionSet;
49-
import org.labkey.api.pipeline.TaskFactory;
5048
import org.labkey.api.pipeline.TaskId;
5149
import org.labkey.api.pipeline.XMLBeanTaskFactoryFactory;
5250
import org.labkey.api.pipeline.file.AbstractFileAnalysisJob;
@@ -70,6 +68,7 @@
7068
import org.labkey.vfs.FileLike;
7169
import org.labkey.vfs.FileSystemLike;
7270

71+
import java.io.BufferedInputStream;
7372
import java.io.File;
7473
import java.io.IOException;
7574
import java.net.URI;
@@ -95,7 +94,7 @@ public class AssayImportRunTask extends PipelineJob.Task<AssayImportRunTask.Fact
9594
public static class FactoryFactory implements XMLBeanTaskFactoryFactory
9695
{
9796
@Override
98-
public TaskFactory create(TaskId taskId, TaskType xobj, Path taskDir)
97+
public Factory create(TaskId taskId, TaskType xobj, Path taskDir)
9998
{
10099
if (taskId.getModuleName() == null)
101100
throw new IllegalArgumentException("Task factory must be defined by a module");
@@ -245,7 +244,7 @@ List<Map<String, Object>> getRawData(PipelineJob job) throws PipelineJobExceptio
245244
{
246245
job.getLogger().info("Processing excel file: " + dataFile.getName());
247246
// check to see if this is a multi-sheet format
248-
try (ExcelLoader loader = new ExcelLoader(dataFile.openInputStream(), true, null))
247+
try (ExcelLoader loader = new ExcelLoader(new BufferedInputStream(dataFile.openInputStream()), true, null))
249248
{
250249
List<String> sheets = loader.getSheetNames();
251250
if (sheets.size() > 1)
@@ -424,8 +423,6 @@ private FileLike getExplodedZipDir(PipelineJob job, FileLike dataFile)
424423

425424
public static class Factory extends AbstractTaskFactory<AssayImportRunTaskFactorySettings, Factory>
426425
{
427-
private final FileType _outputType = XarGeneratorId.FT_PIPE_XAR_XML;
428-
429426
private String _providerName = "${" + PROVIDER_NAME_PROPERTY + "}";
430427
private String _protocolName = "${" + PROTOCOL_NAME_PROPERTY + "}";
431428

@@ -434,7 +431,7 @@ public Factory()
434431
super(AssayImportRunTaskId.class);
435432
}
436433

437-
public Factory(Class namespaceClass)
434+
public Factory(Class<?> namespaceClass)
438435
{
439436
super(namespaceClass);
440437
}
@@ -468,11 +465,6 @@ public List<FileType> getInputTypes()
468465
return Collections.emptyList();
469466
}
470467

471-
public FileType getOutputType()
472-
{
473-
return _outputType;
474-
}
475-
476468
@Override
477469
public String getStatusName()
478470
{
@@ -802,7 +794,7 @@ public RecordedActionSet run() throws PipelineJobException
802794
createData(matchedFile, assayDataType);
803795

804796

805-
AssayRunUploadContext.Factory<? extends AssayProvider, ? extends AssayRunUploadContext.Factory> factory
797+
AssayRunUploadContext.Factory<? extends AssayProvider, ? extends AssayRunUploadContext.Factory<?, ?>> factory
806798
= provider.createRunUploadFactory(protocol, user, container);
807799

808800
factory.setName(getName());
@@ -828,7 +820,7 @@ public RecordedActionSet run() throws PipelineJobException
828820

829821
factory.setLogger(getJob().getLogger());
830822

831-
AssayRunUploadContext uploadContext = factory.create();
823+
AssayRunUploadContext<?> uploadContext = factory.create();
832824

833825
Long batchId = null;
834826

@@ -857,7 +849,7 @@ public RecordedActionSet run() throws PipelineJobException
857849
// }
858850

859851
// Check if we've been cancelled. If so, delete any newly created runs from the database
860-
PipelineStatusFile statusFile = PipelineService.get().getStatusFile(getJob().getLogFile());
852+
PipelineStatusFile statusFile = PipelineService.get().getStatusFile(getJob().getContainer(), getJob().getLogFileLike());
861853
if (statusFile != null && (PipelineJob.TaskStatus.cancelled.matches(statusFile.getStatus()) || PipelineJob.TaskStatus.cancelling.matches(statusFile.getStatus())))
862854
{
863855
getJob().info("Deleting run " + run.getName() + " due to cancellation request");

0 commit comments

Comments
 (0)