Use of TemporalExpression with JobSandbox

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of TemporalExpression with JobSandbox

cqnunez
We are currently trying to make use of TemporalExpression to schedule a service to run on a date/time specified by the user.

For example, we wanted to run the "createMaintsFromTimeInterval" service every 1st or 15th of the month.

<JobSandbox jobId="TEST_FAM_AUTO_CREATE" jobName="Auto-create Fixed Asset Maintenances" runTime="2000-01-01 00:00:00.000" serviceName="createMaintsFromTimeInterval" poolId="pool" runAsUser="system" tempExprId="1ST_AND_15TH_MONTH" maxRecurrenceCount="-1"/>

We've noticed that it will only schedule the service on the 1st day of the month. Once it has finished the scheduled job on the 1st day of the month, instead of creating a new job scheduled on the 15th of the same month, it will schedule the service on the 1st day of the following month.

I've tried it on the ofbiz demo server and encountered the same error.

Any help would be most appreciated.

Thanks.



Reply | Threaded
Open this post in threaded view
|

Re: Use of TemporalExpression with JobSandbox

Adrian Crum
I have duplicated the bug on my local copy and I am looking into it.

-Adrian

cqnunez wrote:

> We are currently trying to make use of TemporalExpression to schedule a
> service to run on a date/time specified by the user.
>
> For example, we wanted to run the "createMaintsFromTimeInterval" service
> every 1st or 15th of the month.
>
> <JobSandbox jobId="TEST_FAM_AUTO_CREATE" jobName="Auto-create Fixed Asset
> Maintenances" runTime="2000-01-01 00:00:00.000"
> serviceName="createMaintsFromTimeInterval" poolId="pool" runAsUser="system"
> tempExprId="1ST_AND_15TH_MONTH" maxRecurrenceCount="-1"/>
>
> We've noticed that it will only schedule the service on the 1st day of the
> month. Once it has finished the scheduled job on the 1st day of the month,
> instead of creating a new job scheduled on the 15th of the same month, it
> will schedule the service on the 1st day of the following month.
>
> I've tried it on the ofbiz demo server and encountered the same error.
>
> Any help would be most appreciated.
>
> Thanks.
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Use of TemporalExpression with JobSandbox

Adrian Crum
Fixed in trunk, rev 896649.

-Adrian

Adrian Crum wrote:

> I have duplicated the bug on my local copy and I am looking into it.
>
> -Adrian
>
> cqnunez wrote:
>> We are currently trying to make use of TemporalExpression to schedule a
>> service to run on a date/time specified by the user.
>>
>> For example, we wanted to run the "createMaintsFromTimeInterval" service
>> every 1st or 15th of the month.
>>
>> <JobSandbox jobId="TEST_FAM_AUTO_CREATE" jobName="Auto-create Fixed Asset
>> Maintenances" runTime="2000-01-01 00:00:00.000"
>> serviceName="createMaintsFromTimeInterval" poolId="pool"
>> runAsUser="system"
>> tempExprId="1ST_AND_15TH_MONTH" maxRecurrenceCount="-1"/>
>>
>> We've noticed that it will only schedule the service on the 1st day of
>> the
>> month. Once it has finished the scheduled job on the 1st day of the
>> month,
>> instead of creating a new job scheduled on the 15th of the same month, it
>> will schedule the service on the 1st day of the following month.
>>
>> I've tried it on the ofbiz demo server and encountered the same error.
>> Any help would be most appreciated.
>>
>> Thanks.
>>
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Use of TemporalExpression with JobSandbox

cqnunez
We've updated our local copy to rev 896649 and encountered a similar problem when we used TIME_OF_DAY_RANGE instead of DAY_OF_MONTH_RANGE.

Using the ff data, we now want the service to run every noon and 3pm.

<TemporalExpression tempExprId="12PM" tempExprTypeId="TIME_OF_DAY_RANGE" string1="12:00" string2="12:00"/>
<TemporalExpression tempExprId="3PM" tempExprTypeId="TIME_OF_DAY_RANGE" string1="15:00" string2="15:00"/>

<TemporalExpression tempExprId="12PM_AND_3PM_DAY" tempExprTypeId="UNION"/>
<TemporalExpressionAssoc fromTempExprId="12PM_AND_3PM_DAY" toTempExprId="12PM"/>
<TemporalExpressionAssoc fromTempExprId="12PM_AND_3PM_DAY" toTempExprId="3PM"/>

