librelist archives

« back to archive

simpleAsyncTask and cronjob app

simpleAsyncTask and cronjob app

From:
William Martin
Date:
2011-05-17 @ 07:25
Hi,

I start to work on two new application for photon.

1st, it's a simple way to run async task.
If you need to run somethings after a request (mail, parse a file,
...), you will be able to register a methods with a context to this
application.
Your job will be add in a queue and the app will run thoses actions one by one.
This manager will allow you to add small task in a queue without the
creation of a photon task for each action.

2nd, Is a cronjob based on the first application

Any remark will be nice.
William

-- 
---------------------------------------------------------
William MARTIN
wysman @NoSpAm@ gmail @DoT@ com

Re: [photon.users] simpleAsyncTask and cronjob app

From:
Loic d'Anterroches
Date:
2011-05-17 @ 09:02
Hello,

> I start to work on two new application for photon.
>
> 1st, it's a simple way to run async task.
> If you need to run somethings after a request (mail, parse a file,
> ...), you will be able to register a methods with a context to this
> application.
> Your job will be add in a queue and the app will run thoses actions one by one.
> This manager will allow you to add small task in a queue without the
> creation of a photon task for each action.
>
> 2nd, Is a cronjob based on the first application

Ok, basically, instead of creating one async task per kind of job, you 
want to create one big which will run many different jobs, right?

If so, reuse as much as possible the default async task and pay 
attention to:

- transfer the uid of the request to the task for tracking.
- transfer the connection id coming from mongrel2 if you want your 
system to possibly send back some information to the client directly.
- pay attention to json serialization, it does not handle binary data 
(base64 encoding first maybe).

loïc

Re: [photon.users] simpleAsyncTask and cronjob app

From:
William Martin
Date:
2011-05-17 @ 09:22
> Ok, basically, instead of creating one async task per kind of job, you
> want to create one big which will run many different jobs, right?

Yes, i thinks it's can be more easy to register static methods in a
poll for small job
In other case, like the chat, a dedicated async task is more interresting.

> If so, reuse as much as possible the default async task and pay
> attention to:
>
> - transfer the uid of the request to the task for tracking.
Ok

> - transfer the connection id coming from mongrel2 if you want your
> system to possibly send back some information to the client directly.

If the view have already send an answer, maybe the mongrel2 connection
will be closed before the task end ?
Do you have explication about that ?

> - pay attention to json serialization, it does not handle binary data
> (base64 encoding first maybe).
The simpleAsyncTask will keep all task to do in RAM.
Where do you view json serialization ? Maybe in the cronjob part ?

>
> loïc
>



-- 
---------------------------------------------------------
William MARTIN
wysman @NoSpAm@ gmail @DoT@ com

Re: [photon.users] simpleAsyncTask and cronjob app

From:
Loic d'Anterroches
Date:
2011-05-17 @ 09:37

On 05/17/2011 11:22 AM, William MARTIN wrote:
>> Ok, basically, instead of creating one async task per kind of job, you
>> want to create one big which will run many different jobs, right?
>
> Yes, i thinks it's can be more easy to register static methods in a
> poll for small job
> In other case, like the chat, a dedicated async task is more interresting.
>
>> If so, reuse as much as possible the default async task and pay
>> attention to:
>>
>> - transfer the uid of the request to the task for tracking.
> Ok
>
>> - transfer the connection id coming from mongrel2 if you want your
>> system to possibly send back some information to the client directly.
>
> If the view have already send an answer, maybe the mongrel2 connection
> will be closed before the task end ?
> Do you have explication about that ?

It may not if you use the simple task stuff in combination with let say 
another chat task. But the user could pass it in the payload.
>
>> - pay attention to json serialization, it does not handle binary data
>> (base64 encoding first maybe).
> The simpleAsyncTask will keep all task to do in RAM.
> Where do you view json serialization ? Maybe in the cronjob part ?

 From the main application to the task. The payload is sent over zeromq 
serialized most of the time in json, but if you send binary data it will 
fail.

loïc

Re: [photon.users] simpleAsyncTask and cronjob app

From:
William Martin
Date:
2011-05-17 @ 09:41
Thanks,

I will start to work on that tomorow in my 2 x 5h of train ...

