Are jobs working?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Are jobs working?

pledbrook
Hi,

I have created the following job in my Grails app:

import net.ixico.groovy.TaskScheduler

class PingTask {
    @Property startDelay = 10000
    @Property timeout = 20000

    @Property name = "Ping job"

    @Property execute = {
        println "Started ping..."
        // ...some other stuff here
    }
}

but it doesn't seem to be running. The file is in the grails-app/jobs
directory, and I also tried it with the name "PingJob", but it never
seems to run. Am I missing something?

Thanks,

Peter

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Are jobs working?

Michał Kłujszo


On 6/16/06, Peter Ledbrook <[hidden email]> wrote:
Hi,

I have created the following job in my Grails app:

import net.ixico.groovy.TaskScheduler

class PingTask {
    @Property startDelay = 10000
    @Property timeout = 20000

    @Property name = "Ping job"

    @Property execute = {
        println "Started ping..."
        // ...some other stuff here
    }
}

but it doesn't seem to be running. The file is in the grails-app/jobs
directory, and I also tried it with the name "PingJob", but it never
seems to run. Am I missing something?

Try naming the class PingJob instead of PingTask, and you should define execute as method not property.

cheers
  MK

Reply | Threaded
Open this post in threaded view
|

Re: Are jobs working?

pledbrook
> Try naming the class PingJob instead of PingTask, and you should define
> execute as method not property.
>
> cheers
>   MK

Thanks, that seems to be working now. It looks like the "create-job"
task is not generating the correct code.

On another point, does anyone know how to add extra libraries to the
Grails classpath so that the application has access to the classes in
them?

Thanks again,

Peter

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Are jobs working?

pledbrook
> On another point, does anyone know how to add extra libraries to the
> Grails classpath so that the application has access to the classes in
> them?

Don't worry, I know now. I put libraries in the <project hom>/lib
directory, but I was still getting a class not found exception.
Discovered that this is because the required library is not in the lib
directory!

Sorry,

Peter

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Limited CRUD functionality with one-to-many relationships?

Peter Wayner

I've been trying to test Grails with some one-to-many relationships  
and one-to-one relationships. The basic system works and lets me  
create, update and delete my objects, but I can't seem to get the  
system to list the links between the objects. For instance, here are  
three domain objects. When I run the generate-all script for all  
three, I end up with a working system. But I can' do the following

* Get any of the Wheel objects to appear on the Car edit page.
* Get any of the Car objects to be owned by a Driver. They just  
disappear and don't appear when I view a Driver object later.

Any ideas what I'm failing to do? Or am I at the edge of what Grails  
0.2 can do right now?

Thanks for all of your help.

-Peter Wayner


---------------------------------

class Car {
        @Property Long id
        @Property Long version

         @Property String make
         @Property String model
         @Property String color
        @Property Driver driver

         def belongsTo = Driver

        @Property Wheel wheel1
        @Property Wheel wheel2
        @Property Wheel wheel3
        @Property Wheel wheel4


/// hashCode etc deleted
}


class Driver {
        @Property Long id
        @Property Long version

         @Property String name
         @Property Date licenseExpires

        def relatesToMany = [ cars : Car ]
         @Property Set cars = new HashSet()

}


class Wheel {
        @Property Long id
        @Property Long version

         @Property String manufacturer
         @Property String size
         @Property String color

         def belongsTo = Car


}




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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Limited CRUD functionality with one-to-many relationships?

graemer
On 6/16/06, Peter Wayner <[hidden email]> wrote:

>
> I've been trying to test Grails with some one-to-many relationships
> and one-to-one relationships. The basic system works and lets me
> create, update and delete my objects, but I can't seem to get the
> system to list the links between the objects. For instance, here are
> three domain objects. When I run the generate-all script for all
> three, I end up with a working system. But I can' do the following
>
> * Get any of the Wheel objects to appear on the Car edit page.
> * Get any of the Car objects to be owned by a Driver. They just
> disappear and don't appear when I view a Driver object later.

When you save a domain class and reload it resets the in-memory
database, could this be causing the 'disappearing' behaviour that you
describe?