<JobSandbox jobId="TEST_FAM_AUTO_CREATE" jobName="Auto-create Fixed Asset Maintenances" runTime="2000-01-01 00:00:00.000" serviceName="createMaintsFromTimeInterval" poolId="pool" runAsUser="system" tempExprId="12PM_AND_3PM_DAY" maxRecurrenceCount="-1"/> 

We've noticed that the service will always be scheduled 12pm of the ff day instead of scheduling it first at 3pm of the same day.

Thanks again for the help.
Reply | Threaded
Open this post in threaded view
|

Re: Use of TemporalExpression with JobSandbox

Adrian Crum
Thank you for the information. I will review all of the temporal
expressions and try to get these issues resolved. It might take a few
days, so please be patient.

-Adrian

cqnunez wrote:

> We've updated our local copy to rev 896649 and encountered a similar problem
> when we used TIME_OF_DAY_RANGE instead of DAY_OF_MONTH_RANGE.
>
> Using the ff data, we now want the service to run every noon and 3pm.
>
> <TemporalExpression tempExprId="12PM" tempExprTypeId="TIME_OF_DAY_RANGE"
> string1="12:00" string2="12:00"/>
> <TemporalExpression tempExprId="3PM" tempExprTypeId="TIME_OF_DAY_RANGE"
> string1="15:00" string2="15:00"/>
>
> <TemporalExpression tempExprId="12PM_AND_3PM_DAY" tempExprTypeId="UNION"/>
> <TemporalExpressionAssoc fromTempExprId="12PM_AND_3PM_DAY"
> toTempExprId="12PM"/>
> <TemporalExpressionAssoc fromTempExprId="12PM_AND_3PM_DAY"
> toTempExprId="3PM"/>
>
> <JobSandbox jobId="TEST_FAM_AUTO_CREATE" jobName="Auto-create Fixed Asset
> Maintenances" runTime="2000-01-01 00:00:00.000"
> serviceName="createMaintsFromTimeInterval" poolId="pool" runAsUser="system"
> tempExprId="12PM_AND_3PM_DAY" maxRecurrenceCount="-1"/>
>
> We've noticed that the service will always be scheduled 12pm of the ff day
> instead of scheduling it first at 3pm of the same day.
>
> Thanks again for the help.
Reply | Threaded
Open this post in threaded view
|

Re: Use of TemporalExpression with JobSandbox

Adrian Crum-2
This has been fixed in the trunk. Some things have changed however.

I deprecated the TIME_OF_DAY_RANGE expression type - it was a bad design. It has been replaced with HOUR_RANGE and MINUTE_RANGE.

If you want the job to run at the top of the hour, you will need to create an intersection of HOUR_RANGE and MINUTE_RANGE to specify the hour AND minute, then put the intersection in your 12PM_AND_3PM_DAY union. The new approach adds some complexity, but it is more reliable.

-Adrian


--- On Thu, 1/7/10, Adrian Crum <[hidden email]> wrote:

> From: Adrian Crum <[hidden email]>
> Subject: Re: Use of TemporalExpression with JobSandbox
> To: [hidden email]
> Date: Thursday, January 7, 2010, 7:51 AM
> Thank you for the information. I will
> review all of the temporal expressions and try to get these
> issues resolved. It might take a few days, so please be
> patient.
>
> -Adrian
>
> cqnunez wrote:
> > We've updated our local copy to rev 896649 and
> encountered a similar problem
> > when we used TIME_OF_DAY_RANGE instead of
> DAY_OF_MONTH_RANGE.
> >
> > Using the ff data, we now want the service to run
> every noon and 3pm.
> >
> > <TemporalExpression tempExprId="12PM"
> tempExprTypeId="TIME_OF_DAY_RANGE"
> > string1="12:00" string2="12:00"/>
> > <TemporalExpression tempExprId="3PM"
> tempExprTypeId="TIME_OF_DAY_RANGE"
> > string1="15:00" string2="15:00"/>
> >
> > <TemporalExpression tempExprId="12PM_AND_3PM_DAY"
> tempExprTypeId="UNION"/>
> > <TemporalExpressionAssoc
> fromTempExprId="12PM_AND_3PM_DAY"
> > toTempExprId="12PM"/>
> > <TemporalExpressionAssoc
> fromTempExprId="12PM_AND_3PM_DAY"
> > toTempExprId="3PM"/>
> >
> > <JobSandbox jobId="TEST_FAM_AUTO_CREATE"
> jobName="Auto-create Fixed Asset
> > Maintenances" runTime="2000-01-01 00:00:00.000"
> > serviceName="createMaintsFromTimeInterval"
> poolId="pool" runAsUser="system"
> > tempExprId="12PM_AND_3PM_DAY"
> maxRecurrenceCount="-1"/>
> > We've noticed that the service will always be
> scheduled 12pm of the ff day
> > instead of scheduling it first at 3pm of the same
> day.
> >
> > Thanks again for the help.
>


     
Reply | Threaded
Open this post in threaded view
|

