Quantcast

executing many grails commands on the cli

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

executing many grails commands on the cli

Bill Stephens
All,

I have a script that contains many grails commands that create an application, many domain classes, controllers and tests.

grails create-app RISE
cd RISE

grails
create-domain-class edu.osumc.bmi.acr.Encounter
create-domain-attribute edu.osumc.bmi.acr.Encounter admitDate Date
create-domain-attribute edu.osumc.bmi.acr.Encounter dischargeDate Date
create-domain-attribute edu.osumc.bmi.acr.Encounter encounterNumber String
.....

> ./RISE.sh

Then, lots of waiting and 300% CPU and a flaming laptop.

Is there a way to efficiently run this script without paying the penalty of starting a JVM for each command? Does the CLI have a way to accept a set of commands and to run them sequentially?

Thanks,
Bill
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: executing many grails commands on the cli

Andrew Todd
On Mon, Aug 20, 2012 at 8:42 PM, Bill Stephens <[hidden email]> wrote:
> Is there a way to efficiently run this script without paying the penalty of
> starting a JVM for each command? Does the CLI have a way to accept a set of
> commands and to run them sequentially?

I suppose that if there isn't, you could probably write something to
interact with the console using pexpect or expect.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: executing many grails commands on the cli

Bill Stephens
Yeah. I think I'm going my own way on this. 

I've already created a custom script to add domain attributes to a class from the CLI (https://github.com/wistephens/GrailsMDAScripts) and I plan to do the same for associations. This allows me to use a custom  application to generate a Grails project from an XMI model. 

So far, this has been awesome for kickstarting new projects way faster than the other developers in the office. I can go from XMI to running Grails app (with ~ 25 domain clssses) in about 15 minutes, but it would be much faster without the JVM startup overhead.

Bill



On Tue, Aug 21, 2012 at 9:10 AM, Andrew Todd <[hidden email]> wrote:
On Mon, Aug 20, 2012 at 8:42 PM, Bill Stephens <[hidden email]> wrote:
> Is there a way to efficiently run this script without paying the penalty of
> starting a JVM for each command? Does the CLI have a way to accept a set of
> commands and to run them sequentially?

I suppose that if there isn't, you could probably write something to
interact with the console using pexpect or expect.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: executing many grails commands on the cli

Babu Loganathan
I am not sure if you can do without a JVM start  !!!

Thanks...
Babu
On 24 August 2012 13:51, Bill Stephens <[hidden email]> wrote:

> Yeah. I think I'm going my own way on this.
>
> I've already created a custom script to add domain attributes to a class
> from the CLI (https://github.com/wistephens/GrailsMDAScripts) and I plan to
> do the same for associations. This allows me to use a custom  application to
> generate a Grails project from an XMI model.
>
> So far, this has been awesome for kickstarting new projects way faster than
> the other developers in the office. I can go from XMI to running Grails app
> (with ~ 25 domain clssses) in about 15 minutes, but it would be much faster
> without the JVM startup overhead.
>
> Bill
>
>
>
> On Tue, Aug 21, 2012 at 9:10 AM, Andrew Todd <[hidden email]>
> wrote:
>>
>> On Mon, Aug 20, 2012 at 8:42 PM, Bill Stephens <[hidden email]> wrote:
>> > Is there a way to efficiently run this script without paying the penalty
>> > of
>> > starting a JVM for each command? Does the CLI have a way to accept a set
>> > of
>> > commands and to run them sequentially?
>>
>> I suppose that if there isn't, you could probably write something to
>> interact with the console using pexpect or expect.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>



--

Hi



Thanks...
Babu Loganathan
+44(0)7588753444

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: executing many grails commands on the cli

Jeff Brown-3
In reply to this post by Bill Stephens

On Aug 20, 2012, at 7:42 PM, Bill Stephens wrote:

> All,
>
> I have a script that contains many grails commands that create an application, many domain classes, controllers and tests.
>
> grails create-app RISE
> cd RISE
>
> grails
> create-domain-class edu.osumc.bmi.acr.Encounter
> create-domain-attribute edu.osumc.bmi.acr.Encounter admitDate Date
> create-domain-attribute edu.osumc.bmi.acr.Encounter dischargeDate Date
> create-domain-attribute edu.osumc.bmi.acr.Encounter encounterNumber String
> .....
>
> > ./RISE.sh
>
> Then, lots of waiting and 300% CPU and a flaming laptop.
>
> Is there a way to efficiently run this script without paying the penalty of starting a JVM for each command? Does the CLI have a way to accept a set of commands and to run them sequentially?
>
> Thanks,
> Bill


One thing you could consider is writing a single script that executes all of the commands.  A trivial example could be something like this in ~/.grails/scripts/InitFancyApp.groovy...

includeTargets << grailsScript('_GrailsInit')
includeTargets << grailsScript('_GrailsCreateArtifacts')
target(initFancyApp: 'Init A Fancy App') {
    ['Second', 'Third', 'Fourth', 'Fifth'].each { newDomainClassName ->
        createArtifact name: newDomainClassName, type: 'DomainClass', path: 'grails-app/domain', suffix: ''
        createUnitTest name: newDomainClassName, suffix: ''
    }
}
setDefaultTarget 'initFancyApp'



That effectively runs "grails create-domain-class" over and over and over, all in the same JVM.

HTH



JB
--
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: executing many grails commands on the cli

Bill Stephens
Thanks, Jeff! I'll give this a go. A single JVM start is my goal!

On Fri, Aug 24, 2012 at 9:32 AM, Jeff Brown <[hidden email]> wrote:

On Aug 20, 2012, at 7:42 PM, Bill Stephens wrote:

> All,
>
> I have a script that contains many grails commands that create an application, many domain classes, controllers and tests.
>
> grails create-app RISE
> cd RISE
>
> grails
> create-domain-class edu.osumc.bmi.acr.Encounter
> create-domain-attribute edu.osumc.bmi.acr.Encounter admitDate Date
> create-domain-attribute edu.osumc.bmi.acr.Encounter dischargeDate Date
> create-domain-attribute edu.osumc.bmi.acr.Encounter encounterNumber String
> .....
>
> > ./RISE.sh
>
> Then, lots of waiting and 300% CPU and a flaming laptop.
>
> Is there a way to efficiently run this script without paying the penalty of starting a JVM for each command? Does the CLI have a way to accept a set of commands and to run them sequentially?
>
> Thanks,
> Bill


One thing you could consider is writing a single script that executes all of the commands.  A trivial example could be something like this in ~/.grails/scripts/InitFancyApp.groovy...

includeTargets << grailsScript('_GrailsInit')
includeTargets << grailsScript('_GrailsCreateArtifacts')
target(initFancyApp: 'Init A Fancy App') {
    ['Second', 'Third', 'Fourth', 'Fifth'].each { newDomainClassName ->
        createArtifact name: newDomainClassName, type: 'DomainClass', path: 'grails-app/domain', suffix: ''
        createUnitTest name: newDomainClassName, suffix: ''
    }
}
setDefaultTarget 'initFancyApp'



That effectively runs "grails create-domain-class" over and over and over, all in the same JVM.

HTH



JB
--
Jeff Brown
SpringSource
http://www.springsource.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Loading...