Graeme

>
> Any ideas what I'm failing to do? Or am I at the edge of what Grails
> 0.2 can do right now?
>
> Thanks for all of your help.
>
> -Peter Wayner
>
>
> ---------------------------------
>
> class Car {
>         @Property Long id
>         @Property Long version
>
>          @Property String make
>          @Property String model
>          @Property String color
>         @Property Driver driver
>
>          def belongsTo = Driver
>
>         @Property Wheel wheel1
>         @Property Wheel wheel2
>         @Property Wheel wheel3
>         @Property Wheel wheel4
>
>
> /// hashCode etc deleted
> }
>
>
> class Driver {
>         @Property Long id
>         @Property Long version
>
>          @Property String name
>          @Property Date licenseExpires
>
>         def relatesToMany = [ cars : Car ]
>          @Property Set cars = new HashSet()
>
> }
>
>
> class Wheel {
>         @Property Long id
>         @Property Long version
>
>          @Property String manufacturer
>          @Property String size
>          @Property String color
>
>          def belongsTo = Car
>
>
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Limited CRUD functionality with one-to-many relationships?

Peter Wayner
No. The objects don't disappear because I restart the system. They  
disappear from the Driver's list view after I create the object.  
Here's a more detailed list of what happens:

* I go to create a Driver object.
* After creating it, I go to edit it. For some reason, I can't "add  
car" when I'm creating the Car.
* I push the "add car" button. This takes me to the "New Car" screen.
* I fill this out. The result will appear on the Car list view.
* But if I go back to the Driver object and look at the original  
Driver object, there's no indication that I created a new car.

-Peter



On Jun 16, 2006, at 10:37 AM, Graeme Rocher wrote:

> On 6/16/06, Peter Wayner <[hidden email]> wrote:
>>
>> I've been trying to test Grails with some one-to-many relationships
>> and one-to-one relationships. The basic system works and lets me
>> create, update and delete my objects, but I can't seem to get the
>> system to list the links between the objects. For instance, here are
>> three domain objects. When I run the generate-all script for all
>> three, I end up with a working system. But I can' do the following
>>
>> * Get any of the Wheel objects to appear on the Car edit page.
>> * Get any of the Car objects to be owned by a Driver. They just
>> disappear and don't appear when I view a Driver object later.
>
> When you save a domain class and reload it resets the in-memory
> database, could this be causing the 'disappearing' behaviour that you
> describe?
>
> Graeme
>>
>> Any ideas what I'm failing to do? Or am I at the edge of what Grails
>> 0.2 can do right now?
>>
>> Thanks for all of your help.
>>
>> -Peter Wayner
>>
>>
>> ---------------------------------
>>
>> class Car {
>>         @Property Long id
>>         @Property Long version
>>
>>          @Property String make
>>          @Property String model
>>          @Property String color
>>         @Property Driver driver
>>
>>          def belongsTo = Driver
>>
>>         @Property Wheel wheel1
>>         @Property Wheel wheel2
>>         @Property Wheel wheel3
>>         @Property Wheel wheel4
>>
>>
>> /// hashCode etc deleted
>> }
>>
>>
>> class Driver {
>>         @Property Long id
>>         @Property Long version
>>
>>          @Property String name
>>          @Property Date licenseExpires
>>
>>         def relatesToMany = [ cars : Car ]
>>          @Property Set cars = new HashSet()
>>
>> }
>>
>>
>> class Wheel {
>>         @Property Long id
>>         @Property Long version
>>
>>          @Property String manufacturer
>>          @Property String size
>>          @Property String color
>>
>>          def belongsTo = Car
>>
>>
>> }
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>


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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Limited CRUD functionality with one-to-many relationships?

graemer
It may just be how it is displayed, in the list view it probably won't
appear, if you go back to the 'edit' view you will see car, otherwise
if you are convinced this is an issue, please file a JIRA report

Thanks
Graeme

On 6/16/06, Peter Wayner <[hidden email]> wrote:

> No. The objects don't disappear because I restart the system. They
> disappear from the Driver's list view after I create the object.
> Here's a more detailed list of what happens:
>
> * I go to create a Driver object.
> * After creating it, I go to edit it. For some reason, I can't "add
> car" when I'm creating the Car.
> * I push the "add car" button. This takes me to the "New Car" screen.
> * I fill this out. The result will appear on the Car list view.
> * But if I go back to the Driver object and look at the original
> Driver object, there's no indication that I created a new car.
>
> -Peter
>
>
>
> On Jun 16, 2006, at 10:37 AM, Graeme Rocher wrote:
>
> > On 6/16/06, Peter Wayner <[hidden email]> wrote:
> >>
> >> I've been trying to test Grails with some one-to-many relationships
> >> and one-to-one relationships. The basic system works and lets me
> >> create, update and delete my objects, but I can't seem to get the
> >> system to list the links between the objects. For instance, here are
> >> three domain objects. When I run the generate-all script for all
> >> three, I end up with a working system. But I can' do the following
> >>
> >> * Get any of the Wheel objects to appear on the Car edit page.
> >> * Get any of the Car objects to be owned by a Driver. They just
> >> disappear and don't appear when I view a Driver object later.
> >
> > When you save a domain class and reload it resets the in-memory
> > database, could this be causing the 'disappearing' behaviour that you
> > describe?
> >
> > Graeme
> >>
> >> Any ideas what I'm failing to do? Or am I at the edge of what Grails
> >> 0.2 can do right now?
> >>
> >> Thanks for all of your help.
> >>
> >> -Peter Wayner
> >>
> >>
> >> ---------------------------------
> >>
> >> class Car {
> >>         @Property Long id
> >>         @Property Long version
> >>
> >>          @Property String make
> >>          @Property String model
> >>          @Property String color
> >>         @Property Driver driver
> >>
> >>          def belongsTo = Driver
> >>
> >>         @Property Wheel wheel1
> >>         @Property Wheel wheel2
> >>         @Property Wheel wheel3
> >>         @Property Wheel wheel4
> >>
> >>
> >> /// hashCode etc deleted
> >> }
> >>
> >>
> >> class Driver {
> >>         @Property Long id
> >>         @Property Long version
> >>
> >>          @Property String name
> >>          @Property Date licenseExpires
> >>
> >>         def relatesToMany = [ cars : Car ]
> >>          @Property Set cars = new HashSet()
> >>
> >> }
> >>
> >>
> >> class Wheel {
> >>         @Property Long id
> >>         @Property Long version
> >>
> >>          @Property String manufacturer
> >>          @Property String size
> >>          @Property String color
> >>
> >>          def belongsTo = Car
> >>
> >>
> >> }
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list please visit:
> >>
> >>     http://xircles.codehaus.org/manage_email
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Limited CRUD functionality with one-to-many relationships?

Peter Wayner
Well, I ended up downloading the latest version of 0.2 and now it all  
works as I expect. So all's well that ends well.

-Peter

On Jun 16, 2006, at 11:15 AM, Graeme Rocher wrote:

> It may just be how it is displayed, in the list view it probably won't
> appear, if you go back to the 'edit' view you will see car, otherwise
> if you are convinced this is an issue, please file a JIRA report
>
> Thanks
> Graeme
>
> On 6/16/06, Peter Wayner <[hidden email]> wrote:
>> No. The objects don't disappear because I restart the system. They
>> disappear from the Driver's list view after I create the object.
>> Here's a more detailed list of what happens:
>>
>> * I go to create a Driver object.
>> * After creating it, I go to edit it. For some reason, I can't "add
>> car" when I'm creating the Car.
>> * I push the "add car" button. This takes me to the "New Car" screen.
>> * I fill this out. The result will appear on the Car list view.
>> * But if I go back to the Driver object and look at the original
>> Driver object, there's no indication that I created a new car.
>>
>> -Peter
>>
>>
>>
>> On Jun 16, 2006, at 10:37 AM, Graeme Rocher wrote:
>>
>> > On 6/16/06, Peter Wayner <[hidden email]> wrote:
>> >>
>> >> I've been trying to test Grails with some one-to-many  
>> relationships
>> >> and one-to-one relationships. The basic system works and lets me
>> >> create, update and delete my objects, but I can't seem to get the
>> >> system to list the links between the objects. For instance,  
>> here are
>> >> three domain objects. When I run the generate-all script for all
>> >> three, I end up with a working system. But I can' do the following
>> >>
>> >> * Get any of the Wheel objects to appear on the Car edit page.
>> >> * Get any of the Car objects to be owned by a Driver. They just
>> >> disappear and don't appear when I view a Driver object later.
>> >
>> > When you save a domain class and reload it resets the in-memory
>> > database, could this be causing the 'disappearing' behaviour  
>> that you
>> > describe?
>> >
>> > Graeme
>> >>
>> >> Any ideas what I'm failing to do? Or am I at the edge of what  
>> Grails
>> >> 0.2 can do right now?
>> >>
>> >> Thanks for all of your help.
>> >>
>> >> -Peter Wayner
>> >>
>> >>
>> >> ---------------------------------
>> >>
>> >> class Car {
>> >>         @Property Long id
>> >>         @Property Long version
>> >>
>> >>          @Property String make
>> >>          @Property String model
>> >>          @Property String color
>> >>         @Property Driver driver
>> >>
>> >>          def belongsTo = Driver
>> >>
>> >>         @Property Wheel wheel1
>> >>         @Property Wheel wheel2
>> >>         @Property Wheel wheel3
>> >>         @Property Wheel wheel4
>> >>
>> >>
>> >> /// hashCode etc deleted
>> >> }
>> >>
>> >>
>> >> class Driver {
>> >>         @Property Long id
>> >>         @Property Long version
>> >>
>> >>          @Property String name
>> >>          @Property Date licenseExpires
>> >>
>> >>         def relatesToMany = [ cars : Car ]
>> >>          @Property Set cars = new HashSet()
>> >>
>> >> }
>> >>
>> >>
>> >> class Wheel {
>> >>         @Property Long id
>> >>         @Property Long version
>> >>
>> >>          @Property String manufacturer
>> >>          @Property String size
>> >>          @Property String color
>> >>
>> >>          def belongsTo = Car
>> >>
>> >>
>> >> }
>> >>
>> >>
>> >>
>> >>
>> >>  
>> ---------------------------------------------------------------------
>> >> To unsubscribe from this list please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >
>> >  
>> ---------------------------------------------------------------------
>> > To unsubscribe from this list please visit:
>> >
>> >    http://xircles.codehaus.org/manage_email
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>


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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Limited CRUD functionality with one-to-many relationships?

graemer
Great! Yes there have been a lot of bug fixes and improvements since 0.1

Thanks for trying Grails :-)

