HydroCouple  2.0.0-alpha.1
HydroCouple Interface Definitions
Loading...
Searching...
No Matches
HydroCouple::ICheckpointableModelComponent Class Referenceabstract

ICheckpointableModelComponent is an IModelComponent that can save and restore its complete simulation state. More...

#include <hydrocouple.h>

Inheritance diagram for HydroCouple::ICheckpointableModelComponent:
Collaboration diagram for HydroCouple::ICheckpointableModelComponent:

Public Member Functions

virtual ~ICheckpointableModelComponent ()=default
 ~ICheckpointableModelComponent destructor.
 
virtual bool saveState (std::string &token, std::string &message)=0
 Saves the component's complete state.
 
virtual bool restoreState (const std::string &token, std::string &message)=0
 Restores state previously saved by saveState().
 
- Public Member Functions inherited from HydroCouple::IModelComponent
virtual ~IModelComponent ()=default
 IModelComponent::~IModelComponent destructor.
 
virtual IModelComponentInfocomponentInfo () const =0
 Contains the metadata about this IModelComponent instance.
 
virtual ComponentStatus status () const =0
 Defines current status of the IModelComponent. See IModelComponent::ComponentStatus for the possible values.
 
virtual std::vector< IArgument * > arguments () const =0
 Arguments needed to let the component do its work. An unmodifiable list of (modifiable) arguments must be returned that is to be used to get information about the arguments and to set argument values.
 
virtual std::vector< IInput * > inputs () const =0
 The list of consumer items for which a component can recieve values.
 
virtual std::vector< IOutput * > outputs () const =0
 The list of IOutputs for which a component can produce results.
 
virtual std::vector< IComponentDataItem * > results () const =0
 List of the model's output results.
 
virtual void initialize ()=0
 Initializes the current IModelComponent.
 
virtual std::vector< std::string > validate ()=0
 Validates the populated instance of the IModelComponent.
 
virtual void prepare ()=0
 Prepares the IModelComponent for calls to the Update method.
 
virtual void update (const std::vector< IOutput * > &requiredOutputs={})=0
 This method is called to let the component update itself, thus reaching its next state.
 
virtual void finish ()=0
 The finish() must be invoked as the last of any methods in the IModelComponent interface.
 
virtual const IWorkflowComponentworkflow () const =0
 Gets the workflow that this component is part of.
 
virtual void setWorkflow (const IWorkflowComponent *workflow)=0
 Sets the workflow that this component is part of.
 
virtual std::set< Capabilitycapabilities () const =0
 The set of optional capabilities this component supports.
 
virtual std::vector< ErrorEntryerrors (bool clearAfterRead=false)=0
 Drains this component's diagnostic queue.
 
virtual std::string referenceDirectory () const =0
 Gets the reference directory for this component instance.
 
virtual void setReferenceDirectory (const std::string &referenceDirectory)=0
 setReferenceDirectory Sets the reference directory for this component instance.
 
- Public Member Functions inherited from HydroCouple::IIdentity
virtual ~IIdentity ()=default
 IIdentity::~IIdentity is a virtual destructor.
 
virtual const std::string & id () const =0
 Gets a unique identifier for the entity.
 
- Public Member Functions inherited from HydroCouple::IDescription
virtual ~IDescription ()=default
 IDescription::~IDescription is a virtual destructor.
 
virtual const std::string & caption () const =0
 Gets caption for the entity.
 
virtual void setCaption (const std::string &caption)=0
 Sets caption for the entity.
 
virtual const std::string & description () const =0
 Gets additional descriptive information for the entity.
 
virtual void setDescription (const std::string &description)=0
 Gets additional descriptive information for the entity.
 
- Public Member Functions inherited from HydroCouple::IPropertyChanged
virtual ~IPropertyChanged ()=default
 IPropertyChanged::~IPropertyChanged is a virtual destructor.
 
- Public Member Functions inherited from HydroCouple::ISignal< std::string >
virtual ~ISignal ()=default
 ISignal::~ISignal is a virtual destructor.
 
virtual void connect (const std::shared_ptr< ISlot< Args... > > &slot)=0
 connect is used to connect a slot to the signal.
 
virtual void disconnect (const std::shared_ptr< ISlot< Args... > > &slot)=0
 disconnect is used to disconnect a slot from the signal.
 
virtual void blockSignals (bool block)=0
 blockSignals is used to block signals from being emitted.
 
- Public Member Functions inherited from HydroCouple::ISignal< const std::shared_ptr< IComponentStatusChangeEventArgs > & >
virtual ~ISignal ()=default
 ISignal::~ISignal is a virtual destructor.
 
virtual void connect (const std::shared_ptr< ISlot< Args... > > &slot)=0
 connect is used to connect a slot to the signal.
 
virtual void disconnect (const std::shared_ptr< ISlot< Args... > > &slot)=0
 disconnect is used to disconnect a slot from the signal.
 
virtual void blockSignals (bool block)=0
 blockSignals is used to block signals from being emitted.
 

Additional Inherited Members

- Public Types inherited from HydroCouple::IModelComponent
enum class  ComponentStatus {
  Created ,
  Initializing ,
  Initialized ,
  Validating ,
  Valid ,
  WaitingForData ,
  Invalid ,
  Preparing ,
  Updating ,
  Updated ,
  Checkpointing ,
  Done ,
  Finishing ,
  Finished ,
  Failed
}
 HydroCouple::ComponentStatus is an enumerator that describes the status of a component over the course of its lifetime. More...
 
- Protected Member Functions inherited from HydroCouple::ISignal< std::string >
virtual void emit (Args... args)=0
 emit is used to emit the signal.
 
- Protected Member Functions inherited from HydroCouple::ISignal< const std::shared_ptr< IComponentStatusChangeEventArgs > & >
virtual void emit (Args... args)=0
 emit is used to emit the signal.
 

Detailed Description

ICheckpointableModelComponent is an IModelComponent that can save and restore its complete simulation state.

Checkpoint/restart is required for preemptible cloud execution and walltime-limited HPC runs. During saveState()/restoreState() the component's status is HydroCouple::Checkpointing. Components supporting this interface advertise Capability::Checkpointing.

Constructor & Destructor Documentation

◆ ~ICheckpointableModelComponent()

virtual HydroCouple::ICheckpointableModelComponent::~ICheckpointableModelComponent ( )
virtualdefault

~ICheckpointableModelComponent destructor.

Member Function Documentation

◆ restoreState()

virtual bool HydroCouple::ICheckpointableModelComponent::restoreState ( const std::string & token,
std::string & message )
nodiscardpure virtual

Restores state previously saved by saveState().

Callable after initialize(); on success the component behaves as if it had computed its way to the checkpointed simulation state.

Parameters
[in]tokenis the opaque identifier returned by saveState().
[out]messagedescribes the failure when the return value is false.
Returns
True on success.

◆ saveState()

virtual bool HydroCouple::ICheckpointableModelComponent::saveState ( std::string & token,
std::string & message )
nodiscardpure virtual

Saves the component's complete state.

The component persists its state to storage of its choosing (typically under referenceDirectory()) and returns an opaque token with which the state can be restored later, possibly by a different process on a different machine. Callable only when status() is HydroCouple::Updated or HydroCouple::Done.

Parameters
[out]tokenis an opaque identifier for the saved state.
[out]messagedescribes the failure when the return value is false.
Returns
True on success.

The documentation for this class was generated from the following file: