Introducing Project January

A new project proposal from the Eclipse Science Working Group (SWG) goes live. Project January aims to provide a set of standardized Java-based numerical data structures for scientific computing. Scientific tools are rapidly scaling to meet the increasing demands of the user both in sheer volumes of data as well as complexity. Back at a site meeting in Trondheim, the SWG members agreed a generic dataset that would promote tool integration was one of the key priorities of the group. In the short-term, this looks a lot like “numpy for Java”. That in itself is a pretty big deal, but the future plans are equally exciting, check out the proposal here.

As for the name, project January works on many levels. Besides being the month the project proposal goes live, it is also an acronym: JAva NUmerical ARraYs :-). The month January is named after the Roman god Janus, god of new beginnings and doorways. Project January is a foundational building block of scientific computing and certainly a doorway to greater collaboration and tool integration within the Eclipse community and beyond.

Modularity in Java? Don’t Wait For Java 9/Jigsaw

Before 2016 all I really knew about Java 9 was that it would have project Jigsaw for modularity and that it would be late. A London Java Community meetup gave me an excellent excuse to pay more attention to Java 9 and think more on the whole concept of modularity in general.

The evening featured two excellent and complementary talks, Alex Blewitt on ‘Modularity in Java With OSGi‘ and Simon Ritter on ‘Modularization With Project Jigsaw in JDK 9‘. With those, some follow on insightful pub-talk & more discoveries on the web, below are the key things I take away from it all.

  1. Java 9 will be modular, hooray! And there will be a new linker tool jlink  to allow you build a streamlined custom image of the JDK. Using this to run Eclipse on a custom Java 9 image resulted in a 40% size reduction.  And that still included Swing & AWT, so the full benefits may be yet to come as application developers can start to take advantage of this new underlying modularity.
  2. OSGi & Jigsaw are both frameworks that facilitate modularity in Java, so have plenty in common, but some major differences. The most significant are basically features that OSGi has that Jigsaw lacks, namely versioning, dynamic modules and a service registry. By all appearances, Jigsaw is going for appearance of simplicity at the cost of functionality and complexity down the line. With no compelling reasons to switch, I will happily stick with OSGi and bet on the fact there are enough folks out there who will figure out how to get them working together.
  3. Jigsaw doesn’t make code more modular, developers make code more modular.  As Alex points out in his slides, modularity is hard. Frameworks like Jigsaw and OSGi make it easier, but there is still alot to be done on our own codebases. I know from experience, even OSGi users may sometimes have delusions of modularity – lots & lots of bundles which still, in practice, amount to a monolithic application. A notable amount of work we do is just that: understanding the essence of what each bundle should be then distilling it down by reworking it and removing bad dependencies so code can be reused in multiple forms with minimal dependencies.

So don’t wait for promises of Jigsaw to make your code more modular. Start now. Use OSGi. And don’t see it as a one-off thing. Actively developed code doesn’t stay modular for long. Review often. Modularity in Java is not a framework, it’s a habit to cultivate.

Launching with EASE

Launching with EASE - using auto completion
Launching with EASE – using auto completion

I have been doing some experiments with Eclipse EASE in preparation for determining the suitability – and creating a prototype – of using EASE with non-JVM scripting languages, in particular Python (CPython specifically).

To achieve this end goal I am working on a new module, /System/Launch, to allow me to explore that functionality. As a practical goal I am trying to use EASE to solve a long term problem of how to launch more complicated systems, especially those that run out of steam with the Launch Groups. For instance, multiple launches for debugging a multi-core system (especially with customizations and interdependencies) or parametrization of job launches.

Scripted Launch Group

As a starting point I want to simply re-create what Launch Groups can do in Javascript. So with EASE installed, including my new module, this is what a simple Launch Group replacement looks like.

The Launch Module

The Launch Module is a new module under consideration for EASE (Bug 478397). Its key method is the “launch” method which takes a Launch Configuration Name and an optional Launch Mode. The method then loads the named launch configuration and launches it, finally returning an ILaunch to allow future interaction with.

By using the launch method multiple times, with some additional control around it, allows complex launch sequences to be created.

Examples

For these examples I have already created three launch configurations for my individual tools (the name of the launch configuration is the quoted string in the bullet list):

  • “Prepare” – An External Tools configuration which prepares my test environment
  • “Server” – A PyDev supplied, Python Run configuration to launch my Python server
  • “Client” – A Java configuration to launch my Java client

