Programatically closing an execution

I havedeveloped a custom TestStand UI in LabVIEW. However I have run into a smallproblem I wasn't able to tackle.
A useris allowed to load a sequence and then execute it. He can also stop theexecution. Load another sequence and run that sequence.
Inorder to conserve memory, when the user loads a sequence I automatically closethe previously opened sequences. However, I could not find anything to closethe executions. When I attempt to run the new sequence file, I find only thenew sequence runs, however, when I perform a thread count using the executions properties the total open threads is morethan 1. The running threads is 1. And the difference is the numberincomplete. Is there a way to remove these executions from memory so that thenumber incomplete goes to 0 and the count equals the running threads.
Thanks,
Amit

Amit,
I think I understand what you are looking for now.  Your workaround is perfectly valid, but there is a better way.  Before I explain that however, I would like to explain a few points.
1. At times, you seem to be using threads and executions interchangably.  I believe that you know the difference, but it can be confusing to others trying to understand your question when you do use them interchangably.
2. The difference between the total number of executions and the number running is not the number incomplete.  Instead, the total number of executions is the number of executions that are in the collection.
3. The number of incomplete executions is the sum of paused and running executions, thus it will never equal 0 because there is always one execution running.
To clean up completed executions, use the ApplicationMgr.CloseExecution after the Execution.Terminate or Execution.Abort has been called.  This will have to be called for each Execution you have spawned.  I have attached a screenshot of the step settings.
Hope this helps.
Regards,
Ben
National Instruments
Certified LabVIEW Associate Developer
Certified TestStand Developer
Attachments:
CloseExecutionStep.JPG ‏46 KB

Similar Messages

  • Programatically closing an execution fails unless I select Auto close

    Hello there!
    Im trying to execute a sequence using TestStand API and then close all references, but the End Execution event does not seem to be thrown.
    I had the same issue as the thread called " Programatically closing an execution" from 2009.
    My code is the following
    _axAppMgr.EndExecution += new NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_EndExecutionEventHandler(_axAppMgr_EndExecution);
    _axAppMgr.ExecutionClosed += new NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_ExecutionClosedEventHandler(_axAppMgr_ExecutionClosed);
    void _axAppMgr_QueryCloseExecution(object sender, _ApplicationMgrEvents_QueryCloseExecutionEvent e)
    e.opt = QueryCloseExecutionOptions.QueryCloseExecution_AutoCloseWhenDone;
    void _axAppMgr_EndExecution(object sender, _ApplicationMgrEvents_EndExecutionEvent e)
    ExecutionRunStates runState;
    ExecutionTerminationStates termState;
    e.exec.GetStates(out runState, out termState);
    if (termState != ExecutionTerminationStates.ExecTermState_Normal)
    Trace.WriteLine(DateTime.Now + " -----EXECUTION " + e.exec.DisplayName + "Aborted ---------");
    else
    Trace.WriteLine(DateTime.Now + " -----EXECUTION " + e.exec.DisplayName + " Terminated ---------");
    ExecutionEnd = true;
    public bool Run(string UUTName, string sequencePath )
    bool output = false;
    int TimeOut = -1;
    string name = "";
    ExecutionRunStates runState;
    ExecutionTerminationStates TerminationState;
    try
    name = DateTime.Now.ToString("yyyy-MM-dd") + " Test " + UUTName;
    if (!_axAppMgr.IsStarted)
    _axAppMgr.Start();
    seqFile = _axAppMgr.GetEngine().GetSequenceFileEx(sequencePath);
    Main = seqFile.GetSequenceByName("MainSequence");
    Main.OptimizeNonReentrantCalls = true;
    Main.Type = SequenceTypes.SeqType_ExeEntryPoint;
    execution = _axAppMgr.GetEngine().NewExecution(seqFile, "MainSequence",null, false, ExecutionTypeMask.ExecTypeMask_CloseWindowWhenDone);
    execution.TracingDisabled = true;
    execution.RTEOptionForThisExecution = RTEOptions.RTEOption_Ignore;
    execution.ClearTemporaryBreakpoints();
    execution.DisableResults = true;
    bool isExecuting = seqFile.IsExecuting;
    bool wait = execution.WaitForEndEx(TimeOut, true, null, null);
    execution.GetStates(out runState,out TerminationState );
    execution.Terminate();
    _axAppMgr.SetAutoCloseExecution(execution, true);
    _axAppMgr.CloseExecution(execution);
    execution.GetStates(out runState, out TerminationState);
    while (!ExecutionEnd)
    System.Threading.Thread.Sleep(1000);
    Terminate();
    execution.GetStates(out runState, out TerminationState);
    catch (COMException ex)
    Trace.WriteLine(ex.StackTrace + " " + ex.Message);
    finally
    TSHelper.DoSynchronousGCForCOMObjectDestruction();
    Quit();
    return output;
    The problem is, when I deactivate the 
    e.opt = QueryCloseExecutionOptions.QueryCloseExecution_AutoCloseWhenDone;
    command the execution fails to close.
    If I set the option to 
      e.opt = QueryCloseExecutionOptions.QueryCloseExecution_ShowDialog;
    and manually select auto close , then the Execution Close event is thrown.
    Could anyone help me finding out what's wrong with my code?
    Thank you in advance for your time

    Anyone ??

  • Programatically cahnge highlight execution order speed?

    Is it possible to change the highlight execution order speed?  If there are many things going on it is painfully slow to watch.  I know breakpoints can be used, but
    I would much rather fast forward the highlight execution order, I would find this feature much more useful.
    Can this speed be set programatically?  Is there a property node reference for it?
    Thanks,
    Adam
    Message Edited by ajckson on 03-13-2008 05:17 PM

    There is no way to change the speed that I know of. There are some tricks to turn it on and off programatically, but it is not a supported feature and has been known to throw error messages in the past so I wouldn't reccomend trying it.

  • Labview closing intermediate windows and verifying if library exists

    Hi,
    I have 2 questions.
    1)I have an application file.First  I see my main window and then I can press a button and 
    another window opens.After the second window finishes the extenuation I can still it .Can I pragmatically define that every intermediate will be closed 
    after execution?
    2)Is there any function in Labview that checks if a certain library exists in my computer?
    I couldn't find such function.
    Thanks,
    Leonid

    Hi Leonid,
    1. If the intermediate windows you are referring to are subVIs called by your main VI then you can programmatically get the front panels of the subVIs to close by writing a true constant to the Close After Call VI Property node.
    2. I am not aware of a single function that checks to see if a library exists, but here is a link to some documentation about how LabVIEW searches for a library when it is called:
    http://digital.ni.com/public.nsf/allkb/EBAE870D564CBBE78625788B004E76D3
     The first related link at the bottom of this article (LabVIEW 2011 Help: Specifying the Locations of Shared Libraries on Disk) includes a section about how LabVIEW locates missing shared libraries.  You might be able to use part of this process to find a particular library.
    Jayme W.
    Applications Engineer
    National Instruments

  • Execution of a CVI application using NI CAN is ~6 seconds faster if NI MAX is opened as well

    Hi,
    I am currently developing a CVI (7.0) application to download some software to a module via a Series 2 CAN card (NI CAN Driver 2.2f) and have noticed the following.
    When running under the CVI debugger the CAN interface will sometimes respond with the error code -1074388991 receive timeout when I try to communicate with the module after the download process. In all cases the first of two CAN frames is received and the second is lost.  If I start / open NI MAX and run the application, the error disappears. Increasing the timeout period does not cure the issue.
    Furthermore if I compile the release executable and run it, the execution time is ~6 Seconds faster if NI MAX is open. When NI MAX is closed the execution time reverts to the original (longer) time. (This appears to be repeatable.) 
    The above error does not occur when running the release executable.
    Does anyone know why NI MAX appears to have this affect on the CAN Interface ?
    Aid

    Hi,
    The CAN error code -1074388991 description is as follows: The timeout of a wait or notification function expired before any desired state occured. Solutions: Increase value of Timeout parameter; Verify your cable connections and operations of remote devices. But you have already had a go at increasing the timeout parameter and that didn't work.
    If you have NI-CAN 1.5, then you can use the Bus Monitor by configuring it up to CAN0 and hooking up a device to see if any frames are being read. The Bus Monitor logs all traffic on the bus. If you can communicate using the Bus Monitor, then your cables are set up properly. Make sure you close the Bus Monitor before running your program.
    The follwoing discussion forum may offer some helpful advise:
    http://forums.ni.com/ni/board/message?board.id=30&message.id=1011&requireLogin=False
    I hope some of this helps!
    Kind Regards,
    Kurt

  • Quicktime : Windows Vista w/SP2 - Windows Error : Export Controller stopped

    With the latest Quicktime version I am getting several errors in several applications:
    Windows Vista with SP2: "Export Controller was closed - Data Execution Prevention has sttoped Export Controller"
    After Effects CS4: "Invisible OpenGL Buffer Windows: The procedure entry point...etc..etc..could not be located in the dynamic link library SQLite3.dll"
    I fixed the iTunes error as suggested by Rob (moving the SQLite3.dll provided to the iTunes folder as suggested yeasterday and the error does not showed up again when I did restart my system.
    But there are still "serious" issues with Windows Vista and other applications such as After Effects in regards to the SQLite3.dll. I can not even import MOV files in After Affects NO more.
    Pleas help I am wasting a lot of time in attempting to fix something that was working "perfectlly" before the whole update (iTunes/Quicktime).
    Thanks agaain in advance for your help and assiatnce on this matter.

    I am quite disappointed with these Apple' folks. Almost a month or so with the QuickTime' issues and nobody seems to know what is going on. It seems that they are quite lost. I wonder WHERE their Technical and Support Managers are ????????....
    DO YOU GUYS CARE HOW MUCH IS THIS ISSUE COSTING "YOUR" COMPANY ??????????????????
    DO YOU CARE ??????..with such attitude, no wonder why so many US companies are falling down to the drain.....and quickly....
    A simple respond that shows COMMITMENT will do it...when are you "planning" to have a solution ????????????...
    llottlott..AE4 works regardless of the errors..at least, it is my experience so far, the only thing is to convert the MOV files into for example FLV. It seems to me that any FLV option is better than MOV files and certainly with all these issues and lack of respond, FLV would become a better option.

  • Problem using the File Dialog Box in a Client/Server application

    I am developping a client-server application using Labview 5.1 . The application on the server acquires data from some instruments and saves it on file, while the application on the clients displayes such acquired data. For doing this I call some routines on the server via the "Open Application vi" (remote connection). All goes well except when I open on the server the "File Dialog Box vi" : in this case the application on the clients is blocked (is blocked the execution of the called vi on the server). Only when
    the File Dialog Box on the server is closed, the execution of the called vi on the server starts again.
    I need to use the File Dialog Box on the server, but I don' t want to stop at the same time
    the clients !!
    I need help for resolving such problem.
    Many thanks in advance !!!

    Hi!
    waldemar.hersacher wrote:
    "It seems that the VIs called by the clients are running in the user interface thread.
    A call to the file dialog box will call a modal system dialog. So LV can't go on executing VIs in the user interface thread."
    Are you sure? I think, that File Dialog, called by LabVIEW File Dialog from Advanced File Functions Palette doesn't blocking any cycles in subVI, which running in UI Thread. Look in my old example (that was prepared for other topic, but may be good for this topic too).
    2 linus:
    I think, you must a little bit reorganize you application for to do this. You must put your File Dialog into separated cycle. This cycle, of course, will be blocked when File Dialog appear on the screen. But other cy
    cle, which responsible for visualization will run continuosly at the same time...
    Attachments:
    no_block_with_file_open_dialog.zip ‏42 KB

  • SubVI missing, but visible in windows

    It looks like one of my sub-VIs has gotten corrupted (for a 2nd time).  The main VI will load, but it pops a dialog box asking for the location of the one, sub-VI.  The sub-VI is there, and clicking on it gets the same dialog box back.  Even if I just try to open the sub-VI, I get a dialog asking to locate that same sib-VI.  I'm using Labview 7.1 running on XP, and the last time the sub-VI was not corrupt is was programatically closed using VI server.
    I'm not sure how the routine got corrupted, and I have no idea how to bring it back.  The last time I reverted back to an old saved copy (lost several hours of work) and made my changes again.  Any advice, aside from save more often?
    Thanks,
    Casey

    Thanks guys-
    For Network permissions:  the file is on the local machine, I have
    administrator rights, and I created the file, so I don't think it's a
    permissions issue.
    For Virus scanner:  That's an interesting idea.  A virus
    scanner is running, and I don't have full control to disable it, but
    that's definitely a possibility.  Seeing how this has happened
    twice, and both times to the same file, it seems that there is
    something to do with the file itself that lends it to getting corrupted.
    For the corrupt link:  It definitely does seem that the link is
    corrupt, but the files link with itself is corrupt.  If I just
    click on the file then I get a dialog asking where it is. 
    Clicking on it again, this time from inside the "please find the file
    named..." dialog, now opens the file.  So, it seems that it's link
    with itself is corrupted.  Weird.  I can relink it to other
    VIs that would call it by deleting the subvi and reinserting it. 
    How would I relink it with itself?  I guess pasting the entire
    block diagram into a new VI would be one thing to try.  I'll give
    it a shot and let you know.
    Thanks for the thoughts.  Any more ideas?

  • How To Trigger Test Stand To Assign Step = Error

    Hi everyone, I have a LabVIEW VI step in my sequence and I have an abort button the user can select to abort the user interface VI.  I want the "abort button" boolean to pass back to test stand that abort button = TRUE and I want the sequence step to be set to an "ERROR."  Is there a command to send to the Test Stand Engine to flag this step as an error?
    Thanks so much!
    Solved!
    Go to Solution.

    Hi
    Glad It was helpful.
    There are two ways in which you could achive this..
    1. Use this expression: RunState.Engine.TerminateAll()
    But be wary, this will terminate all the current excutions and the report indicates the status as "terminated"
    or
    2. Use this expression: RunState.Execution.Terminate()
    or
    3. You can add a Goto step (comes with teststand. You can find it under Flow Control section of the insertion palette) and select Cleanup as the destination step.
    This way you can run some clean up steps before closing the execution. (eg, Shutting down any hardware, etc.,)
    Deepak

  • JDBC inside db slower than outside

    Why would running a java app inside the database be over 5x slower than running outside?
    Connection code sets thin client when running outside db, set defaultConnection when running inside
    JavaPool is 100Meg
    Connection statement cache is set to 30,000; cache is enabled
    When running outside db, autoCommit is false - same as inside db
    - java application calls 5300 pl/sql procs in a package (all bound variable calls, statements are closed after execution to eliminate cursor issues)
    Round trip for 5300 calls outside the database takes 20 seconds
    Round trip for 5300 calls inside the database takes over 100 seconds
    There is no question it has something to do with either the JVM itself or JDBC stored procedure calls when running in the db...same code runs in 18 seconds (outside the db) with no JDBC calls executed...
    The doc's say that JDBC inside the db is supposed to be remarkably faster??? any clues?
    Last resort will be to ncomp the code.

    Id like to follow up with some questions:
    1.)     Oracle documentation states that PL/SQL is the preferred tool for data intensive jobs. And Java Stored Procedures are preferred for more algorithmic jobs. This seems contrary to what you state. Can you clearify?
    2.)     When you say gen. purpose and cpu bound Java code, do you mean algorithmic code?
    3.)     I assume the points 1 and 2 in your response suggest that it takes so long to get the Java environment up and running that it is killing the performance of my simple algorithm...is that what you mean?
    4.)     My real goal is to use intelligent agents (use AI algorithms that are very expensive computationally) and are invoked upon updates and continually train on newly inserted data. The fact these guys can live in the Oracle JVM, be invoked upon an update using a trigger and call an EJB client in warning of a particular condition is what made me fall in love with this solution that Oracle provides. But do you think I am asking too much or Im going a bit beyond what the JVM is for?

  • Popupmanager hell...

    Okay to the point.. the popupmanager are creating some strange behaviour.
    I have a Flex 3 application.  At startup, I use the popupmanager (in a subcomponent of the application) that opens a small window where the user selects an option via one of many buttons  ie. option A, B, C, D.  The buttons are created dynamicly off a data provider. It is a tilewindow that contains a tilelist filled with buttons via a custom renderer.  The buttons are created dynamically via the dataprovider.  Nothing fancy, works fine ie:
    |  title   |
    | A B C |
    |D E F  |
    Now.. all my problems started when I tried to put a short informational popup in the main.mxml file of the application.  The flow of events is now that the application loads, it creates a small popup, via the popupmanager, to display information, then  programatically closes it.  After that it manually calls a subcomponent to display the button popup discussed above.  At this point...the button popup no longer works.   The button popup loads, shows the title, but never displays the buttons.  It is like they are not rendering, although if I trace, all the code it run.  As soon as I remove the first popup, it works again.
    So recapping.. application starts.  in the main.mxml a popup is displayed, then programatically closed, then the button popup is called to be displayed (via  subcomponent). The button popup now doesn't show the buttons, but shows the title.
    What is 'interesting?' is that the first popup is affecting the second.  But as soon as  I remove the first one, the second displays fine.  But after hours of hunting, I have found that if don't show the first popup and instead, programatically add the title window to the display list of the main.mxml, I get the same results in the second popup.Why?  I have no idea?
    Anyone have any ideas what could be going wrong  or a related problem?  I would like to post code, but it would be huge.  If I need to clarify something.. I can do that.

    Yah I checked, in the main application I have a private variable that is an instance of the informational popup at the start.  The instance is created dynamically, displayed as a popup until an event happens, then the popup is removed, then the instance is set to null.  After a call is made to show the popup with buttons.
    Tracing yes shows all the button are created.  THe item renderer has a set data so I can confirm it is calling.  And like I said, without the first popup, it works fine.
    But.. I did find, when tracing, if I do it slow enough, then the buttons are displayed.  For some reason I think it is some sort of race condition between closing the first popup and showing the second.  But why??  It should be possible to show two at the same time.  Unless perhaps something with modality is creating a problem?  I have no idea.
    .. in the application.mxml file (psuedo code)....
    private infoPopup:InformationalTitleWindow = new InformationalTitleWindow();  //this is a title window with a label.. nothing fancy
    init() {
            PopUpManager.addPopUp( infoPopup, DisplayObject( Application.application ),false);
            PopUpManager.centerPopUp( infoPopup);
    SomeEventHandler ( ) {
          PopUpManager.removePopUp( infoPopup );
          infoPopup = null;
          ComponentInstanceWithButtonPopup.openButtonPopup(); //this is the same idea.. have an instance variable, create it, display it
    ====in other component
    openButtonPopup() {
           buttonPopup = new TitleWindowWithTileListWithButtonCustomerRenderer();
           PopUpManager.addPopUp( buttonPopup, DisplayObject( this.parentApplcation),true );

  • Fortran memory leaks

    I'm trying to determine whether we have any memory leaks in our Fortran 95 program using check -leaks. We use several allocate and deallocate statements and using the showleaks command in dbx does show a memory leak, but nothing seems to change whether deallocate is used or not. Does check -leaks work correctly for Fortran memory leaks? We're using deallocate(obj.array) where the array is allocatable and obj is nullified after deallocating. Removing the deallocate statement doesn't increase the number of leaks reported.
    Also, I'd like to clarify when Fortran memory leaks are possible. It is my understanding that local allocatable arrays (when not saved) are automatically deallocated when they go out of scope. Is this true? Do I only need to worry about memory leaks from global variables (i.e., declared in modules)?

    Local allocatable variables in a subroutine or function are freed when the program exits the subprogram. If an allocatable variable is allocated, it cannot be freed without an intervening deallocation. Pointers are more likely to be the cause of leaks than allocatable variables. Leaks of allocatable variables are possible in mixed language programs. For example, if a C program does a longjmp over a Fortran subprogram that allocated an allocatable variable, the allocatable variable will not be deallocated.
    Dbx might report a possible leak for reasons other than explicitly allocated variables that are not deallocated. For example, if a file is opened and is not closed before execution terminates, the i/o buffer allocated for the file might not be freed and might be reported as a leak.
    Bob Corbett

  • Any Time I Open iTunes My Computer Comes Up With A Message Saying "Data Execution Prevention - Mircosoft Windows To Help Protect Your Computer, Windows Has Closed This Program" We Have Trend Micro Internet Security Titanium.

    Any Time I Open iTunes My Computer Comes Up With A Message Saying "Data Execution Prevention - Mircosoft Windows To Help Protect Your Computer, Windows Has Closed This Program" We Have Trend Micro Internet Security Titanium But It Appears To Be Windows Stopping iTunes.

    Right click My Computer > Properties > Advanced > Performance: Settings > Data Execution Prevention > Add iTunes to be let through

  • Itunes error. the data execution prevention pops up and says "to protect your computer, windows has closed this program. Data execution prevention helps protect against damage from viruses and other threat.

    I have a windows Xp computer. and i needed to download the newest itunes to support my ipod touch. but now my computer doesn't let me open itunes. The the data execution prevention pops up and says "to protect your computer, windows has closed this program. Data execution prevention (DEP) helps protect against damage from viruses and other threat." I tried excluding itunes from DEP on settings but it still doesn't work. I don't know what to do. please help me!!!
    thanks 

    try to select the computer cd/dvd autorun off.
    I had the same problem, then Kaspersky software found a conflict suggesting me this solution.
    Itunes now works...even if it always asks to set the cd/dvd autorun on when lunched.

  • Itunes crashes as soon as I open itunes store. Also message: data execution prevention has closed itunes flashes up after itunes has closed??

    After the recent update of iTunes. Every time I try to open up the iTunes store it crashes iTunes, But I can play my music absolutely fine through my library. Also whenever I close iTunes a message saying 'data execution prevention has closed iTunes flashes up on my screen??
    Any ideas??

    Hey there KP187,
    Here is an article for you that will help you troubleshoot this issue with iTunes on your PC:
    iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
    http://support.apple.com/kb/TS1717
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

Maybe you are looking for

  • How to use snapshots from Lightroom in ACR?

    Applying some changes to an image in LR and then saving it to DNG or a XMP sidecar file will make that changes the defaults when importing a RAW in ACR. But I wasn't able to make settings saved in those files in form of snapshots selectable and usabl

  • Loading data from infopackage via application server

    Hi Gurus, I have a requirement where i need to load data present in the internal table to a CSV file in the application server (AL11) via open data set, and then read the file from the aplication server, via infopackage ( routine ) then load it to th

  • How to hide some functions in the menu bar of flash paper

    Do anyone know how to hide some functions in the menu bar of flash paper? As I want to show a swf file(converted from pdf) on the website without printing function. How can I do it? Also, if possible, can anyone know how to hide all functions on the

  • Hide Link in footer area of print out  after Printable page is clicked

    Hi all In iExpense after submiting the claim there is a printable page button appears by which user can get the print of the claim raised. But ont point is there ... in printout of the claim (hardcopy) .. in the footer area of the paper .. a link app

  • Copy paste text between documents bug

    Hi When I copy paste styled text (text or text containers) between CS6 (or CC) documents, the language for the text changes to a wrong one (from Finnish to English: British), along with the spelling of course. The style does follow correctly to the f