14 #ifndef THRILL_API_WRITE_LINES_HEADER 15 #define THRILL_API_WRITE_LINES_HEADER 32 template <
typename ValueType>
35 static constexpr
bool debug =
false;
44 template <
typename ParentDIA>
47 size_t target_file_size)
48 :
Super(parent.ctx(),
"WriteLines",
49 { parent.id() }, { parent.node() }),
55 sLOG <<
"Creating write node.";
67 auto lop_chain = parent.stack().push(pre_op_fn).fold();
68 parent.node()->AddChild(
this, lop_chain);
98 LOG <<
"Opening file: " << new_path;
108 stream_->write(input.data(), input.size());
123 sLOG <<
"closing file";
132 <<
"class" <<
"WriteLinesNode" 138 <<
"write_time" <<
timer;
175 template <
typename ValueType,
typename Stack>
177 const std::string& filepath,
size_t target_file_size)
const {
181 "WriteLines needs an std::string as input parameter");
185 auto node = tlx::make_counting<WriteLinesNode>(
186 *
this, filepath, target_file_size);
191 template <
typename ValueType,
typename Stack>
193 const std::string& filepath,
size_t target_file_size)
const {
197 "WriteLines needs an std::string as input parameter");
201 auto node = tlx::make_counting<WriteLinesNode>(
202 *
this, filepath, target_file_size);
210 #endif // !THRILL_API_WRITE_LINES_HEADER size_t size() const
Return the currently used length in bytes.
#define sLOG
Default logging method: output if the local debug variable is true.
Description of the amount of RAM the internal data structures of a DIANode require.
common::StatsTimerStopped timer
BufferBuilder & AppendString(const std::string &s)
void Execute() final
Virtual execution method. Triggers actual computation in sub-classes.
WriteLinesNode(const ParentDIA &parent, const std::string &path_out, size_t target_file_size)
size_t default_block_size
default size of blocks in File, Channel, BlockQueue, etc.
std::string FillFilePattern(const std::string &pathbase, size_t worker, size_t file_part)
BufferBuilder & PutByte(Byte data)
Put a single byte to the buffer (used via CRTP from ItemWriterToolsBase)
void StopPreOp(size_t) final
Closes the output file, write last buffer.
void WriteLines(const std::string &filepath, size_t target_file_size=128 *1024 *1024) const
WriteLines is an Action, which writes std::strings to multiple output files.
size_t current_buffer_size_
Current buffer size.
Future< void > WriteLinesFuture(const std::string &filepath, size_t target_file_size=128 *1024 *1024) const
WriteLines is an ActionFuture, which writes std::strings to multiple output files.
ValueType ValueType_
input type is the parent's output value type.
size_t target_file_size_
Targetl file size in bytes.
size_t out_serial_
File serial number for this worker.
const Byte * data() const
Return a pointer to the currently kept memory area.
Specialized template class for ActionFuture which return void.
net::BufferBuilder write_buffer_
Write buffer.
size_t max_buffer_size_
Maximum buffer size.
void PreOp(const std::string &input)
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.
void StartPreOp(size_t) final
Virtual method for preparing start of PushData.
ActionNode(Context &ctx, const char *label, const std::initializer_list< size_t > &parent_ids, const std::initializer_list< DIABasePtr > &parents)
static uint_pair min()
return an uint_pair instance containing the smallest value possible
BufferBuilder & Reserve(size_t n)
Make sure that at least n bytes are allocated.
std::string out_pathbase_
Base path of the output file.
BufferBuilder represents a dynamically growable area of memory, which can be modified by appending in...
common::JsonLogger logger_
size_t stats_total_bytes_
static int round_up_to_power_of_two(int i)
does what it says: round up to next power of two
size_t current_file_size_
Current file size in bytes.
vfs::WriteStreamPtr stream_
File to wrtie to.
#define LOG
Default logging method: output if the local debug variable is true.
size_t stats_total_writes_
WriteStreamPtr OpenWriteStream(const std::string &path)
DIAMemUse PreOpMemUse() final
Amount of RAM used by PreOp after StartPreOp()
BufferBuilder & set_size(size_t n)
Context & context_
associated Context
static constexpr bool debug
size_t stats_total_elements_