On Tue, May 17, 2011 at 11:37 AM, Loic d'Anterroches <loic@ceondo.com> wrote:
>
>
> On 05/17/2011 11:22 AM, William MARTIN wrote:
>>> Ok, basically, instead of creating one async task per kind of job, you
>>> want to create one big which will run many different jobs, right?
>>
>> Yes, i thinks it's can be more easy to register static methods in a
>> poll for small job
>> In other case, like the chat, a dedicated async task is more interresting.
>>
>>> If so, reuse as much as possible the default async task and pay
>>> attention to:
>>>
>>> - transfer the uid of the request to the task for tracking.
>> Ok
>>
>>> - transfer the connection id coming from mongrel2 if you want your
>>> system to possibly send back some information to the client directly.
>>
>> If the view have already send an answer, maybe the mongrel2 connection
>> will be closed before the task end ?
>> Do you have explication about that ?
>
> It may not if you use the simple task stuff in combination with let say
> another chat task. But the user could pass it in the payload.
>>
>>> - pay attention to json serialization, it does not handle binary data
>>> (base64 encoding first maybe).
>> The simpleAsyncTask will keep all task to do in RAM.
>> Where do you view json serialization ? Maybe in the cronjob part ?
>
>  From the main application to the task. The payload is sent over zeromq
> serialized most of the time in json, but if you send binary data it will
> fail.
>
> loïc
>



-- 
---------------------------------------------------------
William MARTIN
wysman @NoSpAm@ gmail @DoT@ com

Re: [photon.users] simpleAsyncTask and cronjob app

From:
Nicolas
Date:
2011-05-17 @ 08:34
Hi William,

The number 1 sounds really interesting, and useful. Can you tell us a bit
more about the context that is passed to the registered method ?

The number 2 can be nice as well, but we already have the cron for that :)

Thanks in advance.
Nicolas



On Tue, May 17, 2011 at 9:25 AM, William MARTIN <wysman@gmail.com> wrote:

> Hi,
>
> I start to work on two new application for photon.
>
> 1st, it's a simple way to run async task.
> If you need to run somethings after a request (mail, parse a file,
> ...), you will be able to register a methods with a context to this
> application.
> Your job will be add in a queue and the app will run thoses actions one by
> one.
> This manager will allow you to add small task in a queue without the
> creation of a photon task for each action.
>
> 2nd, Is a cronjob based on the first application
>
> Any remark will be nice.
> William
>
> --
> ---------------------------------------------------------
> William MARTIN
> wysman @NoSpAm@ gmail @DoT@ com
>

Re: [photon.users] simpleAsyncTask and cronjob app

From:
William Martin
Date:
2011-05-17 @ 08:52
Hi

The context will be a user custom array passed in the same time of the
callback to the app.
For example, if you pass a methods to send a mail, your context maybe
an array with from, to, subject, body.

For the cron, i want to do it with photon and an mongo collections
So i can move my application and/or DB server, and all cron task of my
application will be migrate in the same time.
An application of that can be scheduled bill, send mail for an alarm.

William


On Tue, May 17, 2011 at 10:34 AM, Nicolas <nsebban@gmail.com> wrote:
> Hi William,
>
> The number 1 sounds really interesting, and useful. Can you tell us a bit
> more about the context that is passed to the registered method ?
>
> The number 2 can be nice as well, but we already have the cron for that :)
>
> Thanks in advance.
> Nicolas
>
>
>
> On Tue, May 17, 2011 at 9:25 AM, William MARTIN <wysman@gmail.com> wrote:
>>
>> Hi,
>>
>> I start to work on two new application for photon.
>>
>> 1st, it's a simple way to run async task.
>> If you need to run somethings after a request (mail, parse a file,
>> ...), you will be able to register a methods with a context to this
>> application.
>> Your job will be add in a queue and the app will run thoses actions one by
>> one.
>> This manager will allow you to add small task in a queue without the
>> creation of a photon task for each action.
>>
>> 2nd, Is a cronjob based on the first application
>>
>> Any remark will be nice.
>> William
>>
>> --
>> ---------------------------------------------------------
>> William MARTIN
>> wysman @NoSpAm@ gmail @DoT@ com
>
>



-- 
---------------------------------------------------------
William MARTIN
wysman @NoSpAm@ gmail @DoT@ com