Is it possible to run an executable present on the CERNBox via a SWAN notebook? In a Python script, this is easy to implement.
For example, let’s imagine one has a cool_app.exe executable in the CERNBox; the app is not written in python so it cannot easily be translated into a python package.
It’d be really cool if one could run it from a SWAN notebook with a command like
Thank you in advance for your help,
I think this is already possible since the subprocess module is available through SWAN. For instance using r = subprocess.run( [“path_to_executable”,“argument”], capture_output=True) or something like that, seems to work for me…
However you have to be careful of your environment if your executable depends on dynamic libraries, namely the LD_LIBRARY_PATH. You have to make sure to have everything in the LD_LIBRARY_PATH in your SWAN session, which can be set through an environment script at the configuration step. (or direclty in a notebook or the SWAN console). From this I guess all the ingredients are there…
Moreover, you may know that there is a powerful way to run c++ code in SWAN using the ROOT software and the ROOT bindings such as this example
The very interesting from this is to get some compatible output from your c++ code, such as objects, directly in python through ROOT, and this is great for interactivity with the c++ code.
However this needs a dynamic library (.so) file from your c++ code, meaning that you need to adapt the makefile to create such library, to be loaded in root as you see in the example. Side remark, you may have some warnings in swan if you compiled the code with a different gcc version, but anyway… I hope this helps !
Happy Easter, and cheers !
Thank you for the reply, and Happy Easter.
Is there a small guide explaining how to view/edit the LD_LIBRARY_PATH ? I’m not familiar with this variable.
When trying to run the code line you kindly proposed, including the path to the .exe file in SWAN, I obtain the error:
[Errno 8] Exec format error: '/eos/home-e/my_username/SWAN_projects/tests/my_folder/my_app.exe'
In my specific case, which is probably not the most general case, I’m trying to run an executable that was generated with Matlab, and hence requires the Matlab Runtime (MCR) software. This is probably why I obtain the error message.
Do you see any workaround?
Since you mention .exe files, I assume you’re trying to run a Windows executable. Your SWAN session runs on a Centos 7 (CC7) container, so you won’t be able to run windows software there.
Thank you Diogo.
Yes, I’m trying to run an executable that I regularly use in my Windows machine.
Isn’t there any workaround?
What application types are supported?