summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5a469c9)
- Rename "ready" to "inited", for symmetry to s4u::Activity
- Remove the unused state "to_free"
- Rename the funky state "not_in_the_system" into "ignored", and
improve its documentation.
Further cleanups could include not having any action set beyond the
ones existing in kernel::resource::Model, so that
kernel::resource::Action::get_state() see them all.
CpuCas01 is the one heavily using ignored actions, as failure detectors.
StateSet;
enum class State {
StateSet;
enum class State {
- ready = 0, /**< Ready */
- running, /**< Running */
- failed, /**< Task Failure */
- done, /**< Completed */
- to_free, /**< Action to free in next cleanup */
- not_in_the_system /**< Not in the system anymore. Why did you ask ? */
+ inited, /**< Created, but not started yet */
+ running, /**< Started, currently running */
+ failed, /**< Completed (unsuccessfully: either the resource failed, or the action was canceled) */
+ done, /**< Completed (successfully) */
+ ignored /**< e.g. failure detectors, these infinite sleep actions that are put on resources which failure should be notified */
};
enum class SuspendStates {
};
enum class SuspendStates {
- /** @brief Get the set of [actions](@ref Action) in *ready* state */
- Action::StateSet* get_ready_action_set() const { return ready_action_set_; }
+ /** @brief Get the set of [actions](@ref Action) in *inited* state */
+ Action::StateSet* get_inited_action_set() const { return inited_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *running* state */
Action::StateSet* get_running_action_set() const { return running_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *running* state */
Action::StateSet* get_running_action_set() const { return running_action_set_; }
private:
lmm::System* maxmin_system_ = nullptr;
const UpdateAlgo update_algorithm_;
private:
lmm::System* maxmin_system_ = nullptr;
const UpdateAlgo update_algorithm_;
- Action::StateSet* ready_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_READY */
- Action::StateSet* running_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_RUNNING */
- Action::StateSet* failed_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_FAILED */
- Action::StateSet* done_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_DONE */
+ Action::StateSet* inited_action_set_ = new Action::StateSet(); /**< Created not started */
+ Action::StateSet* running_action_set_ = new Action::StateSet(); /**< Started not done */
+ Action::StateSet* failed_action_set_ = new Action::StateSet(); /**< Done with failure */
+ Action::StateSet* done_action_set_ = new Action::StateSet(); /**< Done successful */
ActionHeap action_heap_;
};
ActionHeap action_heap_;
};
Action::State Action::get_state() const
{
Action::State Action::get_state() const
{
- if (state_set_ == model_->get_ready_action_set())
- return Action::State::ready;
+ if (state_set_ == model_->get_inited_action_set())
+ return Action::State::inited;
if (state_set_ == model_->get_running_action_set())
return Action::State::running;
if (state_set_ == model_->get_failed_action_set())
return Action::State::failed;
if (state_set_ == model_->get_done_action_set())
return Action::State::done;
if (state_set_ == model_->get_running_action_set())
return Action::State::running;
if (state_set_ == model_->get_failed_action_set())
return Action::State::failed;
if (state_set_ == model_->get_done_action_set())
return Action::State::done;
- return Action::State::not_in_the_system;
+ return Action::State::ignored;
}
void Action::set_state(Action::State state)
{
simgrid::xbt::intrusive_erase(*state_set_, *this);
switch (state) {
}
void Action::set_state(Action::State state)
{
simgrid::xbt::intrusive_erase(*state_set_, *this);
switch (state) {
- case Action::State::ready:
- state_set_ = model_->get_ready_action_set();
+ case Action::State::inited:
+ state_set_ = model_->get_inited_action_set();
break;
case Action::State::running:
state_set_ = model_->get_running_action_set();
break;
case Action::State::running:
state_set_ = model_->get_running_action_set();
- delete ready_action_set_;
+ delete inited_action_set_;
delete running_action_set_;
delete failed_action_set_;
delete done_action_set_;
delete running_action_set_;
delete failed_action_set_;
delete done_action_set_;
while ((var = cnst->get_variable(&elem))) {
kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
while ((var = cnst->get_variable(&elem))) {
kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
- if (action->get_state() == kernel::resource::Action::State::running ||
- action->get_state() == kernel::resource::Action::State::ready ||
- action->get_state() == kernel::resource::Action::State::not_in_the_system) {
+ if (action->get_state() == kernel::resource::Action::State::inited ||
+ action->get_state() == kernel::resource::Action::State::running ||
+ action->get_state() == kernel::resource::Action::State::ignored) {
action->set_finish_time(date);
action->set_state(kernel::resource::Action::State::failed);
}
action->set_finish_time(date);
action->set_state(kernel::resource::Action::State::failed);
}
/* put all action running on cpu to failed */
for (CpuTiAction& action : action_set_) {
/* put all action running on cpu to failed */
for (CpuTiAction& action : action_set_) {
- if (action.get_state() == kernel::resource::Action::State::running ||
- action.get_state() == kernel::resource::Action::State::ready ||
- action.get_state() == kernel::resource::Action::State::not_in_the_system) {
+ if (action.get_state() == kernel::resource::Action::State::inited ||
+ action.get_state() == kernel::resource::Action::State::running ||
+ action.get_state() == kernel::resource::Action::State::ignored) {
action.set_finish_time(date);
action.set_state(kernel::resource::Action::State::failed);
get_model()->get_action_heap().remove(&action);
action.set_finish_time(date);
action.set_state(kernel::resource::Action::State::failed);
get_model()->get_action_heap().remove(&action);
while ((var = get_constraint()->get_variable(&elem))) {
Action* action = static_cast<Action*>(var->get_id());
while ((var = get_constraint()->get_variable(&elem))) {
Action* action = static_cast<Action*>(var->get_id());
- if (action->get_state() == Action::State::running || action->get_state() == Action::State::ready) {
+ if (action->get_state() == Action::State::inited || action->get_state() == Action::State::running) {
action->set_finish_time(now);
action->set_state(Action::State::failed);
}
action->set_finish_time(now);
action->set_state(Action::State::failed);
}
static const char* string_action(simgrid::kernel::resource::Action::State state)
{
switch (state) {
static const char* string_action(simgrid::kernel::resource::Action::State state)
{
switch (state) {
- case simgrid::kernel::resource::Action::State::ready:
- return "SURF_ACTION_READY";
+ case simgrid::kernel::resource::Action::State::inited:
+ return "SURF_ACTION_INITED";
case simgrid::kernel::resource::Action::State::running:
return "SURF_ACTION_RUNNING";
case simgrid::kernel::resource::Action::State::failed:
return "SURF_ACTION_FAILED";
case simgrid::kernel::resource::Action::State::done:
return "SURF_ACTION_DONE";
case simgrid::kernel::resource::Action::State::running:
return "SURF_ACTION_RUNNING";
case simgrid::kernel::resource::Action::State::failed:
return "SURF_ACTION_FAILED";
case simgrid::kernel::resource::Action::State::done:
return "SURF_ACTION_DONE";
- case simgrid::kernel::resource::Action::State::not_in_the_system:
- return "SURF_ACTION_NOT_IN_THE_SYSTEM";
+ case simgrid::kernel::resource::Action::State::ignored:
+ return "SURF_ACTION_IGNORED";
default:
return "INVALID STATE";
}
default:
return "INVALID STATE";
}