Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ice-dev] [triquetrum-dev] ice-triquetrum fork

Erwin,

Looks like you have done this right, but the NPE is the result of a bit of missing documentation on my part.

We only use a second Form in the case where ICE runs an Action in process() and that Action needs to request information not part of the original Form. This would be something like requesting a user name and password, if required. Checkout JobLauncher for an example.

FormStatus.NeedsInfo is specifically reserved for this case, so I've entered a bug to update that documentation. Your Model needs to use different values of FormStatus. Line 108 should be FormStatus.InfoError since there should be no good reason for that value to be null (the Entry won't even return that). At line 124, you can just return FormStatus.ReadyToProcess since the default configuration of the data component is technically valid for processing.

We typically cheat a little bit on implementing this and do something like:

FormStatus retStatus = FormStatus.ReadyToProcess;

if (someConditionBasedOnTheForm) {
   // ... do some work
} else {
   retStatus = FormStatus.InfoError;
}

This exploits the fact that an Entry will never return null and that however you configure the data component, the first selection will always be valid to process.

Jay


On Thu, Feb 25, 2016 at 4:47 PM, Erwin de Ley <erwin.de.ley@xxxxxxxxxx> wrote:
Hi Jay, ICE team,

I'm trying to implement a "2-step"-form on an ICE Item, as explained below. I.e. :
1. the user should get a list of available workflows (the list is now mocked with 2 painfully simple in-memory constructed model instances)
2. the user picks one model and then
3. the Item form should be replaced/extended with a form that shows dynamically generated workflow configuration entries
(based on the parameters that the workflow has defined in its model)
4. the user can optionally change parameter values and then launch the workflow

So I'm trying to add a datacomponent with on-the-fly generation of a variable set of form entries after giving the user the opportunity to pick a workflow.
But I can not get this working, although I think I'm close...

It seems the form and the included datacomponents of an item must be created in setupForm() that is already invoked during the base-class constructor invocation?
And that it should be possible to add entries to one of those datacomponents dynamically later on?
I've tried that, cfr attached source. Is someone able to review that?

I also hit an NPE, e.g. when trying to save the form after selecting a workflow or when clicking Go! for an incomplete form and then returning a FormStatus.NeedsInfo from inside process().

It seems the Item base class has an action property that is null. Do I need to set that one at some point? I could not see that being done in those examples though...

E.g. when saving :




!ENTRY org.eclipse.ui 2 0 2016-02-25 22:13:38.071
!MESSAGE Save Failed
!STACK 0
java.lang.NullPointerException
    at org.eclipse.ice.item.Item.getForm(Item.java:795)
    at org.eclipse.ice.core.internal.itemmanager.ItemManager.retrieveItem(ItemManager.java:315)
    at org.eclipse.ice.core.internal.Core.getItem(Core.java:448)
    at org.eclipse.ice.client.internal.Client.formUpdated(Client.java:607)
    at org.eclipse.ice.client.widgets.ICEFormEditor.notifyUpdateListeners(ICEFormEditor.java:1069)
    at org.eclipse.ice.client.widgets.ICEFormEditor.doSave(ICEFormEditor.java:710)
    at org.eclipse.ui.internal.SaveableHelper$2.run(SaveableHelper.java:156)
    at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:285)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:463)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:371)
    at org.eclipse.ui.internal.WorkbenchWindow$14.run(WorkbenchWindow.java:2156)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2152)
    at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:293)
    at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:271)
    at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:161)
    at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:3874)
    at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3888)


And when trying to Go! :

Exception in thread "Thread-73" java.lang.NullPointerException
    at org.eclipse.ice.item.Item.getForm(Item.java:795)
    at org.eclipse.ice.core.internal.itemmanager.ItemManager.retrieveItem(ItemManager.java:315)
    at org.eclipse.ice.core.internal.Core.getItem(Core.java:448)
    at org.eclipse.ice.client.internal.ItemProcessor.run(ItemProcessor.java:473)
    at java.lang.Thread.run(Thread.java:745)