Re: Use of TemporalExpression with JobSandbox

Adrian Crum-2
By the way, if you change the union's ID to express what it's used for - CREATE_MAINTS_JOB for example - then you can change the job's schedule by changing the union's members. So, if you wanted to have it run at noon and 6PM, just delete the 3PM member and add a 6PM member. There is no need to change the job itself.

-Adrian

--- On Sat, 1/16/10, Adrian Crum <[hidden email]> wrote:

> From: Adrian Crum <[hidden email]>
> Subject: Re: Use of TemporalExpression with JobSandbox
> To: [hidden email]
> Date: Saturday, January 16, 2010, 3:38 PM
> This has been fixed in the trunk.
> Some things have changed however.
>
> I deprecated the TIME_OF_DAY_RANGE expression type - it was
> a bad design. It has been replaced with HOUR_RANGE and
> MINUTE_RANGE.
>
> If you want the job to run at the top of the hour, you will
> need to create an intersection of HOUR_RANGE and
> MINUTE_RANGE to specify the hour AND minute, then put the
> intersection in your 12PM_AND_3PM_DAY union. The new
> approach adds some complexity, but it is more reliable.
>
> -Adrian
>
>
> --- On Thu, 1/7/10, Adrian Crum <[hidden email]>
> wrote:
>
> > From: Adrian Crum <[hidden email]>
> > Subject: Re: Use of TemporalExpression with
> JobSandbox
> > To: [hidden email]
> > Date: Thursday, January 7, 2010, 7:51 AM
> > Thank you for the information. I will
> > review all of the temporal expressions and try to get
> these
> > issues resolved. It might take a few days, so please
> be
> > patient.
> >
> > -Adrian
> >
> > cqnunez wrote:
> > > We've updated our local copy to rev 896649 and
> > encountered a similar problem
> > > when we used TIME_OF_DAY_RANGE instead of
> > DAY_OF_MONTH_RANGE.
> > >
> > > Using the ff data, we now want the service to
> run
> > every noon and 3pm.
> > >
> > > <TemporalExpression tempExprId="12PM"
> > tempExprTypeId="TIME_OF_DAY_RANGE"
> > > string1="12:00" string2="12:00"/>
> > > <TemporalExpression tempExprId="3PM"
> > tempExprTypeId="TIME_OF_DAY_RANGE"
> > > string1="15:00" string2="15:00"/>
> > >
> > > <TemporalExpression
> tempExprId="12PM_AND_3PM_DAY"
> > tempExprTypeId="UNION"/>
> > > <TemporalExpressionAssoc
> > fromTempExprId="12PM_AND_3PM_DAY"
> > > toTempExprId="12PM"/>
> > > <TemporalExpressionAssoc
> > fromTempExprId="12PM_AND_3PM_DAY"
> > > toTempExprId="3PM"/>
> > >
> > > <JobSandbox jobId="TEST_FAM_AUTO_CREATE"
> > jobName="Auto-create Fixed Asset
> > > Maintenances" runTime="2000-01-01 00:00:00.000"
> > > serviceName="createMaintsFromTimeInterval"
> > poolId="pool" runAsUser="system"
> > > tempExprId="12PM_AND_3PM_DAY"
> > maxRecurrenceCount="-1"/>
> > > We've noticed that the service will always be
> > scheduled 12pm of the ff day
> > > instead of scheduling it first at 3pm of the
> same
> > day.
> > >
> > > Thanks again for the help.
> >
>
>
>      
>



Reply | Threaded
Open this post in threaded view
|

Re: Use of TemporalExpression with JobSandbox

cqnunez
Thanks for the update on TemporalExpression classes..

We've tried to setup the ff scenario where we want to run the service every 3am and 4am

