OpenStudioCore:runmanager/lib
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
openstudio::runmanager::Workflow Class Reference

#include <Workflow.hpp>

Public Member Functions

void add (const openstudio::runmanager::Tools &t_tools)
 Adds a Tools object to the Tools object of the first job in the workflow. More...
 
void add (const openstudio::runmanager::Files &t_files)
 Adds a Files object to the Tools object of the first job in the workflow. More...
 
void add (const openstudio::runmanager::JobParams &t_params)
 Adds a JobParams object to the Tools object of the first job in the workflow. More...
 
void addFile (const std::string &key, const openstudio::path &filepath)
 Adds a FileInfo object to the first job in the Workflow. More...
 
void addJob (openstudio::runmanager::JobType type)
 Adds a Job of the given type as the child of the last most recently added job. More...
 
void addJob (openstudio::runmanager::JobType type, const std::string &jobkeyname)
 Adds a Job of the given type as the child of the last most recently added job. More...
 
void addJob (const openstudio::runmanager::WorkItem &t_wi, const std::string &jobkeyname)
 Adds a Job as represented by the WorkItem. More...
 
void addJob (const openstudio::runmanager::WorkItem &t_wi)
 Adds a Job as represented by the WorkItem. More...
 
void addJob (openstudio::runmanager::JobType type, const openstudio::runmanager::Tools &tools, const openstudio::runmanager::JobParams &params, const openstudio::runmanager::Files &files)
 Adds a Job of the given type as the child of the last most recently added job. More...
 
void addJob (openstudio::runmanager::JobType type, const openstudio::runmanager::Tools &tools, const openstudio::runmanager::JobParams &params, const openstudio::runmanager::Files &files, const std::string &jobkeyname)
 Adds a Job of the given type as the child of the last most recently added job. More...
 
void addJobs (const std::vector< openstudio::runmanager::JobType > &t_types)
 Adds the tree of Job types to the current workflow. More...
 
void addParam (const openstudio::runmanager::JobParam &param)
 Adds a JobParam object to the first job in the workflow. More...
 
bool addStandardWorkflow (const openstudio::path &t_scriptsPath, bool t_rubyInstalled, const openstudio::path &t_rubyIncludePath, const std::map< openstudio::path, std::vector< std::pair< openstudio::path, std::vector< ruleset::OSArgument > > > > &t_userScriptsByFolder, bool t_useRadianceForDaylightCalculations, const openstudio::path &t_radiancePath=openstudio::path(), const openstudio::path &t_relativeTo=openstudio::path(), bool t_copyFileTrue=false)
 Adds a "standard workflow" consisting of: [model_scripts] -> ModelToIdf -> [idf_scripts] -> EnergyPlus -> [post_energyplus] If ruby is not indicated and ruby scripts are found in the scripts folders, then true is returned, indicating that ruby scripts have been skipped. More...
 
bool addStandardWorkflow (const openstudio::path &t_scriptsPath, bool t_rubyInstalled, const openstudio::path &t_rubyIncludePath, bool t_useRadianceForDaylightCalculations, const openstudio::path &t_radiancePath=openstudio::path())
 
void addTool (const openstudio::runmanager::ToolInfo &tool)
 Adds a ToolInfo object to the first job in the workflow. More...
 
void addWorkflow (const openstudio::runmanager::Workflow &t_wf)
 Append workflow to last job in this workflow. More...
 
openstudio::runmanager::Job create (const std::vector< openstudio::URLSearchPath > &t_url_search_paths=std::vector< openstudio::URLSearchPath >())
 Creates a Job tree from the current workflow. More...
 
openstudio::runmanager::Job create (const openstudio::path &outdir, const std::vector< openstudio::URLSearchPath > &t_url_search_paths=std::vector< openstudio::URLSearchPath >())
 Creates a Job tree from the current workflow. More...
 
openstudio::runmanager::Job create (const openstudio::path &outdir, const openstudio::path &infile, const openstudio::path &epwdirorfile=openstudio::path(), const std::vector< openstudio::URLSearchPath > &t_url_search_paths=std::vector< openstudio::URLSearchPath >())
 Creates a Job tree from the current workflow. More...
 
