Files
daggy/libdaggy/include/daggy/Serialization.hpp
Ian Roddis 470a6f2bb7 Large re-organization to split daggyd away from the core libdaggy.
This paves the way for implementing daggys and other utilities.

Squashed commit of the following:

commit 1f77239ab3c9e44d190eef94531a39501c8c4dfe
Author: Ian Roddis <gitlab@ie2r.com>
Date:   Mon Oct 18 16:25:02 2021 -0300

    Adding README, stdout support for daggyd logging

commit c2c237224e84a3be68aaa597ce98af1365e74a13
Author: Ian Roddis <gitlab@ie2r.com>
Date:   Mon Oct 18 16:10:29 2021 -0300

    removing old daggyd

commit cfea2baf61ca10c535801c5a391d2d525a1a2d04
Author: Ian Roddis <gitlab@ie2r.com>
Date:   Mon Oct 18 16:10:09 2021 -0300

    Moving tests into their sub-project folders

commit e41ca42069bea1db16dd76b6684a3f692fef6b15
Author: Ian Roddis <gitlab@ie2r.com>
Date:   Mon Oct 18 15:57:40 2021 -0300

    Splitting out daggyd from libdaggy

commit be97b146c1d2446f5c03cb78707e921f18c60bd8
Author: Ian Roddis <gitlab@ie2r.com>
Date:   Mon Oct 18 15:56:55 2021 -0300

    Splitting out daggyd from libdaggy

commit cb61e140e9d6d8832d61fb7037fd4c0ff6edad00
Author: Ian Roddis <gitlab@ie2r.com>
Date:   Mon Oct 18 15:49:47 2021 -0300

    moving daggy to libdaggy
2021-10-18 16:28:40 -03:00

69 lines
2.0 KiB
C++

#pragma once
#include <rapidjson/document.h>
#include <string>
#include <unordered_map>
#include <variant>
#include <vector>
#include "Defines.hpp"
#include "Utilities.hpp"
#include "loggers/dag_run/Defines.hpp"
namespace rj = rapidjson;
namespace daggy {
void checkRJParse(const rj::ParseResult &result,
const std::string &prefix = "");
std::string dumpJSON(const rj::Value &doc);
// Parameters
ConfigValues configFromJSON(const std::string &jsonSpec);
ConfigValues configFromJSON(const rj::Value &spec);
std::string configToJSON(const ConfigValues &config);
// Tasks
Task taskFromJSON(const std::string &name, const rj::Value &spec,
const ConfigValues &jobDefaults = {});
Task taskFromJSON(const std::string &name, const std::string &spec,
const ConfigValues &jobDefaults = {});
TaskSet tasksFromJSON(const std::string &jsonSpec,
const ConfigValues &jobDefaults = {});
TaskSet tasksFromJSON(const rj::Value &spec,
const ConfigValues &jobDefaults = {});
std::string taskToJSON(const Task &task);
std::string tasksToJSON(const TaskSet &tasks);
// Full specs
DAGSpec dagFromJSON(const rj::Value &spec);
DAGSpec dagFromJSON(const std::string &jsonSpec);
// Attempt Records
std::string attemptRecordToJSON(const AttemptRecord &attemptRecord);
AttemptRecord attemptRecordFromJSON(const std::string &json);
AttemptRecord attemptRecordFromJSON(const rj::Value &spec);
// default serialization
std::ostream &operator<<(std::ostream &os, const Task &task);
std::string timePointToString(const TimePoint &tp);
TimePoint stringToTimePoint(const std::string &timeStr);
/*
DAGRun Loggers
*/
namespace logger = loggers::dag_run;
std::string stateUpdateRecordToJSON(const logger::StateUpdateRecord &rec);
logger::StateUpdateRecord stateUpdateRecordFromJSON(const rj::Value &json);
logger::StateUpdateRecord stateUpdateRecordFromJSON(const std::string &json);
} // namespace daggy