12#ifndef __FDP_CONFIG_HXX__
13#define __FDP_CONFIG_HXX__
16#include <ghc/filesystem.hpp>
17#include <yaml-cpp/yaml.h>
20#include <ghc/filesystem.hpp>
23#include "fdp/objects/metadata.hxx"
24#include "fdp/registry/api.hxx"
25#include "fdp/objects/api_object.hxx"
26#include "fdp/objects/io_object.hxx"
28namespace FairDataPipeline {
35 typedef std::shared_ptr< Config > sptr;
37 typedef std::map< std::string, IOObject > map_type;
40 const ghc::filesystem::path config_file_path_;
41 const ghc::filesystem::path config_dir_;
42 const ghc::filesystem::path script_file_path_;
43 YAML::Node config_data_;
48 ApiObject::sptr user_;
49 ApiObject::sptr author_;
51 ApiObject::sptr config_storage_root_;
52 ApiObject::sptr config_storage_location_;
53 ApiObject::sptr config_file_type_;
54 ApiObject::sptr config_obj_;
56 ApiObject::sptr script_storage_root_;
57 ApiObject::sptr script_storage_location_;
58 ApiObject::sptr script_file_type_;
59 ApiObject::sptr script_obj_;
61 ApiObject::sptr code_repo_storage_root_;
62 ApiObject::sptr code_repo_storage_location_;
63 ApiObject::sptr code_repo_obj_;
65 ApiObject::sptr code_run_;
73 RESTAPI rest_api_location_ = RESTAPI::LOCAL;
75 bool config_has_writes()
const;
76 bool config_has_reads()
const;
78 void initialise(RESTAPI api_location);
79 void validate_config(ghc::filesystem::path yaml_path, RESTAPI api_location);
88 Config(
const ghc::filesystem::path &config_file_path,
89 const ghc::filesystem::path &script_file_path,
90 const std::string &token,
91 RESTAPI api_location);
96 static Config::sptr construct(
const ghc::filesystem::path &config_file_path,
97 const ghc::filesystem::path &script_file_path,
98 const std::string &token,
99 RESTAPI api_location);
232 ghc::filesystem::path
link_write(
const std::string &data_product);
240 ghc::filesystem::path
link_read(
const std::string& data_product);
256 static YAML::Node
parse_yaml(ghc::filesystem::path yaml_path);
class for interacting with confifurations
Definition: config.hxx:33
YAML::Node meta_data_() const
Returns the meta_data Yaml Node from the config.
Definition: config.cxx:40
ghc::filesystem::path link_read(const std::string &data_product)
Return the filepath to a given data product.
Definition: config.cxx:470
YAML::Node get_config_data() const
Get the config data as a Yaml Node.
Definition: config.hxx:263
ghc::filesystem::path get_config_file_path() const
Get the config file path object.
Definition: config.hxx:163
std::string get_default_output_namespace() const
Get the default output namespace.
Definition: config.cxx:91
ghc::filesystem::path get_data_store() const
Get the data store path.
Definition: config.cxx:82
static YAML::Node parse_yaml(ghc::filesystem::path yaml_path)
Read a given yaml file into a Yaml Node.
Definition: config.cxx:34
std::string get_api_url() const
Get the api url.
Definition: config.hxx:189
bool has_writes() const
Check whether the config has writes.
Definition: config.cxx:66
bool has_outputs() const
Check whether any outputs have been added.
Definition: config.cxx:78
std::string get_token() const
Get the token as a string.
Definition: config.hxx:182
void finalise()
Finalise the pipeline Write any pending metadata to the registry Rename any pending writes to their n...
Definition: config.cxx:613
ghc::filesystem::path get_script_file_path() const
Get the script file path object.
Definition: config.hxx:175
API::sptr get_api() const
Get the api object (used to interact with the pipeline directly)
Definition: config.hxx:270
ghc::filesystem::path link_write(const std::string &data_product)
Provide a tempory file path for a given data product to be written whilst recording metadata.
Definition: config.cxx:377
bool has_inputs() const
Check whether any inputs have been added.
Definition: config.cxx:74
YAML::Node config_writes_() const
Returns the writes Yaml Node from the config.
Definition: config.cxx:44
RESTAPI get_rest_api_location() const
Get the rest api location (local / remote)
Definition: config.hxx:277
YAML::Node config_reads_() const
Returns the reads Yaml Node from the config.
Definition: config.cxx:48
~Config()
Destroy the Config object.
Definition: config.cxx:31
std::string get_default_input_namespace() const
Get the default input namespace.
Definition: config.cxx:87
std::string get_config_directory() const
Get the config directory path as a string.
Definition: config.cxx:368
std::string get_code_run_uuid() const
Get the code run uuid.
Definition: config.cxx:372
bool has_reads() const
Check whether the config has reads.
Definition: config.cxx:70