regards
erwin

                                            
Op 25/02/2016 om 18:26 schreef Jay Jay Billings:
Ah. I see. There are several ways you could do that. One way is to use our MasterDetailsComponent, but that can be pretty complicated to get working. It would give you a really nice Master-Details pair view of the list of workflows and the parameters. 
Personally, I would just keep it simple. You can create a second DataComponent in setupForm() that shows the parameters for the workflow. Leave it empty or fill it with common, default values to start. Then, override reviewEntries() and once they pick the workflow and hit 'Save' you can just add/overwrite entries in the second DataComponent. This is what we do most of the time for problems like this and it is very scalable. 
Nek5000 is a good example of this, which you can see if you check out org.eclipse.ice.nek5000.Nek5000Model.java:250. In this case, users pick which example problem they want to run in a data component on the left, and the remaining data components (of which there are 5-10) are repopulated based on that choice. 
Jay
On Thu, Feb 25, 2016 at 12:17 PM, Erwin de Ley <erwin.de.ley@xxxxxxxxxx> wrote:
OK, but what should I do to add a second step/form in the specification of the Item, before launching the workflow? I.e. step/form 1 would show a list of available workflows. Then the user selects 1 and then I would want to show a second form that shows the parameters available for that particular workflow. Then the user sets some values and launches the workflow. erwin
Op 25/02/2016 om 17:39 schreef Jay Jay Billings:
Erwin,
Great!
The simplest way that you can get the list to update is to just update the Entry on the Form. The Entry will post an update that will be used to notify the UI. You can do that asynchronously or override submitForm().
Jay
On Thu, Feb 25, 2016 at 10:23 AM, erwindl0 <erwindl0@xxxxxxxxx> wrote:
Jay, The first basic step is done and working locally. I have added the necessary Triquetrum features to the ICE mars.target, and added minimal code to what you prepared to launch a trivial (fixed) workflow from the TriquetrumWorkflowItemModel. Next steps : 1. add a simple implementation of triquetrum's WorkflowRepositoryService. (done) 2. then the workflow editor can save models in there and... 3. the Triq...Item can browse the repo and provide a selection to the user in its form 4. ideally I would like to be able to dynamically redefine & rerender the form, based on available settable parameters in the selected workflow. I guess I can get that done by returning a NeedsInfo FormStatus after the first step? I.e. can an ICE Item iterate through completely different form definitions? Is there an example available for that? 5. then I can read the user-defined parameter values and launch the parameterized workflow 6. get that working for you as well : this would imply that you can also use the extended target. Whereas the Triq features now refer to a local feature export location on my machine, that would mean that I should have a Triquetrum p2 available for you. So ICE #128 will be really timely for that! regards erwin Op 24/02/2016 om 14:47 schreef Jay Jay Billings:

Erwin,

You can just push back to my fork. This is just a demo for EclipseCon, so we can commit it however we want.

I still need to add you as a collaborator on the fork. What is your github username again? (Hard for me to look up while sitting in a traffic jam. ;))

Jay

On Feb 24, 2016 8:39 AM, "erwindl0" <erwindl0@xxxxxxxxx> wrote:
Thanks Jay. So I assume that I just clone from your fork, create some triquetrum branch from the next branch, and then push my commits there? Or do I fork again myself and then do pull requests to your repo? cheers erwin Op 23/02/2016 om 23:07 schreef Jay Jay Billings:
Erwin and Christopher,
CC'ed ice-dev for completeness.
I started putting together a plugin for ICE that will run Triquetrum workflows. It was easiest to do this with a fork of the main ICE repo so that I can give Erwin commit privileges to push his changes back.
The way that I am doing this for now is to create an ICE plugin using our project generator. This will be sufficient to demonstrate for the talk that ICE and Triquetrum can talk to each other. However, it is not the way that I want to do it long term. The really sustainable way to do this will leverage some upcoming workflow engine updates that we are working on which will make it possible to create compositions of whole workflow engines.
Here are the instructions to get the fork and run ICE from it:
1.) Create an empty workspace
3.) Switch to the next branch and import all projects
4.) Go to org.eclipse.ice.target.mars and set mars.target as your target (unless you are doing this with ICE, which already has all of the required bundles set).
5.) Go to the org.eclipse.ice.repository project and right-click and run the launch configuration product.* for your OS. If you are using Windows or Mac, you will need to add org.eclipse.ice.triquetrum to that configuration.
6.) Go to the ICE perspective and in the ItemViewer at the left create the Triquetrum Item by clicking on the green plus button. The Triquetrum Item is currently at the bottom of the list that appears with an ugly name at the moment. (See attached picture.)
You can edit the code for Triquetrum by modifying the contents of the org.eclipse.ice.triquetrum bundle. I suggest that we do everything in the Model Item for the moment and don't mess with the launcher (no need really).
I think the way that this should work is that someone creates a workflow in Triquetrum with the graphical tools. Then, they open this Triquetrum model in ICE and they have a list of Triquetrum workflows from which they can choose. Once they pick one, the can choose something like "Launch Triquetrum Workflow" from the process bar at the top, hit Go! and the process() operation executes the workflow.
I have attached a data file that contains reflectivity data. The x axis is the angle Q and the y axis is the specular reflectivity. I don't know the units off-hand.
This is all I have time to do with this today and probably until Friday, but I should still be able to answer questions. If you can get ICE calling Triquetrum from TriquetrumWorkflowItemModel.setupForm(), then the rest should be very easy.
Jay
--
Jay Jay Billings
Oak Ridge National Laboratory
Twitter Handle: @jayjaybillings
_______________________________________________
triquetrum-dev mailing list
triquetrum-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/triquetrum-dev
--
Jay Jay Billings
Oak Ridge National Laboratory
Twitter Handle: @jayjaybillings
_______________________________________________
triquetrum-dev mailing list
triquetrum-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/triquetrum-dev
_______________________________________________ triquetrum-dev mailing list triquetrum-dev@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/triquetrum-dev
--
Jay Jay Billings
Oak Ridge National Laboratory
Twitter Handle: @jayjaybillings
_______________________________________________
triquetrum-dev mailing list
triquetrum-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/triquetrum-dev



--
Jay Jay Billings
Oak Ridge National Laboratory
Twitter Handle: @jayjaybillings

Back to the top