1 #ifndef _PROCESSING_HISTORY_H_
2 #define _PROCESSING_HISTORY_H_
7 #include <boost/serialization/map.hpp>
8 #include <boost/serialization/serialization.hpp>
9 #include <boost/uuid/uuid.hpp>
10 #include <boost/uuid/uuid_generators.hpp>
11 #include <boost/uuid/uuid_io.hpp>
12 #include <boost/uuid/uuid_serialize.hpp>
13 #include <boost/archive/text_iarchive.hpp>
14 #include <boost/archive/text_oarchive.hpp>
15 #include "mspass/utility/ErrorLogger.h"
24 enum class ProcessingStatus
65 const std::string SAVED_ID_KEY(
"NODEDATA_AT_SAVE");
97 std::string jobid()
const
101 void set_jobid(
const std::string& newjid)
105 std::string jobname()
const
109 void set_jobname(
const std::string jobname)
113 BasicProcessingHistory& operator=(
const BasicProcessingHistory& parent)
126 friend boost::serialization::access;
127 template<
class Archive>
128 void serialize(Archive& ar,
const unsigned int version)
146 mspass::utility::ProcessingStatus
status;
150 mspass::utility::AtomicType
type;
177 bool operator==(
const NodeData& other);
178 bool operator!=(
const NodeData& other);
180 friend boost::serialization::access;
181 template<
class Archive>
182 void serialize(Archive& ar,
const unsigned int version)
350 void set_as_origin(
const std::string alg,
const std::string algid,
351 const std::string uuid,
const AtomicType typ,
bool define_as_raw=
false);
400 const AtomicType typ,
const std::vector<ProcessingHistory*> parents,
401 const bool create_newid=
true);
453 void accumulate(
const std::string alg,
const std::string algid,
504 std::string
new_map(
const std::string alg,
const std::string algid,
505 const AtomicType typ,
506 const ProcessingStatus newstatus=ProcessingStatus::VOLATILE);
535 std::string
new_map(
const std::string alg,
const std::string algid,
536 const AtomicType typ,
538 const ProcessingStatus newstatus=ProcessingStatus::VOLATILE);
575 std::string
map_as_saved(
const std::string alg,
const std::string algid,
576 const AtomicType typ);
585 std::multimap<std::string,mspass::utility::NodeData>
get_nodes()
const;
597 return current_stage;
602 return current_status;
609 std::string
id()
const
616 std::pair<std::string,std::string> result(algorithm,algid);
671 std::list<mspass::utility::NodeData>
inputs(
const std::string id_to_find)
const;
683 std::multimap<std::string,mspass::utility::NodeData> nodes;
689 ProcessingStatus current_status;
691 std::string current_id;
694 std::string algorithm;
698 friend boost::serialization::access;
699 template<
class Archive>
700 void serialize(Archive& ar,
const unsigned int version)
702 ar & boost::serialization::base_object<BasicProcessingHistory>(*
this);
730 template <
typename Tdata>
731 void append_input(
const Tdata& d, ProcessingHistory& his)
735 const ProcessingHistory *ptr=
dynamic_cast<const ProcessingHistory*
>(&d);
736 his.add_one_input(*ptr);
756 std::list<std::tuple<int,std::string,std::string>>
757 algorithm_history(
const ProcessingHistory& h);
777 std::list<std::string> algorithm_outputs(
const ProcessingHistory& h,
778 const std::string alg,
const std::string algid);
Definition: ProcessingHistory.h:70
virtual size_t number_of_stages()
Definition: ProcessingHistory.h:96
Container to hold error logs for a data object.
Definition: ErrorLogger.h:61
Holds properties of data used as input to algorithm that created this object.
Definition: ProcessingHistory.h:143
std::string algorithm
Name of algorithm algorithm applied at this stage.
Definition: ProcessingHistory.h:161
std::string uuid
Definition: ProcessingHistory.h:148
mspass::utility::ProcessingStatus status
Definition: ProcessingHistory.h:146
int stage
Definition: ProcessingHistory.h:152
std::string algid
Definition: ProcessingHistory.h:171
mspass::utility::AtomicType type
Definition: ProcessingHistory.h:150
Lightweight class to preserve procesing chain of atomic objects.
Definition: ProcessingHistory.h:258
size_t number_of_stages() override
Return number of processing stages that have been applied to this object.
Definition: ProcessingHistory.cc:148
void set_as_origin(const std::string alg, const std::string algid, const std::string uuid, const AtomicType typ, bool define_as_raw=false)
Definition: ProcessingHistory.cc:161
NodeData current_nodedata() const
Definition: ProcessingHistory.cc:712
ProcessingStatus status() const
Definition: ProcessingHistory.h:600
ProcessingHistory(const std::string jobnm, const std::string jid)
bool is_saved() const
Definition: ProcessingHistory.cc:141
void clear()
Definition: ProcessingHistory.cc:677
bool is_raw() const
Definition: ProcessingHistory.cc:120
bool is_origin() const
Definition: ProcessingHistory.cc:127
void merge(const ProcessingHistory &data_to_add)
Merge the history nodes from another.
Definition: ProcessingHistory.cc:463
std::pair< std::string, std::string > created_by() const
Definition: ProcessingHistory.h:614
std::multimap< std::string, mspass::utility::NodeData > get_nodes() const
Definition: ProcessingHistory.cc:657
void add_many_inputs(const std::vector< ProcessingHistory * > &d)
Define several data objects as inputs.
Definition: ProcessingHistory.cc:334
std::string new_map(const std::string alg, const std::string algid, const AtomicType typ, const ProcessingStatus newstatus=ProcessingStatus::VOLATILE)
Define this algorithm as a one-to-one map of same type data.
ProcessingHistory()
Definition: ProcessingHistory.cc:86
int number_inputs() const
Definition: ProcessingHistory.cc:696
bool is_volatile() const
Definition: ProcessingHistory.cc:134
bool is_empty() const
Definition: ProcessingHistory.cc:114
int number_inputs(const std::string uuidstr) const
std::string new_ensemble_process(const std::string alg, const std::string algid, const AtomicType typ, const std::vector< ProcessingHistory * > parents, const bool create_newid=true)
Definition: ProcessingHistory.cc:187
std::string newid()
Definition: ProcessingHistory.cc:700
std::string map_as_saved(const std::string alg, const std::string algid, const AtomicType typ)
Prepare the current data for saving.
Definition: ProcessingHistory.cc:420
ProcessingHistory & operator=(const ProcessingHistory &parent)
Definition: ProcessingHistory.cc:741
void add_one_input(const ProcessingHistory &data_to_add)
Add one datum as an input for current data.
Definition: ProcessingHistory.cc:285
std::string id() const
Definition: ProcessingHistory.h:609
std::string new_map(const std::string alg, const std::string algid, const AtomicType typ, const ProcessingHistory &data_to_clone, const ProcessingStatus newstatus=ProcessingStatus::VOLATILE)
Define this algorithm as a one-to-one map.
void set_id(const std::string newid)
Definition: ProcessingHistory.cc:708
std::list< mspass::utility::NodeData > inputs(const std::string id_to_find) const
Return a list of data that define the inputs to a give uuids.
Definition: ProcessingHistory.cc:724
std::string clean_accumulate_uuids()
Clean up inconsistent uuids that can be produced by reduce.
Definition: ProcessingHistory.cc:584
void accumulate(const std::string alg, const std::string algid, const AtomicType typ, const ProcessingHistory &newinput)
Method to use with a spark reduce algorithm.
Definition: ProcessingHistory.cc:509
int stage() const
Definition: ProcessingHistory.h:595