irule in core.py pass two parameters how to?

27 views
Skip to first unread message

jose Garcia

unread,
Mar 8, 2023, 11:09:14 AM3/8/23
to iRODS-Chat
Hi everyone,

    I have the next piece of code inside of the core.py :


......

def writeParametersOnTheTerminal(rule_args, callback,rei):
    callback.writeLine('stdout','  ' + global_vars['*var_1'][1:-1])
    callback.writeLine('stdout','  ' + global_vars['*var_2'][1:-1])

......

In my terminal I type:

$ irule -r irods_rule_engine_plugin-python-instance writeParametersOnTheTerminal  '*var_1="I am getting monkey"' '*var_2="I will not survive to this"' ruleExecOut

I get this error:

remote addresses: 10.90.2.56 ERROR: rcExecMyRule error.  status = -1828000 RULE_ENGINE_ERROR

1. How I pass correctly these two parameters in my terminal? or three? or five?


Thanks in advance

Jose


Terrell Russell

unread,
Mar 8, 2023, 2:55:43 PM3/8/23
to irod...@googlegroups.com
Hi Jose,

You can use the separator % to specify more than one variable...

$ cat /etc/irods/core.py
def writeParametersOnTheTerminal(rule_args, callback, rei):
    callback.writeLine('stdout', str(global_vars))
    callback.writeLine('stdout', global_vars['*var_1'][1:-1])
    callback.writeLine('stdout', global_vars['*var_2'][1:-1])
    callback.writeLine('stdout', global_vars['*var_3'][1:-1])

$ irule -r irods_rule_engine_plugin-python-instance writeParametersOnTheTerminal '*var_1="e"%*var_2="f"%*var_3="g"' ruleExecOut
{'*var_1': '"e"', '*var_2': '"f"', '*var_3': '"g"'}
e
f
g


We will update the help text to specify that this is possible for the inputParam of irule (the first form)
Usage: irule [--test] [-v] [-r instanceName] rule inputParam outParamDesc

It is already documented for the inputFile case of irule (the second form).
Usage: irule [--test] [-v] [-l] [-r instanceName] -F inputFile [prompt | arg_1 arg_2 ...]

I have created an issue to track this update:

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 on the web visit https://groups.google.com/d/msgid/irod-chat/d17abc76-7367-4b80-88fd-d4b411db5517n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages