LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Launch LabVIEW VI from Command Line with Gitlab CI

A quick thought from my vacation: Try executing the gitlab runner not as a service but directly from the command line (if you don't do that already). I run it like this all the time. 

 

Greetings from Greece ☀️




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 11 of 19
(1,809 Views)

Running the service locally allowed me to narrow down the problem to LabVIEW not loading the VI. Before, I wasn't sure why the requested call to LabVIEW was timing out. It took me a while to figure this out, the documentation for the gitlab-runner wasn't super explicit.

 

Thanks for the input everyone, I'll see if there is a secret INI token I can use to see why LabVIEW is failing. 

Ian K.
Software Developer
Data Ahead AG
0 Kudos
Message 12 of 19
(1,784 Views)

Hello Ian,

 

Were you finally able to launch Lab View from Command line using gitlab YML ?

 

I face a similar problem. My git docker is on linux where as gitlab runner is on windows(which also has labview installed). Below is my yml script to start lab view on Windows.


  script:
    - "echo Running this YML LabView test "
    - '"C:\Program Files (x86)\National Instruments\LabVIEW 2013\LabVIEW.exe" "C:\winapps\Sequencer\Main Program.vi"'

 

The above cmd line works well when directly called from cmd shell on windows.

I do not use LabView-CLI as I think LabView.exe can directly be called with parameters like above from YML script.

 

 

Regards

Yogesh

 

 

 

 

 

 

 

0 Kudos
Message 13 of 19
(1,734 Views)

Hi Yogesh,

 

Unfortunately I wasn't able to find any additional information about why LabVIEW wasn't launching my VI. LabVIEW returned no errors, it would just attempt to launch my VI and fail. Running the exact same command from the command line worked like expected. Are you seeing the same results?

 

You don't necessarily need the LabVIEW-CLI, but it does allow LabVIEW to get information back to the command line - this is important, for example, if you want to return the results of a test to gitlab CI.

 

Cheers,

 

Ian K.

Ian K.
Software Developer
Data Ahead AG
0 Kudos
Message 14 of 19
(1,727 Views)

hi Ian,

 

Like you said I now used CLI tool. I installed labview-cli and start the labview from YML script as below

script:

' "C:\Program Files (x86)\LabVIEW-CLI\labview-cli.exe" --kill -v "C:\winapps\ST-I\Embedded Test Bench\tags\V12\Sequencer\Main Program.vi"'.

 

With this I am now getting the same error message like you observed.

$ "%LABVIEW%\labview-cli.exe" --kill -v "C:\winapps\ST-I\Embedded Test Bench\tags\V12\Sequencer\Main Program.vi"
LabVIEW CLI Started - Verbose Mode
Version 1.5.1.0
LabVIEW CLI Arguments: --kill -v C:\winapps\ST-I\Embedded Test Bench\tags\V12\Sequencer\Main Program.vi
Arguments passed to LabVIEW:
Current Version: 2013 SP1 f2, 32bit
Detected LabVIEW versions:
2013 SP1 f2, 32bit(C:\Program Files (x86)\National Instruments\LabVIEW 2013\)
LabVIEW User Arguments:
Launching Program:
C:\Program Files (x86)\National Instruments\LabVIEW 2013\LabVIEW.exe "C:\winapps\ST-I\Embedded Test Bench\tags\V12\Sequencer\Main Program.vi" -- -p:58810
LabVIEW/App started, process ID is 10008
Waiting for connection on port 58810
LabVIEW/App exiting...
LabVIEW exited with code 0
LabVIEW terminated unexpectedly!
This could be because LabVIEW was already running. Ensure it has stopped and try again.
ERROR: Job failed: exit status 1

 

It is waiting for some TCP port and closes after that.

In my case Docker is on linux and runner on windows and it must work.

I am clueless.

 

Regards

Yogesh

 

 

0 Kudos
Message 15 of 19
(1,724 Views)

I'm using this call in .gitlab-ci.yml to call a VI named "clt-analyzr.vi":

 

    script:
        - labview-cli --kill --timeout 30000 -v --lv-exe "%LABVIEW_2016_EXE%" "%TOOLS_FOLDER%%LABVIEW_CLT_PATH%clt-analyzr.vi" -- %CI_PROJECT_DIR% CLT

The variables are populated from gitlab itself, from gitlab runner's config.toml and from within the .yml file.

 

 

The resulting output is:

 

Running with gitlab-ci-multi-runner 9.5.0 (413da38)
  on vsphere-lv2016 (df1e0484)
Using Shell executor...
Running on WIN7-LV-BUILDER...
Fetching changes...
HEAD is now at a8ec78e trim whitespaces from env variables
Checking out a8ec78e2 as v1.4.0l...
Skipping Git submodules setup
$ labview-cli --kill --timeout 30000 -v --lv-exe "%LABVIEW_2016_EXE%" "%TOOLS_FOLDER%%LABVIEW_CLT_PATH%clt-analyzr.vi" -- %CI_PROJECT_DIR% CLT
LabVIEW CLI Started - Verbose Mode
Version 1.5.1.0
LabVIEW CLI Arguments: --kill --timeout 30000 -v --lv-exe C:\Program Files (x86)\National Instruments\LabVIEW 2016\LabVIEW.exe C:\Multi-Runner\tools\cmdline-tools\_dist\LV2016\clt-analyzr.vi
Arguments passed to LabVIEW: C:/Multi-Runner/builds/df1e0484/0/hampel-soft/cmdline-tools CLT
Current Version: 2016 f2, 32bit
Detected LabVIEW versions:
2016 f2, 32bit(C:\Program Files (x86)\National Instruments\LabVIEW 2016\)
LabVIEW User Arguments: "C:/Multi-Runner/builds/df1e0484/0/hampel-soft/cmdline-tools" "CLT" 
Launching Program:
C:\Program Files (x86)\National Instruments\LabVIEW 2016\LabVIEW.exe "C:\Multi-Runner\tools\cmdline-tools\_dist\LV2016\clt-analyzr.vi" -- -p:60247 "C:/Multi-Runner/builds/df1e0484/0/hampel-soft/cmdline-tools" "CLT" 
LabVIEW/App started, process ID is 5424
Waiting for connection on port 60247
Client Connected

 

Edit: Are you using the LabVIEW-CLI VIs as per James' description on https://github.com/JamesMc86/LabVIEW-CLI/wiki/Getting-Started-With-LabVIEW-CLI ?




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 16 of 19
(1,721 Views)

Thanks for input joerg.

My lab view version was 2013. You use 2016. I am now updating to 2016.

You use one of the params as Command Line tools (CLT) like below

Arguments passed to LabVIEW: C:/Multi-Runner/builds/df1e0484/0/hampel-soft/cmdline-tools CLT

To install CLT did you use 

https://github.com/chinghwayu/Command-Line-Tools ?

OR

there is also second link 

https://github.com/LabVIEW-DCAF/buildsystem/

Which one must be used ?

 

 

There is mention of so many tools if  I choose the chinghwayu/Command-Line-Tools

  1. JKI VI Tester
  2. JKI VI Testser JUnit XML Test Results
  3. NI Unit Test Framework
  4. UTF Junit Report
  5. Junit Results API

nice to know what tools exactly you used on your PC.

 

Regards

Yogesh

0 Kudos
Message 17 of 19
(1,704 Views)

Sorry, Yogesh, I see now that my post might have caused a little confusion.

 

1.) I did not install any of the tools you mentioned, neither Ching-Hwa Yu's nor the DCAF ones. The only thing I installed on my build machine are LabVIEW, the gitlab runner and the LabVIEW-CLI tools. These are the only things you need to execute a simple LabVIEW VI that you can build yourself in order to test your setup (again, see https://github.com/JamesMc86/LabVIEW-CLI/wiki/Getting-Started-With-LabVIEW-CLI for more information). 

 

