NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

When is process model client sequence file loaded for execution?

Solved!
Go to solution

As part of a custom process model I am creating, I want to make some changes to the client sequence file before it is called by the process model. These changes will then be reverted after the UUT loop finishes (I'm modifying the Sequential Model).

 

From another thread, I found out that TestStand sequences cannot be structurally modified once they have been loaded for execution. My question is: When is the process model's client sequence file 'loaded for execution'?

 

After some investigation, I found out that the client sequence file is not locked to prevent editing by the sequence editor until the "Main Sequence Callback" sequence call step executes in the process model entry point. At that point, the client sequence file is loaded dynamically as the module for that step.

 

However, before that point, there are two places that the client sequence file is used, and I want to make sure that they don't 'load the client file for execution'.  The Runstate.ProcessModelClient property is a reference to the client file's SequenceFile object and exists as soon as the entry point is invoked. Also, the engine must know about the client sequence file to properly invoke process model callbacks. Do either of those things make the client sequence file  'loaded for execution'?

 

It boils down to this: Can I safely make structural modifications to my client sequence file during ProcessSetup and ProcessCleanup?

 

Based on the information I found in another post (see Eric_Crank's comments on page 2), this is allowed. However, the customers in that case were only making changes to the Data property of the RunState.ProcessModelClient. I want to make sure that I can use the TestStand API on the reference too.

 

Also, just FYI, I've gotten this to work. I can add steps to the MainSequence sequence of the client sequence file from the setup step group of the process model's entry point via the TestStand API. I'm asking here to make sure that this is a safe thing to do, and that there isn't anything I'm not considering.

 

Thanks.

Josh W.
Certified TestStand Architect
Formerly blue
Message 1 of 8
(5,114 Views)

Don't know the answer to your question but I find it surprising that you can edit the sequence file after hitting even one of the callbacks in the process model since as you point out the sequence file has to be loaded and parts of it (possibly) executed when you reach Process Setup and Cleanup.

CTA, CLA, MTFBWY
0 Kudos
Message 2 of 8
(5,105 Views)

I should have been more thorough in my testing. You're absolutely correct.

 

If the client sequence file overrides one of the process model callbacks, then when that callback is executed, the client sequence file is locked by the sequence editor. If the callback is not overidden, then the client file is not locked.

 

I also found that regardless of the step unload option, the client sequence file stays locked by the sequence editor once it has been locked until the execution completes.

 

So I think I can make the changes I want to the client file in the setup step group of the entry point before the Process Setup sequence call step.

 

But the client file will still be locked for editing during the cleanup step group after the Process Cleanup sequence call. But since the client file will never be used again during that execution, would it be safe to modify it at that point?

 

[Edit]

I keep putting 'loaded for execution' in quotes because the term is not well defined. Could someone from NI describe exactly what it means?

 

From looking at this more, I think the meaning of the phrase 'loaded for execution' means 'loaded by the sequence call adapter for execution'. That is, any sequence in the sequence file has been loaded as part of Step 7 of a sequence call Step Execution or when specified by a step's module Load Option (such as when an execution begins). Any other use of the sequence file does not count (such as the Runstate.ProcessModelClient property). Could someone from NI confirm that this is what Al meant in that other thread?

[/Edit]

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 3 of 8
(5,103 Views)

Could you force-unload it after Process Cleanup, similar to (I think) what one of those other threads mentioned?

CTA, CLA, MTFBWY
0 Kudos
Message 4 of 8
(5,099 Views)

Even if I unload the sequence module by using the unload option, the file still stays locked in the sequence editor.

 

It also still stays locked if I call RunState.PreviousStep.Module.Unload(). I don't know how to determine if the sequence is 'loaded for execution' so I've been going by the locked status of the sequence tab in the sequence editor.  Is there another way to check if the sequence is 'loaded for execution'?

 

Also, in those other threads, they were loading a sequence programmatically but then releasing it before saving it. Thus they were working on the edit time copy, not the runtime copy. I don't know if it is possible to unload a sequence 'for execution' (the runtime copy) once it has been loaded.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 5 of 8
(5,094 Views)
Solution
Accepted by Josh_W

Josh,

 

If your sequence enables to "Optimize Non-Reentrant Calls to This Sequence" option, the first time the sequence executes TestStand stores the run-time copy of the sequence in a cache associated with the Execution. As long as the sequence is in that cache you cannot modify it and TestStand considers the sequence file to be "executing" (see SequenceFile.IsExecuting property).You cannot unload "executing" sequence files (see SequenceFile.CanUnload). Sequences remain in this cache until the Execution is closed. There is no way for you to remove sequences from this cache, but you can prevent them from being added to the cache by disabling the "Optimize ..." option. Disabling this option should have no performance impact as long as you call the sequence only once.

 

-Erik

Message 6 of 8
(5,072 Views)

Thank you Erik, that is exactly what I wanted to know.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 7 of 8
(5,045 Views)

Hi Erik,

 

Using pieces of information found in this thread I've modified a sequence file to discharge to deactivate 'Optimize...' option.

But I'm still facing the problem that I can't change anything in a sequence file (which is not the process model client) as long as my test socket execution runs...

See thread here : http://forums.ni.com/t5/NI-TestStand/Sequence-File-unload-when-execution-starts-and-reference-stays/...

 

Would you have any advice for me ?

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 8 of 8
(4,804 Views)