<TemporalExpression tempExprId="TE_01" tempExprTypeId="HOUR_RANGE" integer1="3" integer2="3"/>
<TemporalExpression tempExprId="TE_02" tempExprTypeId="HOUR_RANGE" integer1="4" integer2="4"/>
<TemporalExpression tempExprId="TE_03" tempExprTypeId="MINUTE_RANGE" integer1="0" integer2="0"/>

<TemporalExpression tempExprId="TE_04" tempExprTypeId="UNION"/>
<TemporalExpressionAssoc fromTempExprId="TE_04" toTempExprId="TE_01"/>
<TemporalExpressionAssoc fromTempExprId="TE_04" toTempExprId="TE_02"/>

<TemporalExpression tempExprId="TE_05" tempExprTypeId="INTERSECTION"/>
<TemporalExpressionAssoc fromTempExprId="TE_05" toTempExprId="TE_03"/>
<TemporalExpressionAssoc fromTempExprId="TE_05" toTempExprId="TE_04"/>

<JobSandbox jobId="TEST_FAM_AUTO_CREATE" jobName="Auto-create Fixed Asset Maintenances" runTime="2000-01-01 00:00:00.000" serviceName="createMaintsFromTimeInterval" poolId="pool" runAsUser="system" tempExprId="TE_05" maxRecurrenceCount="-1"/>

But we've found that the service is always scheduled at 4am the ff day. Have we made a mistake on how we set up the TemporalExpression entities? Any help would be most appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Use of TemporalExpression with JobSandbox

Adrian Crum-2
You have the basic idea, you just need to assemble the expressions into the correct *collections*.

The Wiki contains an explanation and a tutorial:

http://cwiki.apache.org/confluence/display/OFBENDUSER/Temporal+Expressions

Temporal expressions are easy to understand if you break things down into smaller pieces:

> We've tried to setup the ff scenario where we want to run
> the service every
> 3am and 4am

A 3:00 AM expression will require an Intersection (MINUTE_00 *and* HOUR_03).

A 4:00 AM expression will require an Intersection (MINUTE_00 *and* HOUR_04).

Finally, the two intersections need to be combined in a Union (logical *or* - 3 AM *or* 4 AM).

Keep in mind that you can create temporal expressions in the Web Tools application. That might help you visualize the expressions.

-Adrian


--- On Wed, 1/27/10, cqnunez <[hidden email]> wrote:

> From: cqnunez <[hidden email]>
> Subject: Re: Use of TemporalExpression with JobSandbox
> To: [hidden email]
> Date: Wednesday, January 27, 2010, 12:34 AM
>
> Thanks for the update on TemporalExpression classes..
>
> We've tried to setup the ff scenario where we want to run
> the service every
> 3am and 4am
>
> <TemporalExpression tempExprId="TE_01"
> tempExprTypeId="HOUR_RANGE"
> integer1="3" integer2="3"/>
> <TemporalExpression tempExprId="TE_02"
> tempExprTypeId="HOUR_RANGE"
> integer1="4" integer2="4"/>
> <TemporalExpression tempExprId="TE_03"
> tempExprTypeId="MINUTE_RANGE"
> integer1="0" integer2="0"/>
>
> <TemporalExpression tempExprId="TE_04"
> tempExprTypeId="UNION"/>
> <TemporalExpressionAssoc fromTempExprId="TE_04"
> toTempExprId="TE_01"/>
> <TemporalExpressionAssoc fromTempExprId="TE_04"
> toTempExprId="TE_02"/>
>
> <TemporalExpression tempExprId="TE_05"
> tempExprTypeId="INTERSECTION"/>
> <TemporalExpressionAssoc fromTempExprId="TE_05"
> toTempExprId="TE_03"/>
> <TemporalExpressionAssoc fromTempExprId="TE_05"
> toTempExprId="TE_04"/>
>
> <JobSandbox jobId="TEST_FAM_AUTO_CREATE"
> jobName="Auto-create Fixed Asset
> Maintenances" runTime="2000-01-01 00:00:00.000"
> serviceName="createMaintsFromTimeInterval" poolId="pool"
> runAsUser="system"
> tempExprId="TE_05" maxRecurrenceCount="-1"/>
>
> But we've found that the service is always scheduled at 4am
> the ff day. Have
> we made a mistake on how we set up the TemporalExpression
> entities? Any help
> would be most appreciated.
> --
> View this message in context: http://n4.nabble.com/Use-of-TemporalExpression-with-JobSandbox-tp999679p1311344.html
> Sent from the OFBiz - User mailing list archive at
> Nabble.com.
>