2.) I use my own suite of helper VIs that do all the stuff I want my Continuous Integration chain to do (setup, analyze & test, build, deploy). These are called "cmdline-tools", that's what shows up in the arguments passed to LabVIEW. The one of them called in the examples (clt-analyzr.vi) is running VI Analyzer tests.

 

3.) In my cmdline-tools, I make use of the LabVIEW-CLI helper VIs to receive command line inputs (said parameters) and send back response output to the command line.

 

4.) For better understanding: The arguments passed to LabVIEW are completely proprietary to my own set of cmdline-tools.

 

4.1) The first argument passed to LabVIEW is the path to the project repo. The variable %CI_PROJECT_DIR% is set automatically from gitlab itself.

 

4.2) The second parameter is just something I use in my own LabVIEW helper VIs. I define various variables inside the .gitlab-ci.yml, and this second parameter tells my tool which of these variables to use.

 

Here is another example of another one of my projects called "hampelsoft-libraries", using the "LIB" prefix for variables:

 

Running with gitlab-ci-multi-runner 9.5.0 (413da38)
on vsphere-lv2016 (df1e0484)
Using Shell executor...
Running on WIN7-LV-BUILDER...
Fetching changes...
HEAD is now at c39518e added padding input
Checking out c39518e1 as v0.3.4...
Skipping Git submodules setup
$ labview-cli --kill --timeout 30000 -v --lv-exe "%LABVIEW_2016_EXE%" "%TOOLS_FOLDER%%LABVIEW_CLT_PATH%clt-analyzr.vi" -- %CI_PROJECT_DIR% LIB
LabVIEW CLI Started - Verbose Mode
Version 1.5.1.0
LabVIEW CLI Arguments: --kill --timeout 30000 -v --lv-exe C:\Program Files (x86)\National Instruments\LabVIEW 2016\LabVIEW.exe C:\Multi-Runner\tools\cmdline-tools\_dist\LV2016\clt-analyzr.vi
Arguments passed to LabVIEW: C:/Multi-Runner/builds/df1e0484/0/hampel-soft/hampelsoft-libraries LIB
Current Version: 2016 f2, 32bit
Detected LabVIEW versions:
2016 f2, 32bit(C:\Program Files (x86)\National Instruments\LabVIEW 2016\)
LabVIEW User Arguments: "C:/Multi-Runner/builds/df1e0484/0/hampel-soft/hampelsoft-libraries" "LIB"
Launching Program:
C:\Program Files (x86)\National Instruments\LabVIEW 2016\LabVIEW.exe "C:\Multi-Runner\tools\cmdline-tools\_dist\LV2016\clt-analyzr.vi" -- -p:61848 "C:/Multi-Runner/builds/df1e0484/0/hampel-soft/hampelsoft-libraries" "LIB"
LabVIEW/App started, process ID is 4468
Waiting for connection on port 61848
Client Connected

 

I hope this clears things up a bit.

 




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 18 of 19
(1,696 Views)

hello Ian,

Just a short update in case it helps.

I dont much experience with labview , but we just added the section "VI setup" that is mentioned in this link

https://github.com/JamesMc86/LabVIEW-CLI/wiki/Getting-Started-With-LabVIEW-CLI

 

  1. Have the LabVIEW CLI library included to initiate the connection to the command line and communicate back to it. This is a very simple API with a connect, write and exit (with exit code) pattern.
    CLI Example

  2. Be setup to run on launch (if being run as a VI, not an executable).

 

We basically Copied the above diagram  as mentioned in 1.) that is seen in demo CLI code part (CLI Demo.vi )   and pasted in our vi file (the vi you want to test). Save this VI file. 

 

As mentioned in 2.) go to File-> Vi properties and click the option Execute when run.

After this it got connected over TCP and able to execute.

Hope it helps.

 

Regards

Yogesh

 

 

0 Kudos
Message 19 of 19
(1,676 Views)