Skip to content

Commit 0f5df8f

Browse files
committed
[#180] Document print behavior in python rules
1 parent 364220b commit 0f5df8f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,21 @@ The following arguments are strictly optional and may be used either in `Query`'
420420
* *limit*: `None` by default (ie "no limit"), this option can be an integer >= 1 if specified, and limits the returned row enumeration to the requested number of results. Often used with *offset*, as defined above.
421421
* *case-sensitive* is normally `True`. If it is set to `False`, the condition string will be uppercased, and the query will be executed without regard to case. This allows for more permissive matching on the names of resources, collections, data objects, etc.
422422
* *options* is a bitmask of extra options, and defaults to a value of 0. `genquery.Option.NO_DISTINCT` is one such extra option, as is RETURN_TOTAL_ROW_COUNT (although in the latter case, using the `Query` object's `row_count` method should be preferred.)
423+
424+
## Questions and Answers
425+
426+
### What happened to my `print` output?
427+
428+
In iRODS server versions 4.3.0 and later, all standard streams are redirected to `/dev/null` in the server. This means that any data sent to `stdout` such as via a `print` statement in a rule run inside the server will be discarded.
429+
430+
Here is some example code which would print a message to the `rodsLog` in servers from the 4.2.x series and earlier when run with the Python Rule Engine Plugin:
431+
```python
432+
print('hello, server log!')
433+
```
434+
435+
In order to achieve a similar effect on server versions 4.3.0 and later, you can replace such a call like this:
436+
```python
437+
callback.writeLine('serverLog', 'hello, server log!')
438+
```
439+
440+
Note that the `writeLine` microservice can also target `stdout` in addition to `serverLog`. `callback.writeLine('stdout', ...)` will have the same effect as running `print`. The output will be discarded.

0 commit comments

Comments
 (0)