Running The Examples

  1. Create three launch configurations named as above.
  2. Clone/Import “JavaScript Snippets” project. The examples are located in org.eclipse.ease.scripts git repository (or will be soon, follow Bug 478397 to find out more).
  3. Open the scripts in “Launch Module Examples” folder.
  4. Right-click on the desired script
  5. Choose Run As –> EASE Script

Alternatively paste the lines from the examples into the Rhino Script Shell console (as in the screenshot above). You get auto-completion of the names of the launch configurations and the launch modes too!

Example 1 – Fire and forget

In this first example, we simply launch the Client in Debug mode.

loadModule("/System/Launch")

launch("Client", "debug")

Line 1: load the Launch module, this populates the namespace with all the methods defined in the Launch module.
Line 3: launch the existing launch configuration “Client” in debug mode.

Example 2 – Replicate Functionality from Launch Groups

In this example, we prepare our environment with the “Prepare” configuration, then launch the “Server” and “Client” configurations.

loadModule("/System/Launch")

prepare = launch("Prepare")
while (!prepare.isTerminated()) {
 java.lang.Thread.sleep(1)
}

launch("Server")
java.lang.Thread.sleep(3000)

launch("Client", "debug")

Line 1: load the Launch module
Line 3: launch the Prepare configuration
Line 4-6: Busy-wait until the Prepare launch has terminated[1]
Line 8: launch the server
Line 9: Wait 3 seconds for the server to be ready
Line 11: launch the client in Debug mode

Example 3 – Terminating the Server Automatically

Example 1 and 2 are a promising start, but do not yet add any new functionality to Eclipse. So what do you do if you want the server to stop automatically when you finish debugging your client. Well that is really easy now, just monitor the client launch and terminate the server.

loadModule("/System/Launch")

prepare = launch("Program prepare")
while (!prepare.isTerminated()) {
 java.lang.Thread.sleep(1)
}

server = launch("Python Server")
java.lang.Thread.sleep(3000)

client = launch("Java Client", "debug")
while (!client.isTerminated()) {
 java.lang.Thread.sleep(1)
}
server.terminate()

Line 1-7: the same as Example 2
Line 8: launch the Server, but keep a handle of the ILaunch
Line 9: Wait 3 seconds for the server to be ready
Line 11: launch the Client
Line 12-14:Busy-wait until the Client debug session launch has terminated[1]
Line 15: terminate the server

This is a screenshot that shows what the Debug View looks like when we are busy-waiting on line 12.
At the top is the EASE Script launch of the example.
Then is the now terminated Prepare launch.
Followed by the still running Server in Run mode.
And finally, the Java Client, in Debug mode stopped at a breakpoint in main.

ease_launching_debug_view
Terminating the Server Automatically – Debug View

More Advanced Options

With the full power of the scripting language you can take these examples to the next step. A good place to start would be to remove the 3 second delay on Line 9 and replace that with some logic that actually determines if the server is ready to accept connections.

Other Functionality in the Launch Module

The Launch module is very new and I invite additional contributions to it to make it more useful. For now this is a quick overview of what it does:

String[] getLaunchConfigurationNames()

Returns an array of all the Launch Configuration Names known to the Launch Manager. These names can be used as the argument to the getLaunchConfiguration, launch and launchUI methods.

ILaunchConfiguration[] getLaunchConfigurations()

Returns an array of all the Launch Configurations known to the Launch Manager. These can be used as the argument to launch and launchUI methods.

ILaunchConfiguration getLaunchConfiguration(String name)

Return the launch configuration given by name parameter. The launch configuration can be edited or otherwise operated on. See ILaunchConfiguration.getWorkingCopy().

ILaunch launch(String launchConfigurationName, String mode)
ILaunch launch(ILaunchConfiguration configuration, String mode)

Launch the configuration either given by name or a launch configuration and return the ILaunch for further processing. This is the way to launch a configuration within a script which is itself launched.

ILaunch launchUI(String launchConfigurationName, String mode)
ILaunch launchUI(ILaunchConfiguration configuration, String mode)

Launch the configuration in the UI thread. This method respects the workspace settings for things like building before launching.

ILaunchManager getLaunchManager()

Obtain the platform launch manager. This allows access to the Eclipse debug core launch manager, allowing control over all non-UI aspects of launches. The most valuable of these should be wrapped for ideal script usage and made available in the module itself.[2]

Footnotes

1. A better API than busy-waiting is probably desired here, but that is for another day (and more Javascript knowledge).
2. Additional UI functionality is within the DebugUITools class, enabling access to this class directly from within the launch module is an option. Additionally, a Debug module would be very useful.