Graeme

On 6/16/06, Peter Wayner <[hidden email]> wrote:

> Well, I ended up downloading the latest version of 0.2 and now it all
> works as I expect. So all's well that ends well.
>
> -Peter
>
> On Jun 16, 2006, at 11:15 AM, Graeme Rocher wrote:
>
> > It may just be how it is displayed, in the list view it probably won't
> > appear, if you go back to the 'edit' view you will see car, otherwise
> > if you are convinced this is an issue, please file a JIRA report
> >
> > Thanks
> > Graeme
> >
> > On 6/16/06, Peter Wayner <[hidden email]> wrote:
> >> No. The objects don't disappear because I restart the system. They
> >> disappear from the Driver's list view after I create the object.
> >> Here's a more detailed list of what happens:
> >>
> >> * I go to create a Driver object.
> >> * After creating it, I go to edit it. For some reason, I can't "add
> >> car" when I'm creating the Car.
> >> * I push the "add car" button. This takes me to the "New Car" screen.
> >> * I fill this out. The result will appear on the Car list view.
> >> * But if I go back to the Driver object and look at the original
> >> Driver object, there's no indication that I created a new car.
> >>
> >> -Peter
> >>
> >>
> >>
> >> On Jun 16, 2006, at 10:37 AM, Graeme Rocher wrote:
> >>
> >> > On 6/16/06, Peter Wayner <[hidden email]> wrote:
> >> >>
> >> >> I've been trying to test Grails with some one-to-many
> >> relationships
> >> >> and one-to-one relationships. The basic system works and lets me
> >> >> create, update and delete my objects, but I can't seem to get the
> >> >> system to list the links between the objects. For instance,
> >> here are
> >> >> three domain objects. When I run the generate-all script for all
> >> >> three, I end up with a working system. But I can' do the following
> >> >>
> >> >> * Get any of the Wheel objects to appear on the Car edit page.
> >> >> * Get any of the Car objects to be owned by a Driver. They just
> >> >> disappear and don't appear when I view a Driver object later.
> >> >
> >> > When you save a domain class and reload it resets the in-memory
> >> > database, could this be causing the 'disappearing' behaviour
> >> that you
> >> > describe?
> >> >
> >> > Graeme
> >> >>
> >> >> Any ideas what I'm failing to do? Or am I at the edge of what
> >> Grails
> >> >> 0.2 can do right now?
> >> >>
> >> >> Thanks for all of your help.
> >> >>
> >> >> -Peter Wayner
> >> >>
> >> >>
> >> >> ---------------------------------
> >> >>
> >> >> class Car {
> >> >>         @Property Long id
> >> >>         @Property Long version
> >> >>
> >> >>          @Property String make
> >> >>          @Property String model
> >> >>          @Property String color
> >> >>         @Property Driver driver
> >> >>
> >> >>          def belongsTo = Driver
> >> >>
> >> >>         @Property Wheel wheel1
> >> >>         @Property Wheel wheel2
> >> >>         @Property Wheel wheel3
> >> >>         @Property Wheel wheel4
> >> >>
> >> >>
> >> >> /// hashCode etc deleted
> >> >> }
> >> >>
> >> >>
> >> >> class Driver {
> >> >>         @Property Long id
> >> >>         @Property Long version
> >> >>
> >> >>          @Property String name
> >> >>          @Property Date licenseExpires
> >> >>
> >> >>         def relatesToMany = [ cars : Car ]
> >> >>          @Property Set cars = new HashSet()
> >> >>
> >> >> }
> >> >>
> >> >>
> >> >> class Wheel {
> >> >>         @Property Long id
> >> >>         @Property Long version
> >> >>
> >> >>          @Property String manufacturer
> >> >>          @Property String size
> >> >>          @Property String color
> >> >>
> >> >>          def belongsTo = Car
> >> >>
> >> >>
> >> >> }
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> ---------------------------------------------------------------------
> >> >> To unsubscribe from this list please visit:
> >> >>
> >> >>     http://xircles.codehaus.org/manage_email
> >> >>
> >> >>
> >> >
> >> >
> >> ---------------------------------------------------------------------
> >> > To unsubscribe from this list please visit:
> >> >
> >> >    http://xircles.codehaus.org/manage_email
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list please visit:
> >>
> >>     http://xircles.codehaus.org/manage_email
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Limited CRUD functionality with one-to-many relationships?

Peter Wayner

On Jun 16, 2006, at 2:40 PM, Graeme Rocher wrote:

> Great! Yes there have been a lot of bug fixes and improvements  
> since 0.1
>
> Thanks for trying Grails :-)

Well, I was using a 0.2 build from earlier this week. Go figure.

-Peter

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Are jobs working?

pledbrook
In reply to this post by pledbrook
Graeme,

I noticed you fixed the job name property in the job template -
thanks! However, shouldn't "execute" be defined as a method rather
than a closure? When I was trying this out, the job was never started
until I changed the execute property to a method declaration.

Cheers,

Peter

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Are jobs working?

graemer
Ah thanks for pointing that out will change it, we originally wanted
it as a closure, but spring doesn't have a ClosureInvokingFactoryBean
so we had to change it to a method

Graeme

On 6/17/06, Peter Ledbrook <[hidden email]> wrote:

> Graeme,
>
> I noticed you fixed the job name property in the job template -
> thanks! However, shouldn't "execute" be defined as a method rather
> than a closure? When I was trying this out, the job was never started
> until I changed the execute property to a method declaration.
>
> Cheers,
>
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email