How to execute a rule from the native rule language

21 views
Skip to first unread message

S. Stoica

unread,
Jul 23, 2025, 8:00:43 AMJul 23
to iRODS-Chat

Hello everyone, 

Is there a way to execute a rule from within a microservice in a synchronous way? Something in line with a msiExecCmd  maybe? 
Ideally I would like to be able to specify which active plugin instance should pick up the rule execution and also be able to pass on arguments. Basically, a replacement for this in the native rule language. 

irule -r irods_rule_engine_plugin-logical_quotas-instance-s "my_rule(*arg)" "*arg=0" "ruleExecOut"


delay(<>){} does not fit because the execution is not synchronous. 

Any ideas?

The only way I can think of now is to include the rule in a bash script and place it in  /var/lib/irods/msiExecCmd_bin/. However this seems a bit cumbersome and maybe irods has already something built in that i might have missed? 

Thanks in advance,
Simona

Terrell Russell

unread,
Jul 23, 2025, 8:57:50 AMJul 23
to irod...@googlegroups.com
Hi Simona,

I'm not exactly sure what you're looking to do...

If you have the ability to call msiExecCmd(), or delay(), then you should also be able to call any named rule that exists in your loaded rulebases directly.

Have you tried to just call my_rule(*arg) directly?

# core.re
simona_rule1(*a, *b) { simona_rule2(*a, *b); }
simona_rule2(*arg1, *arg2) { writeLine('stdout', "arg1=[*arg1] arg2=[*arg2]"); }

then calling the first rule manually...

$ irule -r irods_rule_engine_plugin-irods_rule_language-instance 'simona_rule1(*a, *b)' '*a="apples"%*b="bananas"' ruleExecOut
arg1=["apples"] arg2=["bananas"]

Terrell





--
--
The Integrated Rule-Oriented Data System (iRODS) - https://irods.org
 
iROD-Chat: http://groups.google.com/group/iROD-Chat
---
You received this message because you are subscribed to the Google Groups "iRODS-Chat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to irod-chat+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/irod-chat/8b48a2fd-8f1d-43ab-8c3d-df2b6652a271n%40googlegroups.com.

Stoica, S.

unread,
Jul 23, 2025, 9:28:42 AMJul 23
to irod...@googlegroups.com
Let me clarify a bit what I am trying to accomplish. 

The point is I am trying to find a work round to call the rule from the logical quota operations via the rule plugin. However the triggers are placed in the rule language ( eg on collection created, activate quota). 

Since i have mitigated the usage of the microservices by using the suggestion in here (https://github.com/irods/irods_rule_engine_plugin_logical_quotas/issues/132) I have no way of invoking the microservice directly as its execution is disabled. 

How can i then invoke the execution of e.g this:

irule -r irods_rule_engine_plugin-logical_quotas-instance '{"operation": "logical_quotas_get_collection_status", "collection": "/tempZone/home/rods"}' null ruleExecOut

from the core rule language?
Any suggestion is welcome. 

Simona 



--
Dr. Simona Stoica
Software Developer CIT

Answer your research questions with data science?

Visit our consultation hours or get up to 16 hours of free support for RUG and UMCG.

Terrell Russell

unread,
Jul 23, 2025, 12:35:04 PMJul 23
to irod...@googlegroups.com
Ah!  I see...

So you need the INST_NAME of the rule engine plugin...

And that is available to the remote() call (as well as the delay() call).


However, with this... you still cannot send the JSON payload to the rule from the iRODS rule language itself...

So...

Here is an example of your proposed workaround (using msiExecCmd)...

simona_rule3(*a) { simona_rule4(*a); }
simona_rule4(*col) {
  msiExecCmd("simona.sh", *col, "null", "null", "null", *result);
  msiGetStdoutInExecCmdOut(*result, *out);
  writeLine('stdout', *out);
}

$ irule -r irods_rule_engine_plugin-irods_rule_language-instance 'simona_rule3(*col)' '*col=/tempZone/home/rods' ruleExecOut
{"irods::logical_quotas::maximum_number_of_data_objects":"","irods::logical_quotas::maximum_size_in_bytes":"","irods::logical_quotas::total_number_of_data_objects":"160","irods::logical_quotas::total_size_in_bytes":"264759060"}


Terrell



Reply all
Reply to author
Forward
0 new messages