Eclipse Night London

Eclipse Night London was an evening for bringing together various folks of the Eclipse ecosystem (new and old) to talk tech and share a bite & a beverage (or two). The ultramodern offices of Stackoverflow Careers in London provided a great setting for the event. The relentless rain didn’t put off the attendees, some of whom were coming from as far afield as Cambridge and Oxfordshire.

IMG_20150916_173018
Emanuel of Genuitec & Tracy of KichwaCoders ready to kick things off

First up was Ian Mayo who demoed Debrief, a maritime analysis workbench based on Eclipse RCP that is used by the royal navy. Deftly going from slick demo to slick demo it was great to learn and watch. The best bit was saved for last, watching the visualisation of the manoeuvering of two submarines onscreen.

Matt Gerring talked to us about how Eclipse is used at Diamond Light Source, the synchrotron in Oxfordshire dubbed the UK’s biggest experiment. The experimental facility at Diamond handles tremendous amounts of data daily and the DAWNSci project is the workbench that helps the scientists make sense of it. Despite some tech gremlins interfering, Matt was able to talk us through it and demo some of the powerful capabilities of DAWNSci, which build on lots of existing projects in Eclipse and is part of the Eclipse Science Working Group.

Genuitec were the main sponsors of the evening and my co-host Emanuel Darlea spoke about the Eclipse based projects they have to offer, including MyEclipse and Secure Delivery Centre. That led nicely into the break and time for more refreshments and chatting.

IMG_20150916_171740
Mmm sushi

Mike Milikovich, Executive Director of the Eclipse Foundation gave us an awesome overview of how Eclipse has evolved over the years, and how it continues to do so, now including Cloud and IoT platforms under its wide umbrella. It was really interesting hearing about the ‘survival of the fittest’ approach to open source and how this means the Foundation have no idea what comes next – it is whatever technology evolves best. Also Mike talked about how the biggest challenge to Eclipse is not another IDE or technology or foundation but simply complacency, by its members and users. IMG_20150916_202244

As if on cue, Alex Blewitt took the stage and inspired us all with his tongue-in-cheek presentation ‘How to write bad eclipse plugins‘. It was a terrific talk, full of energy, humour and insights into the bad bad practices we may sometimes slip into (but my plug-ins are more important than all the others..). It rounded of the evening in grand style and the presentation is worth checking out here, plus for a little taste of the talk on the night watch this.

IMG_20150916_204851

By the end the room was buzzing, conversations flowed, more drinks were had, and eventually relocated to the pub downstairs. Stackoverflow offices were great, especially thanks to Natalie and her team who made us feel very welcome and ensured we had everything we needed on the evening. Many thanks to the folks who braved the rain to make it such a great event. Also thanks to the folks behind the scenes who made it happen: Tim & Sara from Genuitec and Jelena from Eclipse Foundation. It was a great evening for learning, sharing and enjoying good company. We’ll definitely be doing it again, join the Eclipse London User Group so we’ll let you know when.

Tremendous Tech in Trondheim

Trondheim is tiny – at least to someone who lives in the shadow of London. So it was eye-opening for me, over four short days, to immerse myself in the fully formed tech scene of a region with a population 2% of that of London’s.

Ocean Space Research at Marintek

Ocean Space – I’d never heard the term before so it took me a moment to understand, that as opposed to outer space, this refers to the vast unexplored regions below the sea-line which we know less about than the surface of the moon. This is the heart of what Marintek do, and they were the hosts for the science working group meeting I was there for, but more about that later. The work done at Marintek is fascinating, but I will limit it to my 3 highlights:

  • Ocean labs and  towing tanks are used for simulating conditions at sea, for example, oil rigs in the ocean. Yes the tanks are bigger than swimming pools. Yes they could generate all sorts of waves. No we couldn’t swim in them (or take selfies for that matter).
  • Floating wind turbines –  I heard about them first here – harnessing wind power in the deep sea, amazing!
  • Cavitation tunnels – first the science lesson: air bubbles under pressure actually boil at low temperatures, causing implosions aka cavitation – how great is that? So great, I’m linking to this video again so you don’t miss it.   Well, actually it’s not so great for badly designed propellers. Luckily this can all be tested for in a cavitation tunnel.

The icing on the cake for the visit was hearing about the plans for a bigger and better ocean space centre,  opening in 2020 (assuming the politics all works out as planned). Who knows what else the great depths have to offer mankind?

Continue reading “Tremendous Tech in Trondheim”