LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::io::wfcommons_detail Namespace Reference

Typedefs

using json = nlohmann::json

Functions

bool supported_version (const std::string &v)
 WfCommonsLoader.SUPPORTED_SCHEMA_VERSIONS.
bool has (const json &o, const char *key)
bool nonempty (const json &v)
 ~isempty(x) on a decoded JSON value.
std::string as_text (const json &v)
 A JSON scalar as the text strcmp compares: strings verbatim, numbers as written.
void validate_schema (const json &data)
 Port of validateSchema.
std::string file_stem (const std::string &s)
 [~, name, ~] = fileparts(s).
std::string extract_name (const json &data, const std::string &default_name)
 Port of extractName: the document's name, else the default's stem, sanitized.
std::string task_id (const json &task, std::size_t idx1)
 Port of getTaskId.
template<class T>
lang::Distrib< T > fit_distribution (double runtime, const WfCommonsOptions &opt)
 Port of fitDistribution.
std::map< std::string, std::string > extract_metadata (const json &task, const std::string &id, const json *exec)
 Port of extractMetadata; values are the JSON text of each field.
std::vector< std::size_t > reachable_nodes (std::size_t start, const std::vector< std::vector< std::size_t > > &adj)
 Port of getReachableNodes: BFS order, the start excluded.
std::size_t find_common_join (const std::vector< std::size_t > &children, const std::vector< std::vector< std::size_t > > &adj, const std::vector< std::size_t > &indeg)
 Port of findCommonJoin.
template<class T>
workflow::Workflow< T > build_workflow (const json &data, const std::string &wf_name, const WfCommonsOptions &opt)
 Port of buildWorkflow (with buildAdjacency and addPrecedences).
json parse_file (const std::string &path)
 Parse a whole file as JSON, naming the file on failure.
std::string which_on_path (const std::string &name)
 The first executable name on PATH, empty when there is none.
std::string fetch_https (const std::string &url, int timeout_ms)
 GET an https:// URL with curl, else wget, into memory.

Typedef Documentation

◆ json

using line::io::wfcommons_detail::json = nlohmann::json

Definition at line 107 of file wfcommons_loader.h.

Function Documentation

◆ as_text()

std::string line::io::wfcommons_detail::as_text ( const json & v)
inline

A JSON scalar as the text strcmp compares: strings verbatim, numbers as written.

Definition at line 124 of file wfcommons_loader.h.

References as_text().

Referenced by as_text(), build_workflow(), task_id(), and validate_schema().

◆ build_workflow()

template<class T>
workflow::Workflow< T > line::io::wfcommons_detail::build_workflow ( const json & data,
const std::string & wf_name,
const WfCommonsOptions & opt )

◆ extract_metadata()

std::map< std::string, std::string > line::io::wfcommons_detail::extract_metadata ( const json & task,
const std::string & id,
const json * exec )
inline

Port of extractMetadata; values are the JSON text of each field.

Definition at line 198 of file wfcommons_loader.h.

References extract_metadata(), and has().

Referenced by build_workflow(), and extract_metadata().

◆ extract_name()

std::string line::io::wfcommons_detail::extract_name ( const json & data,
const std::string & default_name )
inline

Port of extractName: the document's name, else the default's stem, sanitized.

Definition at line 157 of file wfcommons_loader.h.

References extract_name(), file_stem(), and has().

Referenced by extract_name(), line::io::wfcommons_load(), line::io::wfcommons_load_from_json(), and line::io::wfcommons_load_from_url().

◆ fetch_https()

std::string line::io::wfcommons_detail::fetch_https ( const std::string & url,
int timeout_ms )
inline

GET an https:// URL with curl, else wget, into memory.

Redirects are followed but only to https, and an HTTP error status fails the fetch; the tool's own message is quoted in the InputError.

Definition at line 449 of file wfcommons_loader.h.

References line::util::capture(), line::util::ProcResult::exitCode, fetch_https(), line::util::TempDir::file(), line::InputError::InputError(), line::util::ProcResult::out, line::util::ProcResult::timedOut, line::util::trim(), line::UnsupportedError::UnsupportedError(), and which_on_path().

Referenced by fetch_https(), and line::io::wfcommons_load_from_url().

◆ file_stem()

std::string line::io::wfcommons_detail::file_stem ( const std::string & s)
inline

[~, name, ~] = fileparts(s).

Definition at line 148 of file wfcommons_loader.h.

References file_stem().

Referenced by extract_name(), file_stem(), and line::io::wfcommons_load_from_url().

◆ find_common_join()

std::size_t line::io::wfcommons_detail::find_common_join ( const std::vector< std::size_t > & children,
const std::vector< std::vector< std::size_t > > & adj,
const std::vector< std::size_t > & indeg )
inline

Port of findCommonJoin.

intersect returns its result SORTED, so the first qualifying join is the one with the smallest task index.

Returns
the join's 0-based index, or adj.size() when there is none

Definition at line 241 of file wfcommons_loader.h.

References find_common_join(), and reachable_nodes().

Referenced by build_workflow(), and find_common_join().

◆ fit_distribution()

template<class T>
lang::Distrib< T > line::io::wfcommons_detail::fit_distribution ( double runtime,
const WfCommonsOptions & opt )

◆ has()

bool line::io::wfcommons_detail::has ( const json & o,
const char * key )
inline

Definition at line 114 of file wfcommons_loader.h.

References has().

Referenced by build_workflow(), extract_metadata(), extract_name(), has(), task_id(), and validate_schema().

◆ nonempty()

bool line::io::wfcommons_detail::nonempty ( const json & v)
inline

~isempty(x) on a decoded JSON value.

Definition at line 117 of file wfcommons_loader.h.

References nonempty().

Referenced by nonempty(), and validate_schema().

◆ parse_file()

json line::io::wfcommons_detail::parse_file ( const std::string & path)
inline

Parse a whole file as JSON, naming the file on failure.

Definition at line 392 of file wfcommons_loader.h.

References line::InputError::InputError(), and parse_file().

Referenced by parse_file(), line::io::wfcommons_load(), and line::io::wfcommons_validate().

◆ reachable_nodes()

std::vector< std::size_t > line::io::wfcommons_detail::reachable_nodes ( std::size_t start,
const std::vector< std::vector< std::size_t > > & adj )
inline

Port of getReachableNodes: BFS order, the start excluded.

Definition at line 216 of file wfcommons_loader.h.

References reachable_nodes().

Referenced by find_common_join(), and reachable_nodes().

◆ supported_version()

bool line::io::wfcommons_detail::supported_version ( const std::string & v)
inline

WfCommonsLoader.SUPPORTED_SCHEMA_VERSIONS.

Definition at line 110 of file wfcommons_loader.h.

References supported_version().

Referenced by supported_version(), and validate_schema().

◆ task_id()

std::string line::io::wfcommons_detail::task_id ( const json & task,
std::size_t idx1 )
inline

Port of getTaskId.

Definition at line 170 of file wfcommons_loader.h.

References as_text(), has(), and task_id().

Referenced by build_workflow(), and task_id().

◆ validate_schema()

void line::io::wfcommons_detail::validate_schema ( const json & data)
inline

◆ which_on_path()

std::string line::io::wfcommons_detail::which_on_path ( const std::string & name)
inline

The first executable name on PATH, empty when there is none.

Definition at line 431 of file wfcommons_loader.h.

References which_on_path().

Referenced by fetch_https(), and which_on_path().