openstudio::runmanager::Job create (const openstudio::path &outdir, const std::vector< openstudio::path > &infiles, const std::vector< openstudio::URLSearchPath > &t_url_search_paths=std::vector< openstudio::URLSearchPath >())
 Creates a Job tree from the current workflow. More...
 
openstudio::runmanager::Files files () const
 
std::string getName () const
 Returns the name of the workflow. More...
 
std::string key () const
 Returns a generated hash key that identifies this exact workflow configuration. More...
 
Workflowoperator= (const openstudio::runmanager::Workflow &t_rhs)
 
bool operator== (const openstudio::runmanager::Workflow &t_rhs) const
 
void parallelizeEnergyPlus (int t_numSplits, int t_offset)
 Swaps out any EnergyPlusJob with an equivalent ParallelEnergyPlus job. More...
 
openstudio::runmanager::JobParams params () const
 
void replaceJobs (const std::string &jobkeyname, openstudio::runmanager::JobType type)
 Replaces all jobs with the given keyname with the given type. More...
 
void replaceJobs (const std::string &jobkeyname, openstudio::runmanager::JobType type, const openstudio::runmanager::Tools &tools, const openstudio::runmanager::JobParams &params, const openstudio::runmanager::Files &files)
 Replaces all jobs with the given keyname with the given type. More...
 
void replaceJobs (const std::string &jobkeyname, const openstudio::runmanager::Workflow &t_wf)
 Replaces all jobs with the given keyname with the given new Workflow. More...
 
void replaceJobs (const std::string &jobkeyname, const openstudio::runmanager::Job &t_job)
 Replaces all jobs with the given keyname with the given new Workflow. More...
 
boost::optional
< FileReferenceType > 
requiredSeedFileType () const
 Returns the file type required for this Workflow's first Job. More...
 
void setInputFiles (const openstudio::path &infile, const openstudio::path &epwdirorfile)
 
void setInputFiles (const std::vector< openstudio::path > &infiles)
 
void setName (const std::string &t_workflowName)
 Sets the name of the workflow. More...
 
void setUUID (const openstudio::UUID &uuid)
 To be called by ProjectDatabase for deserialization. More...
 
void swap (Workflow &t_other)
 
openstudio::runmanager::Tools tools () const
 Returns the tools attached to the first job. More...
 
std::vector< WorkItemtoWorkItems () const
 
openstudio::runmanager::JobType type () const
 
openstudio::UUID uuid () const
 
 Workflow ()
 Default constructor. More...
 
 Workflow (const Workflow &t_wf)
 Copy constructor. More...
 
 Workflow (openstudio::runmanager::Job t_job, const std::string &t_workflowName="")
 Reconstruct a workflow from a Job object. More...
 
 Workflow (const std::string &t_workflowstring, const std::string &t_workflowName="")
 Construct a workflow from the given string. More...
 
 Workflow (const std::vector< openstudio::runmanager::JobType > &t_types, const std::string &t_workflowName="")
 Construct a workflow tree of the given JobTypes, organized as: t_types[0]->t_types[1]->...->t_types[n]. More...
 
 Workflow (const std::vector< openstudio::runmanager::WorkItem > &t_items, const std::string &t_workflowName="")
 Construct a workflow tree from the linear vector of WorkItem objects. More...
 

Static Public Member Functions

static WorkItem radianceDaylightCalculations (const openstudio::path &t_rubyIncludePath, const openstudio::path &t_radiancePath)
 

Related Functions

(Note that these are not member functions.)

typedef std::vector< WorkflowWorkflowVector
 

Detailed Description

Utility for constructing a reproducible Job tree.

Constructor & Destructor Documentation

openstudio::runmanager::Workflow::Workflow ( )

Default constructor.

openstudio::runmanager::Workflow::Workflow ( const Workflow t_wf)

Copy constructor.

openstudio::runmanager::Workflow::Workflow ( openstudio::runmanager::Job  t_job,
const std::string &  t_workflowName = "" 
)
explicit

Reconstruct a workflow from a Job object.

The entire job tree is deconstructed into the Workflow object

openstudio::runmanager::Workflow::Workflow ( const std::string &  t_workflowstring,
const std::string &  t_workflowName = "" 
)
explicit

Construct a workflow from the given string.

The string is parsed as a simple parent->child relationship.

Example:

Workflow wf("NullJob->EnergyPlusJob");

Creates a Workflow with a NullJob at the head with a single child job that is an EnergyPlusJob

openstudio::runmanager::Workflow::Workflow ( const std::vector< openstudio::runmanager::JobType > &  t_types,
const std::string &  t_workflowName = "" 
)
explicit

Construct a workflow tree of the given JobTypes, organized as: t_types[0]->t_types[1]->...->t_types[n].

openstudio::runmanager::Workflow::Workflow ( const std::vector< openstudio::runmanager::WorkItem > &  t_items,
const std::string &  t_workflowName = "" 
)
explicit

Construct a workflow tree from the linear vector of WorkItem objects.

Member Function Documentation

void openstudio::runmanager::Workflow::add ( const openstudio::runmanager::Tools t_tools)

Adds a Tools object to the Tools object of the first job in the workflow.

void openstudio::runmanager::Workflow::add ( const openstudio::runmanager::Files t_files)

Adds a Files object to the Tools object of the first job in the workflow.

void openstudio::runmanager::Workflow::add ( const openstudio::runmanager::JobParams t_params)

Adds a JobParams object to the Tools object of the first job in the workflow.

void openstudio::runmanager::Workflow::addFile ( const std::string &  key,
const openstudio::path &  filepath 
)

Adds a FileInfo object to the first job in the Workflow.

void openstudio::runmanager::Workflow::addJob ( openstudio::runmanager::JobType  type)

Adds a Job of the given type as the child of the last most recently added job.

Parameters
[in]typeType of the job to add
void openstudio::runmanager::Workflow::addJob ( openstudio::runmanager::JobType  type,
const std::string &  jobkeyname 
)

Adds a Job of the given type as the child of the last most recently added job.

Parameters
[in]typeType of the job to add
[in]jobkeynameKey name to give the job.
See also
replaceJobs
void openstudio::runmanager::Workflow::addJob ( const openstudio::runmanager::WorkItem t_wi,
const std::string &  jobkeyname 
)

Adds a Job as represented by the WorkItem.

Parameters
[in]t_wiWorkItem of the job to add
[in]jobkeynameKey name to give the job.
See also
replaceJobs
void openstudio::runmanager::Workflow::addJob ( const openstudio::runmanager::WorkItem t_wi)

Adds a Job as represented by the WorkItem.

Parameters
[in]t_wiWorkItem of the job to add
See also
replaceJobs
void openstudio::runmanager::Workflow::addJob ( openstudio::runmanager::JobType  type,
const openstudio::runmanager::Tools tools,
const openstudio::runmanager::JobParams params,
const openstudio::runmanager::Files files 
)

Adds a Job of the given type as the child of the last most recently added job.

Parameters
[in]typeType of the job to add
[in]toolsTools to attach to the Job
[in]paramsJobParams to attach to the Job
[in]filesFiles to attach to the Job
void openstudio::runmanager::Workflow::addJob ( openstudio::runmanager::JobType  type,
const openstudio::runmanager::Tools tools,
const openstudio::runmanager::JobParams params,
const openstudio::runmanager::Files files,
const std::string &  jobkeyname 
)

Adds a Job of the given type as the child of the last most recently added job.

Parameters
[in]typeType of the job to add
[in]toolsTools to attach to the Job
[in]paramsJobParams to attach to the Job
[in]filesFiles to attach to the Job
[in]jobkeynameKey name to give the job.
See also
replaceJobs
void openstudio::runmanager::Workflow::addJobs ( const std::vector< openstudio::runmanager::JobType > &  t_types)

Adds the tree of Job types to the current workflow.

See also
Workflow::Workflow(const std::vector<openstudio::runmanager::JobType> &)
void openstudio::runmanager::Workflow::addParam ( const openstudio::runmanager::JobParam param)

Adds a JobParam object to the first job in the workflow.

