Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » MWE: delay issue with mwe invoked from Eclipse' action
MWE: delay issue with mwe invoked from Eclipse' action [message #816807] Fri, 09 March 2012 04:28 Go to next message
Karel Gardas is currently offline Karel Gardas
Messages: 31
Registered: July 2009
Member
Hello,
I'm playing with mwe/xpand in an attempt to generate simple xsd from ecore. The thing is working well already when invoked from Eclipse (right-click on xsd.mwe and executing it as a MWE Workflow).
My problem is that I've made a plugin which provides an action which invokes this xsd workflow on a selected ecore file. The problem is that the action is invoked, workflow is started but then it halts for about 2 minutes and then continues. During 2 minutes halt I don't see any huge memory allocations, or heavilly reading from disk or a lot of CPU consumption. Nothing. It (eclipse process) shows just very little activity at all. My code from action looks (f is selected IFile):
mon.subTask("Generate XML Schema for " + f.getName() + " model ...");
IPath model_path = f.getFullPath();
String wfFile = "workflow/xsd.mwe";
Map<String, String> properties = new HashMap<String, String>();
IPath src_gen = f.getParent().getLocation();
properties.put("src-gen", src_gen.toString());
properties.put("model", model_path.toString());
StringTokenizer tok = new StringTokenizer(f.getName(), ".");
String name = tok.nextToken();
String xsdFileName = name + ".xsd";
properties.put("xsdFileName", xsdFileName);
Map slotContents = new HashMap();
WorkflowRunner wrun = new WorkflowRunner();
wrun.run(wfFile , null, properties, slotContents);
f.getParent().refreshLocal(1, null);


I've stripped debug messages out. The output of workflow run invoked by this action then looks:

Mar 8, 2012 8:49:46 PM org.eclipse.emf.mwe.core.WorkflowEngine prepare
INFO: --------------------------------------------------------------------------------------
Mar 8, 2012 8:49:46 PM org.eclipse.emf.mwe.core.WorkflowEngine prepare
INFO: EMF Modeling Workflow Engine 1.1.1, Build v201108020506
Mar 8, 2012 8:49:46 PM org.eclipse.emf.mwe.core.WorkflowEngine prepare
INFO: (c) 2005-2009 openarchitectureware.org and contributors
Mar 8, 2012 8:49:46 PM org.eclipse.emf.mwe.core.WorkflowEngine prepare
INFO: --------------------------------------------------------------------------------------
Mar 8, 2012 8:49:46 PM org.eclipse.emf.mwe.core.WorkflowEngine prepare
INFO: running workflow: workflow/xsd.mwe
Mar 8, 2012 8:49:46 PM org.eclipse.emf.mwe.core.WorkflowEngine prepare
INFO: 
Mar 8, 2012 8:49:46 PM org.eclipse.emf.mwe.utils.StandaloneSetup setPlatformUri
INFO: Registering platform uri '/export/home/karel/usr/local'
Mar 8, 2012 8:51:57 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: Reader: Loading model from platform:/resource//testECoreToXWiki/model2/rocket3.ecore
Mar 8, 2012 8:51:57 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: CheckComponent: slot model check file(s): metamodel::Checks 
Mar 8, 2012 8:52:01 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: Generator: generating 'template::ecore2xsd::main FOR model' => /export/home/karel/runtime-EclipseApplication/testECoreToXWiki/model2
Mar 8, 2012 8:52:01 PM org.eclipse.xpand2.output.XmlBeautifier beforeWriteAndClose
SEVERE: Use the XmlBeautifier from XSD Feature: org.eclipse.xtend.typesystem.xsd.XMLBeautifier instead.
Mar 8, 2012 8:52:01 PM org.eclipse.xpand2.Generator invokeInternal2
INFO: Written 1 files to outlet [default](/export/home/karel/runtime-EclipseApplication/testECoreToXWiki/model2)
Mar 8, 2012 8:52:01 PM org.eclipse.emf.mwe.core.WorkflowEngine executeWorkflow
INFO: workflow completed in 3854ms!


Please see especially timing on those two lines:
Mar 8, 2012 8:49:46 PM org.eclipse.emf.mwe.utils.StandaloneSetup setPlatformUri
INFO: Registering platform uri '/export/home/karel/usr/local'
Mar 8, 2012 8:51:57 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke


My question is: is this a know issue? If so, then is there any known fix or workaround for this. If not, then is there any way how to turn more verbose debugging on workflow so I can see more messages from it and judge better where it halts for those 2 minutes?

Thanks!
Karel
Re: MWE: delay issue with mwe invoked from Eclipse' action [message #816927 is a reply to message #816807] Fri, 09 March 2012 07:34 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten Thoms
Messages: 353
Registered: July 2009
Location: Dortmund
Senior Member

Hi Karel,

The StandaloneSetup will scan the subdirectories of the platformUri path for .project files. Usually the "platform path" should point to your workspace directory, so there is a limited number of directories to scan. In your case it is
'/export/home/karel/usr/local'
and I assume there a LOTS of directories in the deep file system hierarchy.

So move your projects to a better location, use this as platform path and it will work faster. You could also subclass StandaloneSetup and register this in your workflow to make it more fitting to your situation.

Regards,
~Karsten


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: MWE: delay issue with mwe invoked from Eclipse' action [message #816933 is a reply to message #816927] Fri, 09 March 2012 07:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6213
Registered: July 2009
Senior Member
And it additionally opens .jar files which might be deadly slow e.g.
if you have a maven structure
Re: MWE: delay issue with mwe invoked from Eclipse' action [message #817107 is a reply to message #816933] Fri, 09 March 2012 11:42 Go to previous messageGo to next message
Karel Gardas is currently offline Karel Gardas
Messages: 31
Registered: July 2009
Member
Hi Karsten,
you are right! My ~/usr/local is full of various Eclipse installations and other Java software. Thanks to your suggestion I've been able to hack my xsd.mwe to set better StandaloneSetup path and now everything is working as expected!
Thanks,
Karel
Re: MWE: delay issue with mwe invoked from Eclipse' action [message #817159 is a reply to message #817107] Fri, 09 March 2012 13:19 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4027
Registered: July 2009
Senior Member
Hi

A bug in MWE has just been fixed whereby running a specific script
searched everywhere to find it.

There are too many places in Eclipse Modeling projects where a total
scan of the EPackage Registry loads everything in sight. Generally any
project that tries to be helpful with a 'global' model index can be very
unhelpful performance-wise since the cost of building that helpful index
is huge and sometimes the cost of maintaining it is also huge.

A Bug in EGIT has also been fixed whereby it triggered a built at every
possible opportunity causing numerous nested rebuilds.

Regards

Ed Willink

On 09/03/2012 16:42, Karel Gardas wrote:
> Hi Karsten,
> you are right! My ~/usr/local is full of various Eclipse installations
> and other Java software. Thanks to your suggestion I've been able to
> hack my xsd.mwe to set better StandaloneSetup path and now everything
> is working as expected!
> Thanks,
> Karel
Previous Topic:MWE: Couldn't load resource under platform:/resource
Next Topic:Generating Java/Caml code from XMI model?
Goto Forum:
  


Current Time: Sat Aug 23 03:34:08 EDT 2014

Powered by FUDForum. Page generated in 0.03384 seconds