# Check if running?

**URL:** <https://mworks.discourse.group/t/check-if-running/595>\
**Category:** Support\
**Created:** [March 25, 2014, 7:45pm UTC](https://mworks.discourse.group/t/check-if-running/595 "2014-03-25T19:45:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 25, 2014, 7:45pm UTC](https://mworks.discourse.group/t/check-if-running/595/1 "2014-03-25T19:45:51Z")

</div>

Chris,

Quick question that would be useful to know today sometime if you have a chance:

Is there an isRunning action or expression in the XML that tells you whether the state system is stopped or started?  
Also, is there a way to specify actions that are guaranteed to get run after the state system (or trial) is finished, whether interrupted or not, like the try/finally structure in python?

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 25, 2014, 7:57pm UTC](https://mworks.discourse.group/t/check-if-running/595/2 "2014-03-25T19:57:28Z")

</div>

Hi Mark,

> Is there an isRunning action or expression in the XML that tells you whether the state system is stopped or started?

No. The `#state_system_mode` variable holds that information, but you can’t access it from the XML (although a Python bridge script can see it).

How did you hope to use such an action/expression?

> Also, is there a way to specify actions that are guaranteed to get run after the state system (or trial) is finished, whether interrupted or not, like the try/finally structure in python?

No, but you’ve [asked for this before](https://mworks.discourse.group/discussions/questions/385), and it’s on the to-do list.

Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [March 25, 2014, 8:18pm UTC](https://mworks.discourse.group/t/check-if-running/595/3 "2014-03-25T20:18:12Z")

</div>

> Also, is there a way to specify actions that are guaranteed to get run after the state system (or trial) is finished, whether interrupted or not, like the try/finally structure in python?
> 
> > No, but you’ve asked for this before, and it’s on the to-do list

Ah, my memory is not good. Thanks.

My use case: I’m scheduling a set of actions to happen in the future. If the state system is stopped before the schedule, I’d like to cancel the scheduled actions. I could use an “if isRunning” or similar inside the scheduled payload, or I could cancel them from a “finally” block.

Thanks, I’ll work around this.

Mark

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 19, 2022, 11:20pm UTC](https://mworks.discourse.group/t/check-if-running/595/4 "2022-07-19T23:20:22Z")

</div>