bool openstudio::runmanager::Workflow::addStandardWorkflow ( const openstudio::path &  t_scriptsPath,
bool  t_rubyInstalled,
const openstudio::path &  t_rubyIncludePath,
const std::map< openstudio::path, std::vector< std::pair< openstudio::path, std::vector< ruleset::OSArgument > > > > &  t_userScriptsByFolder,
bool  t_useRadianceForDaylightCalculations,
const openstudio::path &  t_radiancePath = openstudio::path(),
const openstudio::path &  t_relativeTo = openstudio::path(),
bool  t_copyFileTrue = false 
)

Adds a "standard workflow" consisting of: [model_scripts] -> ModelToIdf -> [idf_scripts] -> EnergyPlus -> [post_energyplus] If ruby is not indicated and ruby scripts are found in the scripts folders, then true is returned, indicating that ruby scripts have been skipped.

Parameters
[in]t_scriptsPathlocation to search for scripts to add between jobs
[in]t_rubyInstalledindicates if ruby exists as a tool and if ruby scripts should be added to the workflow
[in]t_rubyIncludePathinclude path to pass to the ruby interpreter
[in]t_userScriptsByFoldermap containing paths to model, idf, and post EnergyPlus scripts
[in]t_useRadianceForDaylightCalculationsIf true, use radiance. Requires radiance and ruby installed. This parameter is deprecated and will be unused in the future.
[in]t_radiancePathpath to Radiance. This parameter is deprecated and will be unused in the future.
[in]t_relativeTo(unused)
[in]t_copyFileTrue(unused)
bool openstudio::runmanager::Workflow::addStandardWorkflow ( const openstudio::path &  t_scriptsPath,
bool  t_rubyInstalled,
const openstudio::path &  t_rubyIncludePath,
bool  t_useRadianceForDaylightCalculations,
const openstudio::path &  t_radiancePath = openstudio::path() 
)
void openstudio::runmanager::Workflow::addTool ( const openstudio::runmanager::ToolInfo tool)

Adds a ToolInfo object to the first job in the workflow.

void openstudio::runmanager::Workflow::addWorkflow ( const openstudio::runmanager::Workflow t_wf)

Append workflow to last job in this workflow.

openstudio::runmanager::Job openstudio::runmanager::Workflow::create ( const std::vector< openstudio::URLSearchPath > &  t_url_search_paths = std::vector< openstudio::URLSearchPath >())

Creates a Job tree from the current workflow.

Parameters
[in]t_url_search_pathspaths to search while normalizing any URLs in IDFs or OSMs that exist in the workflow
openstudio::runmanager::Job openstudio::runmanager::Workflow::create ( const openstudio::path &  outdir,
const std::vector< openstudio::URLSearchPath > &  t_url_search_paths = std::vector< openstudio::URLSearchPath >() 
)

Creates a Job tree from the current workflow.

Parameters
[in]outdirOutput directory to be applied to the first job in the Workflow (child jobs inherit the outdir)
[in]t_url_search_pathspaths to search while normalizing any URLs in IDFs or OSMs that exist in the workflow
openstudio::runmanager::Job openstudio::runmanager::Workflow::create ( const openstudio::path &  outdir,
const openstudio::path &  infile,
const openstudio::path &  epwdirorfile = openstudio::path(),
const std::vector< openstudio::URLSearchPath > &  t_url_search_paths = std::vector< openstudio::URLSearchPath >() 
)

Creates a Job tree from the current workflow.

Parameters
[in]outdirOutput directory to be applied to the first job in the Workflow (child jobs inherit the outdir)
[in]infileInput file to be attached to the first job in the workflow
[in]epwdirorfileEPW file or directory containing EPW files to be search when looking for the appropriate EPW for energyplus simulation of infile
[in]t_url_search_pathspaths to search while normalizing any URLs in IDFs or OSMs that exist in the workflow
openstudio::runmanager::Job openstudio::runmanager::Workflow::create ( const openstudio::path &  outdir,
const std::vector< openstudio::path > &  infiles,
const std::vector< openstudio::URLSearchPath > &  t_url_search_paths = std::vector< openstudio::URLSearchPath >() 
)

Creates a Job tree from the current workflow.

