Moving rules from 2.5 to 3.0

69 views
Skip to first unread message

Jens

unread,
Jan 13, 2012, 3:01:31 PM1/13/12
to iROD-Chat
Hi there,

how do I have to move (already generated) 2.5 rules to the 3.0 Rule
Engine? I tried to achieve this by renaming the file, but I didn't get
it working. The rule interpreter says :"running in backward
compatibility mode" but even with simple rules irule complains:
SYS_PACK_INSTRUCT_FORMAT_ERR
Level 0: DEBUG:

I.E. having a very simple rule like:
testRule||delayExec(<EF>10s</EF>,msiWriteRodsLog("Hello
World",*junk),nop)|nop
*test=1
*ruleExecOut

Thanks,
Kind regards,
Jens

Jean-Yves Nief

unread,
Jan 13, 2012, 3:56:24 PM1/13/12
to irod...@googlegroups.com, Jens
hello,

Jens a �crit :


> Hi there,
>
> how do I have to move (already generated) 2.5 rules to the 3.0 Rule
> Engine? I tried to achieve this by renaming the file,

did you had the following line at the beginning of your rule file:
@backwardCompatible "true"
cheers,
JY

Jens

unread,
Jan 14, 2012, 7:52:22 AM1/14/12
to iROD-Chat
Hello Jean-Yves,

ok, I added the line to my Rule, but the irule still complains:
ERROR: Incomplete rule input for ruleTest1.r

For reference I tried to get the (former) demo Rule
ruleTest1.ir of the standard iRODS Installation to run in
backward compatibility mode.

@backwardCompatible "true"
myTestRule||assign(*A, $userNameClient like r*s )|nop
*D=200 + 200
*A%*B%*C%*D%*E

Am I wrong, somehow?

Kind regards,

Jens

Reagan Moore

unread,
Jan 16, 2012, 1:57:25 PM1/16/12
to irod...@googlegroups.com
The 3.0 rule engine will run this test case if you change "r*s" to "r*"

In the file ruleTest1.ir

myTestRule||assign(*A, $userNameClient like r* )|nop
*D=200 + 200
*A%*B%*C%*D%*E

You can then run this with
irule -F ruleTest1.ir

Reagan Moore

>--
>"iRODS: the Integrated Rule-Oriented Data-management System; A
>community driven, open source, data grid software solution"
>https://www.irods.org
>
> iROD-Chat: http://groups.google.com/group/iROD-Chat

Jens

unread,
Jan 17, 2012, 4:38:53 AM1/17/12
to iROD-Chat
Hello Reagan,

thanks, this help running the case of demo Rule1.

I tried to migrate several rules we have already in production just
for a test.
Most of our existing rules aren't interpreted by the 3.0 engine at the
moment.

Please take a look at the first rule in my statement above. What needs
to be changed
to run this rule in the 3.0 engine context?

Kind regards,

Jens

Hao Xu

unread,
Jan 17, 2012, 2:35:54 PM1/17/12
to irod...@googlegroups.com
Hello,

The rule


testRule||delayExec(<EF>10s</EF>,msiWriteRodsLog("Hello World",*junk),nop)|nop
*test=1
*ruleExecOut

should be


testRule||delayExec(<EF>10s</EF>,msiWriteRodsLog("Hello World",*junk),nop)|nop
*test=1
ruleExecOut

The change is deleting the "*" on line 3. Even in 2.5, the "*" is not supposed to be there. The 3.0 engine is more strict on syntax than 2.5, so "*ruleExecOut" is strictly different from "ruleExecOut".

The rule


myTestRule||assign(*A, $userNameClient like r*s  )|nop
*D=200 + 200
*A%*B%*C%*D%*E

should be changed to

myTestRule||assign(*A, $userNameClient like r\*s  )|nop
*D=200 + 200
*A%*B%*C%*D%*E

The change is adding a "\" in front of the "*" on line 1. This, and other limitations of backward compatibility mode, has been documented here:

https://www.irods.org/index.php/Changes_and_Improvements_to_the_Rule_Language_and_the_Rule_Engine#Backward_Incompatibilities

If you save the rule in a .ir file, the rule is automatically run under the backward compatible mode. The @backwardCompatible directive can only be used in a .r file to set the backward compatible mode for the rule engine, but not in a .ir file.

The backward compatible mode is not intended as a permanent solution. The best way to migrate to the 3.0, if you have time, is to convert rules into the new syntax. A step by step guide can be found here:

https://www.irods.org/index.php/Changes_and_Improvements_to_the_Rule_Language_and_the_Rule_Engine#Converting_from_the_.22.23.23.22_Syntax_to_the_New_Rule_Engine_Syntax

  Hao

Jens

unread,
Jan 18, 2012, 5:22:10 AM1/18/12
to iROD-Chat
Hello Hao,

thanks for this information.

Kind regards,

Jens
> https://www.irods.org/index.php/Changes_and_Improvements_to_the_Rule_...
>
> If you save the rule in a .ir file, the rule is automatically run under the
> backward compatible mode. The @backwardCompatible directive can only be
> used in a .r file to set the backward compatible mode for the rule engine,
> but not in a .ir file.
>
> The backward compatible mode is not intended as a permanent solution. The
> best way to migrate to the 3.0, if you have time, is to convert rules into
> the new syntax. A step by step guide can be found here:
>
> https://www.irods.org/index.php/Changes_and_Improvements_to_the_Rule_...
Reply all
Reply to author
Forward
0 new messages