Call ./.../bin/spark-submit pythonfile.py in eclipse (Pydev) console when running program - eclipse

Current situation which works fine:
I'm currently programming my Pyspark files in eclipse with the Pydev plugin
I manually execute these files in the ubuntu shell with the following command:
./.../bin/spark-submit pythonfile.py
Desired situation:
When I press the "run" button in eclipse, eclipse will call the command mentioned above and show the console output in the eclipse console.
Is this possible and if yes, could someone give me a clue on how to do it?
Thank you!

I would recommend an external launch.
From the Run menu, choose External Tools | External Tools Configurations... and then create a launch configuration specifying the command you want to run.
You can generalize the command a little by using Variables For example:
Location: ${workspace_loc:/myprojectname}/../bin/spark-submit
Working Directory: ${workspace_loc:/myprojectname}
Arguments: ${workspace_loc:/myprojectname/myscript.py}
This is what a screenshot of the configuration looks like.
Additionally, in the Common tab you have a control over whether the output is captured in a console (the default) and/or redirected to a file. In this example screenshot, the output comes to a console and is written to a file back in my project:
Output file: ${workspace_loc:/myprojectname/build_output}

Related

Make eclipse_debug.py work

(In Windows 10, I have installed ...\AppData\Local\Enthought\Canopy that includes Python 2.7, %PATH% points to Canopy)
I have seen this link, and want to make interactively debug Python code running in PyXLL work via that eclipse_debug.py.
So I have done the following:
1) erase PYTHONPATH in the control panel of Windows (as a result, echo %PYTHONPATH% returns %PYTHONPATH%).
2) modify only the first line of eclipse_debug.py to be eclipse_roots = [r"C:\my_path_to\eclipse"].
3) add eclipse_debug.py to pyxll.cfg
4) define a function hello
5) launch debug servier in eclipse, and then launch Excel, and then reload PyXLL
Here is a screenshot:
1) So, it shows that the function hello does work.
2) However, I don't see any excel menu item related to debugger, whereas their link promises This module adds an Excel menu item to attach to the PyDev debugger, and also an Excel macro so that this script can be run outside of Excel and call PyXLL to attach to the PyDev debugger. In other words, I don't see how interactive debug is enabled here.
Could anyone tell me what this eclipse_debug.py supposed to do?
Well, from what I can tell by looking at it, eclipse_debug.py adds the PyDev Remote Debugger (http://www.pydev.org/manual_adv_remote_debugger.html) to the PYTHONPATH and starts it.
Now, how do you make a Python script such as eclipse_debug.py appear as a menu in PyXLL is something I'm not familiar with.
The most likely cause is that it's looking for pydevd but is unable to find it on your python path or where it's looking under the eclipse root. If that's the case there will be some output in the pyxll log file and that will be why the menu item is not appearing.
You should check the log file for errors, and hopefully that will tell you what is going wrong.

eclipse debug perl curses

I am writing a Perl program that uses curses for output and move the cursor, and color characters. Previously, when I was working under windows I use Komodo it was able to run an external console.
Now I work in Linux environment and use eclipse + epic. If you try to just run the script, it uses the internal console eclipse, which is very cut. You can just run the script using external tool, but I'm interested to debug using external console window. Is this possible?
Unfortunately, use of a File and /dev/pty/1 does not help in solving my problem.
The fact is that in this case it is impossible to get the characters introduced in the console through curses getch(). Always returned 1 instead code of pressed key.
Here is an answer that will take you most of the way (based on post #6 of: http://ubuntuforums.org/showthread.php?t=743131, although since then, in the "Indigo" and "Juno" versions of Eclipse, things have changed somewhat, and this answer is up to date):
Go to "Run -> Debug configurations". Click on the (fourth) "Common" tab. Go to the third frame from top, and there, check-mark the checkbox which says: "File". Enter the file name of the console window you want your output in.

Command line serial terminal

I'm using Eclipse to develop application for embedded systems.
One of the options of Eclipse configurations are "Program to run after programming/building"
Usually, on that textbox it's the path to our .exe generated before, but on this case I want to run a serial port terminal, like this:
terminal -COM=9 -baud=9600...
My goal here it's to have that terminal printing on Eclipse console. Is that possible?
You could use the Target Management platform to achieve this result. Sadly, I did not try this, so cannot tell whether it works or not, but should be according to the about page.

Launch terminal from eclipse

I recently switched to Eclipse (Helios) for my programming needs, and I like it very much.
There is just on thing that is driving me crazy, how can I launch (compile and run) my code into the native mac osx terminal.
I tried creating an "external tools configuration", but that just starts the terminal without outputting the application.
What I do now is right-click on the binary in the Project Explorer and then "Open With" and then "Other" and then I pick the terminal app from the list. But this solution is driving me nuts.
Please help.
It's all about defining the External Tool correctly.
For example, the following should work if your selected file is a Unix executable.
Open a new External Tool configuration.
Set the location to /usr/bin/open
Set Working directory as ${selected_resource_loc}
Set the arguments to -a /Applications/Utilities/Terminal.app ${selected_resource_loc}
When you run make sure you select "src"
This should work. You could improve it further. You could even write an AppleScript that would do that and run it using osascript.

Eclipse - Running programs not in the native eclipse console

I'm currently writing some ncurses code and the native Eclipse (3.2.2) console can't display its graphics. I'd instead like to run the program through xterm. What I want is to be able to start xterm and run from there. I'd prefer to not get involved with any plugins or that jazz. Just something simple.
EDIT
So I have the answer and it was pretty simple...
Run -> External Tools -> External Tools -> New Launch Config...
Then select location of your terminal emulator. /usr/bin/gnome-terminal in my case.
after that set the appropriate arguments. "-e ~/ncurses/start" in my case.
Then make sure you aren't allocating a console by unchecking that option in the "Common" tab.
Annon add to his question:
its a pain to keep switching back and forth from eclipse and the terminal. I'm looking for a way to just hit something like"F5" and have it run my ncurses program in a new xterm terminal process
The simplest way to do that is to report the command line into an external tool configuration, and point eclipse to use a shell (like described in this program)
In the argument, you will add the command line eclipse execute (command line which can be retrieved as mentioned in the second part of this answer below).
Of course, replace 'cmd.exe' by the shell of your choice, and try not setting the 'Allocate Console' checkbox in the Common tab of that external launcher.
To launch through a xterm, without eclipse involved (not what you are asking for, just keep here for archive)
You can launch your program through Eclipse (Run Configurations), and observe through a 'ps' command the exact Java command line used.
Or launch it in debug mode, and right click the task in Debug view and open Properties. It will show the command line, as documented here.
Then launch that command line directly in your console (Eclipse being not involved at all at this point).