Parameters
[in]outdirOutput directory to be applied to the first job in the Workflow (child jobs inherit the outdir)
[in]infilesFirst path in vector will be attached to the first job in the workflow. Subsequent paths will be designated requiredFiles of the first file.
[in]t_url_search_pathspaths to search while normalizing any URLs in IDFs or OSMs that exist in the workflow
openstudio::runmanager::Files openstudio::runmanager::Workflow::files ( ) const
Returns
the FileInfos attacked to the first job.
std::string openstudio::runmanager::Workflow::getName ( ) const

Returns the name of the workflow.

std::string openstudio::runmanager::Workflow::key ( ) const

Returns a generated hash key that identifies this exact workflow configuration.

Workflow& openstudio::runmanager::Workflow::operator= ( const openstudio::runmanager::Workflow t_rhs)
bool openstudio::runmanager::Workflow::operator== ( const openstudio::runmanager::Workflow t_rhs) const
inline
void openstudio::runmanager::Workflow::parallelizeEnergyPlus ( int  t_numSplits,
int  t_offset 
)

Swaps out any EnergyPlusJob with an equivalent ParallelEnergyPlus job.

Parameters
[in]t_numSplitsnumber of runperiods to split the job into
[in]t_offset
openstudio::runmanager::JobParams openstudio::runmanager::Workflow::params ( ) const
Returns
the params attached to the first job
static WorkItem openstudio::runmanager::Workflow::radianceDaylightCalculations ( const openstudio::path &  t_rubyIncludePath,
const openstudio::path &  t_radiancePath 
)
static
Returns
a WorkItem that performs daylight calculations This function is deprecated and will be removed in the future.
void openstudio::runmanager::Workflow::replaceJobs ( const std::string &  jobkeyname,
openstudio::runmanager::JobType  type 
)

Replaces all jobs with the given keyname with the given type.

Parameters
[in]jobkeynameKey name to replace
[in]typeNew job type to add in place of old job
void openstudio::runmanager::Workflow::replaceJobs ( const std::string &  jobkeyname,
openstudio::runmanager::JobType  type,
const openstudio::runmanager::Tools tools,
const openstudio::runmanager::JobParams params,
const openstudio::runmanager::Files files 
)

Replaces all jobs with the given keyname with the given type.

Parameters
[in]jobkeynameKey name to replace
[in]typeNew job type to add in place of old job
[in]toolsTools to attach to the Job
[in]paramsJobParams to attach to the Job
[in]filesFiles to attach to the Job
void openstudio::runmanager::Workflow::replaceJobs ( const std::string &  jobkeyname,
const openstudio::runmanager::Workflow t_wf 
)

Replaces all jobs with the given keyname with the given new Workflow.

Parameters
[in]jobkeynameKey name to replace
[in]t_wfNew Workflow to add in place of old job
void openstudio::runmanager::Workflow::replaceJobs ( const std::string &  jobkeyname,
const openstudio::runmanager::Job t_job 
)

Replaces all jobs with the given keyname with the given new Workflow.

Parameters
[in]jobkeynameKey name to replace
[in]t_jobNew Job tree to add in place of old job
boost::optional<FileReferenceType> openstudio::runmanager::Workflow::requiredSeedFileType ( ) const

Returns the file type required for this Workflow's first Job.

void openstudio::runmanager::Workflow::setInputFiles ( const openstudio::path &  infile,
const openstudio::path &  epwdirorfile 
)
void openstudio::runmanager::Workflow::setInputFiles ( const std::vector< openstudio::path > &  infiles)
void openstudio::runmanager::Workflow::setName ( const std::string &  t_workflowName)

Sets the name of the workflow.

void openstudio::runmanager::Workflow::setUUID ( const openstudio::UUID &  uuid)

To be called by ProjectDatabase for deserialization.

void openstudio::runmanager::Workflow::swap ( Workflow t_other)
openstudio::runmanager::Tools openstudio::runmanager::Workflow::tools ( ) const

Returns the tools attached to the first job.

std::vector<WorkItem> openstudio::runmanager::Workflow::toWorkItems ( ) const
Returns
a vector of WorkItem objects if the workflow is linear. Throws an exception if not.
openstudio::runmanager::JobType openstudio::runmanager::Workflow::type ( ) const
Returns
the type of the first job
openstudio::UUID openstudio::runmanager::Workflow::uuid ( ) const

Friends And Related Function Documentation

typedef std::vector<Workflow> WorkflowVector
related