wiki:BackendUtilities

Version 9 (modified by cries, 13 years ago) (diff)

typos

Back-end utility functions

The following functions (in sched/validate_util.cpp and sched/sched_util.cpp) can be used in your validator and assimilator code.

struct FILE_INFO {
    std::string path;
    bool optional;
};

extern int get_output_file_info(RESULT& result, FILE_INFO&);
extern int get_output_file_infos(RESULT& result, std::vector<FILE_INFO>&);
extern int get_output_file_path(RESULT& result, std::string&);
extern int get_output_file_paths(RESULT& result, std::vector<std::string>&);

Returns the paths of a result's output file(s). The FILE_INFO variants also return each files "optional" attribute.

int try_fopen(char* path, FILE*& f, char* mode);

Open a file, distinguishing between recoverable and nonrecoverable errors. Returns zero on success. Returns ERR_FOPEN if the directory is present but not the file (this is considered a nonrecoverable error). Returns ERR_OPENDIR if the directory is not there (this is generally a recoverable error, like NFS mount failure).

int cancel_jobs(int min_id, int max_id);

Cancel jobs (workunits) with IDs min_id to max_id inclusive.