public class FactFileListMultiStream
extends stream.io.multi.AbstractMultiStream
[ { "drs_path":"\/fact\/raw\/2014\/10\/02\/20141002_193.drs.fits.gz", "data_path":"\/fact\/raw\/2014\/10\/02\/20141002_185.fits.fz", ... }, {...} ]
and creates a single stream for the files listed. The dictionaries in the json may of course contain more keys. The 'drsPathKey' and `dataPathKey` parameter define the names of the keys to the file paths. So in the example above they would need to be set to "drs_path" and "data_path" which are the default values. A key called '@drsFile' will be injected into the DataStream by this multistream. That means when you're using this stream you don't need to set the `url` parameter of the DrsCalibration processor. If the underlying stream throws an IOexception in case of missing files, the next file will be tried when the skipErrors flag is set.
Created by mackaiver on 4/10/15.
Modifier and Type | Field and Description |
---|---|
String |
dataPathKey |
String |
drsPathKey |
BlockingQueue<fact.io.FactFileListMultiStream.DataDrsPair> |
fileQueue |
boolean |
skipEmpty |
boolean |
skipErrors |
stream.io.SourceURL |
url |
activate, activeWrapper, additionOrder, streams
Constructor and Description |
---|
FactFileListMultiStream(stream.io.SourceURL url) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
init()
Read the json file provided by the url parameter and build a queue of File objects to be analyzed
|
stream.Data |
readNext() |
void |
setUrl(stream.io.SourceURL url) |
addStream, getActivate, getStreams, setActivate
getId, getInputStream, getLimit, getPrefix, getSequenceKey, getUrl, read, setId, setLimit, setPrefix, setSequenceKey
public final BlockingQueue<fact.io.FactFileListMultiStream.DataDrsPair> fileQueue
@Parameter(required=true, description="A file containing a json array of dicts with the paths to the files.") public stream.io.SourceURL url
@Parameter(required=false, description="Flag indicating whether next file should be tried in case of errors in underlying stream.", defaultValue="false") public boolean skipErrors
@Parameter(required=false, description="Similar to skipErrors but will only skip the MissingHDU exception, i.e. empty files", defaultValue="false") public boolean skipEmpty
@Parameter(required=false, defaultValue="drs_path") public String drsPathKey
@Parameter(required=false, defaultValue="data_path") public String dataPathKey
public void init() throws Exception
init
in interface stream.io.Source
init
in class stream.io.multi.AbstractMultiStream
Exception
- might be thrown in case the json cannot be read.public stream.Data readNext() throws Exception
readNext
in class stream.io.AbstractStream
Exception
public void close() throws Exception
close
in interface stream.io.Source
close
in class stream.io.multi.AbstractMultiStream
Exception
public void setUrl(stream.io.SourceURL url)
setUrl
in class stream.io.AbstractStream
Copyright © 2019. All rights reserved.