14 #ifndef THRILL_API_WRITE_LINES_ONE_HEADER 15 #define THRILL_API_WRITE_LINES_ONE_HEADER 30 template <
typename ValueType>
33 static constexpr
bool debug =
false;
39 template <
typename ParentDIA>
43 { parent.id() }, { parent.node() }),
46 sLOG <<
"Creating write node.";
48 auto pre_op_fn = [
this](
const ValueType& input) {
53 auto lop_chain = parent.stack().push(pre_op_fn).fold();
54 parent.node()->AddChild(
this, lop_chain);
57 void PreOp(
const ValueType& input) {
70 <<
"class" <<
"WriteLinesOneNode" 80 file_.seekp(prefix_elem);
86 for (
size_t i = 0; i < num_items; ++i) {
87 file_ << reader.
Next<ValueType>() <<
'\n';
110 template <
typename ValueType,
typename Stack>
116 "WriteLinesOne needs an std::string as input parameter");
120 auto node = tlx::make_counting<WriteLinesOneNode>(*
this, filepath);
125 template <
typename ValueType,
typename Stack>
131 "WriteLinesOne needs an std::string as input parameter");
135 auto node = tlx::make_counting<WriteLinesOneNode>(*
this, filepath);
143 #endif // !THRILL_API_WRITE_LINES_ONE_HEADER void WriteLinesOne(const std::string &filepath) const
WriteLinesOne is an Action, which writes std::strings to a single output file.
std::string path_out_
Path of the output file.
net::FlowControlChannel & net
#define sLOG
Default logging method: output if the local debug variable is true.
data::File::Writer writer_
File writer used.
size_t num_workers() const
Global number of workers in the system.
A File is an ordered sequence of Block objects for storing items.
void Barrier()
A trivial global barrier.
TLX_ATTRIBUTE_ALWAYS_INLINE T Next()
Next() reads a complete item T.
void StopPreOp(size_t) final
Virtual method for preparing end of PushData.
T TLX_ATTRIBUTE_WARN_UNUSED_RESULT ExPrefixSum(const T &value, const BinarySumOp &sum_op=BinarySumOp(), const T &initial=T())
Calculates the exclusive prefix sum over all workers, given a certain sum operation.
BlockWriter contains a temporary Block object into which a) any serializable item can be stored or b)...
WriteLinesOneNode(const ParentDIA &parent, const std::string &path_out)
std::ofstream file_
File to write to.
Specialized template class for ActionFuture which return void.
data::File temp_file_
Temporary File for splitting correctly?
ConsumeReader GetConsumeReader(size_t prefetch_size=File::default_prefetch_size_)
Get consuming BlockReader for beginning of File.
BlockReader takes Block objects from BlockSource and allows reading of a) serializable Items or b) ar...
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
size_t my_rank() const
Global rank of this worker among all other workers in the system.
static constexpr bool debug
data::File GetFile(size_t dia_id)
Returns a new File object containing a sequence of local Blocks.
ActionNode(Context &ctx, const char *label, const std::initializer_list< size_t > &parent_ids, const std::initializer_list< DIABasePtr > &parents)
Future< void > WriteLinesOneFuture(const std::string &filepath) const
WriteLinesOne is an ActionFuture, which writes std::strings to a single output file.
common::JsonLogger logger_
TLX_ATTRIBUTE_ALWAYS_INLINE BlockWriter & Put(const T &x)
Put appends a complete item, or fails with a FullException.
void PreOp(const ValueType &input)
size_t num_items() const
Return the number of items in the file.
void Close()
Explicitly close the writer.
Writer GetWriter(size_t block_size=default_block_size)
Get BlockWriter.
void Execute() final
Closes the output file.
Context & context_
associated Context
size_t local_size_
Local file size.