-
Notifications
You must be signed in to change notification settings - Fork 494
TimeframeReader and TimeframeWriter devices #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,3 +58,7 @@ compile_commands.json | |
| .idea | ||
| .settings | ||
| .ycm_extra_conf.py | ||
|
|
||
| # Datafiles | ||
| *.root | ||
| *.o2tf | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| #ifndef SUBFRAMEMETADATA_H | ||
| #define SUBFRAMEMETADATA_H | ||
|
|
||
| #include <vector> | ||
|
|
||
| namespace o2 { | ||
| namespace DataFlow { | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| .\" Manpage for TimeframeReaderDevice. | ||
| .TH man 1 "12 May 2017" "1.0" "TimeframeReaderDevice man page" | ||
|
|
||
| .SH NAME | ||
|
|
||
| TimeframeReaderDevice - read a timeframe from disk | ||
|
|
||
| .SH SYNOPSIS | ||
|
|
||
| TimeframeReaderDevice --input-file [FILE] | ||
|
|
||
| .SH DESCRIPTION | ||
|
|
||
| TimeframeReaderDevice will read a Timeframe from the FILE on disk and streams it | ||
| via FairMQ | ||
|
|
||
| .SH OPTIONS | ||
|
|
||
| .TP 5 | ||
|
|
||
| --input-file [FILE] the file to be streamed | ||
|
|
||
| .SH SEE ALSO | ||
|
|
||
| TimeframeWriterDevice(1) | ||
|
|
||
| .SH BUGS | ||
|
|
||
| Lots of bugs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| .\" Manpage for TimeframeWriterDevice. | ||
| .TH man 1 "12 May 2017" "1.0" "TimeframeWriterDevice man page" | ||
|
|
||
| .SH NAME | ||
|
|
||
| TimeframeWriterDevice - writes a timeframe to disk | ||
|
|
||
| .SH SYNOPSIS | ||
|
|
||
| TimeframeWriterDevice --input-file [FILE] | ||
|
|
||
| .SH DESCRIPTION | ||
|
|
||
| TimeframeWriterDevice will receive a Timeframe from FairMQ transport and stream | ||
| it via FairMQ. | ||
|
|
||
| .SH OPTIONS | ||
|
|
||
| .TP 5 | ||
|
|
||
| --output-file [FILE] the file where to stream results | ||
|
|
||
| .SH SEE ALSO | ||
|
|
||
| TimeframeReaderDevice(1) | ||
|
|
||
| .SH BUGS | ||
|
|
||
| Lots of bugs |
23 changes: 23 additions & 0 deletions
23
Utilities/DataFlow/include/DataFlow/FakeTimeframeBuilder.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #ifndef DATAFLOW_FAKETIMEFRAMEBUILDER_H_ | ||
| #define DATAFLOW_FAKETIMEFRAMEBUILDER_H_ | ||
|
|
||
| #include "Headers/DataHeader.h" | ||
| #include <vector> | ||
| #include <memory> | ||
| #include <functional> | ||
|
|
||
| namespace o2 { namespace DataFlow { | ||
|
|
||
| struct FakeTimeframeSpec { | ||
| const char *origin; | ||
| const char *dataDescription; | ||
| std::function<void(char *, size_t)> bufferFiller; | ||
| size_t bufferSize; | ||
| }; | ||
|
|
||
| /** Generate a timeframe from the provided specification | ||
| */ | ||
| std::unique_ptr<char[]> fakeTimeframeGenerator(std::vector<FakeTimeframeSpec> &specs, std::size_t &totalSize); | ||
|
|
||
| }} | ||
| #endif /* DATAFLOW_FAKETIMEFRAMEBUILDER_H_ */ |
36 changes: 36 additions & 0 deletions
36
Utilities/DataFlow/include/DataFlow/FakeTimeframeGeneratorDevice.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #ifndef ALICEO2_FAKE_TIMEFRAME_GENERATOR_H_ | ||
| #define ALICEO2_FAKE_TIMEFRAME_GENERATOR_H_ | ||
|
|
||
| #include "O2Device/O2Device.h" | ||
|
|
||
| namespace o2 { | ||
| namespace DataFlow { | ||
|
|
||
| /// A device which writes to file the timeframes. | ||
| class FakeTimeframeGeneratorDevice : public Base::O2Device | ||
| { | ||
| public: | ||
| static constexpr const char* OptionKeyOutputChannelName = "output-channel-name"; | ||
| static constexpr const char* OptionKeyMaxTimeframes = "max-timeframes"; | ||
|
|
||
| /// Default constructor | ||
| FakeTimeframeGeneratorDevice(); | ||
|
|
||
| /// Default destructor | ||
| ~FakeTimeframeGeneratorDevice() override = default; | ||
|
|
||
| void InitTask() final; | ||
|
|
||
| protected: | ||
| /// Overloads the ConditionalRun() method of FairMQDevice | ||
| bool ConditionalRun() final; | ||
|
|
||
| std::string mOutChannelName; | ||
| size_t mMaxTimeframes; | ||
| size_t mTimeframeCount; | ||
| }; | ||
|
|
||
| } // namespace DataFlow | ||
| } // namespace o2 | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #ifndef TIMEFRAME_PARSER_H_ | ||
| #define TIMEFRAME_PARSER_H_ | ||
|
|
||
| #include <iosfwd> | ||
| #include <functional> | ||
|
|
||
| class FairMQParts; | ||
|
|
||
| namespace o2 { namespace DataFlow { | ||
|
|
||
| /// An helper function which takes a std::istream pointing | ||
| /// to a naively persisted timeframe and pumps its parts to | ||
| /// FairMQParts, ready to be shipped via FairMQ. | ||
| void streamTimeframe(std::istream &stream, | ||
| std::function<void(FairMQParts &parts, char *buffer, size_t size)> onAddPart, | ||
| std::function<void(FairMQParts &parts)> onSend); | ||
|
|
||
| void streamTimeframe(std::ostream &stream, FairMQParts &parts); | ||
|
|
||
| } } // end | ||
|
|
||
| #endif // TIMEFRAME_PARSER_H |
38 changes: 38 additions & 0 deletions
38
Utilities/DataFlow/include/DataFlow/TimeframeReaderDevice.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #ifndef ALICEO2_TIMEFRAME_READER_H_ | ||
| #define ALICEO2_TIMEFRAME_READER_H_ | ||
|
|
||
| #include "O2Device/O2Device.h" | ||
| #include <fstream> | ||
|
|
||
| namespace o2 { | ||
| namespace DataFlow { | ||
|
|
||
| /// A device which writes to file the timeframes. | ||
| class TimeframeReaderDevice : public Base::O2Device | ||
| { | ||
| public: | ||
| static constexpr const char* OptionKeyOutputChannelName = "output-channel-name"; | ||
| static constexpr const char* OptionKeyInputFileName = "input-file"; | ||
|
|
||
| /// Default constructor | ||
| TimeframeReaderDevice(); | ||
|
|
||
| /// Default destructor | ||
| ~TimeframeReaderDevice() override = default; | ||
|
|
||
| void InitTask() final; | ||
|
|
||
| protected: | ||
| /// Overloads the ConditionalRun() method of FairMQDevice | ||
| bool ConditionalRun() final; | ||
|
|
||
| std::string mOutChannelName; | ||
| std::string mInFileName; | ||
| std::fstream mFile; | ||
| std::vector<std::string> mSeen; | ||
| }; | ||
|
|
||
| } // namespace DataFlow | ||
| } // namespace o2 | ||
|
|
||
| #endif |
47 changes: 47 additions & 0 deletions
47
Utilities/DataFlow/include/DataFlow/TimeframeWriterDevice.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #ifndef ALICEO2_TIMEFRAME_WRITER_DEVICE_H_ | ||
| #define ALICEO2_TIMEFRAME_WRITER_DEVICE_H_ | ||
|
|
||
| #include "O2Device/O2Device.h" | ||
| #include <fstream> | ||
|
|
||
| namespace o2 { | ||
| namespace DataFlow { | ||
|
|
||
| /// A device which writes to file the timeframes. | ||
| class TimeframeWriterDevice : public Base::O2Device | ||
| { | ||
| public: | ||
| static constexpr const char* OptionKeyInputChannelName = "input-channel-name"; | ||
| static constexpr const char* OptionKeyOutputFileName = "output-file"; | ||
| static constexpr const char* OptionKeyMaxTimeframesPerFile = "max-timeframes-per-file"; | ||
| static constexpr const char* OptionKeyMaxFileSize = "max-file-size"; | ||
| static constexpr const char* OptionKeyMaxFiles = "max-files"; | ||
|
|
||
| /// Default constructor | ||
| TimeframeWriterDevice(); | ||
|
|
||
| /// Default destructor | ||
| ~TimeframeWriterDevice() override = default; | ||
|
|
||
| void InitTask() final; | ||
|
|
||
| /// The PostRun will trigger saving the file to disk | ||
| void PostRun() final; | ||
|
|
||
| protected: | ||
| /// Overloads the Run() method of FairMQDevice | ||
| void Run() final; | ||
|
|
||
| std::string mInChannelName; | ||
| std::string mOutFileName; | ||
| std::fstream mFile; | ||
| size_t mMaxTimeframes; | ||
| size_t mMaxFileSize; | ||
| size_t mMaxFiles; | ||
| size_t mFileCount; | ||
| }; | ||
|
|
||
| } // namespace DataFlow | ||
| } // namespace o2 | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| { | ||
| "fairMQOptions": | ||
| { | ||
| "devices": | ||
| [ | ||
| { | ||
| "id": "FakeTimeframeGeneratorDevice", | ||
| "channels": | ||
| [ | ||
| { | ||
| "name": "output", | ||
| "type": "pub", | ||
| "method": "bind", | ||
| "sockets": | ||
| [ | ||
| { "address": "tcp://*:5550" } | ||
| ], | ||
| "sndBufSize": "10" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "id": "TimeframeWriterDevice", | ||
| "channels": | ||
| [ | ||
| { | ||
| "name": "input", | ||
| "type": "sub", | ||
| "method": "connect", | ||
| "sockets": | ||
| [ | ||
| { "address": "tcp://127.0.0.1:5550"} | ||
| ], | ||
| "sndBufSize": "10" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "id": "TimeframeReaderDevice", | ||
| "channels": | ||
| [ | ||
| { | ||
| "name": "output", | ||
| "type": "pub", | ||
| "method": "bind", | ||
| "sockets": | ||
| [ | ||
| { "address": "tcp://127.0.0.1:5551"} | ||
| ], | ||
| "sndBufSize": "10" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "id": "TimeframeValidatorDevice", | ||
| "channels": | ||
| [ | ||
| { | ||
| "name": "input", | ||
| "type": "sub", | ||
| "method": "connect", | ||
| "sockets": | ||
| [ | ||
| { "address": "tcp://127.0.0.1:5551"} | ||
| ], | ||
| "sndBufSize": "10" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is currently required to avoid that including
SubframeMetadata.hrequires includingvectorbefore it. What we really should do is to clean up SubframeMetadata.h and remove the variousTPCTestClusterandITSRawDataclasses which we are currently using to mockup the timeframe.