Comments (4)
A similar issue was raised and changes were merged for 4.3.0/4.2.12 here: irods/irods#4745
In those changes (found here: 64df8a9), iquest
returns a code of 1 when CAT_NO_ROWS_FOUND
is returned from the server. Would this be sufficient to meet your use case?
from irods_client_icommands.
That solves half of what I was proposing. An empty result set isn't always an error though. Pretend that I want to write a script that searches a set of collections for for a data object with a .jpg
file extension. When it finds one of these files, it emails the file to Terrell. The script iterates over the set of collections and uses iquest to find data object with that file extension. It shouldn't be an error if one of the collections doesn't have a file with that extension, so the script would need to trap iquest errors. When it detects an iquest error, it would need to determine if the error is because of an empty result set or some other reason. If iquest could run in the second mode I proposed, the script would need to do this. An error would be a problem with iquest or the query, not an empty result set.
from irods_client_icommands.
My first reaction is that this should be on the calling script to handle/trap the errors/empty results.
We can make sure that all 'actual' errors do not produce a return code of 1 (similar/same as grep
).
from irods_client_icommands.
@tedgin wrote:
Maybe iquest could have two modes.
The first mode would treat an empty result set as an error. iquest would write CAT_NO_ROWS_FOUND: ... to stderr and exit with a failure status.
The second mode would not treat an empty result set as an error. It would write nothing to stderr or stdout and would exit with a success.
For me that makes a lot of sense - I have a wrapper on iquest
which interprets the 4.2.7 way, but in other/transient code which doesn't reach that... it has caused bugs when I forgot.
This wrapper will need changing for 4.2.12/4.3.x when we get there, but that's OK.
The first mode could be the default. The mode could be selected by passing a command line option --empty=(failure|success) something like that. If no option is provided the default could be the first mode.
If backwards compatibility was a strong preference, the "legacy" behaviour could be a (third option) default. This isn't particularly useful for me, and I can see the value in using what is already done -
@alanking wrote:
A similar issue was raised and changes were merged for 4.3.0/4.2.12 [...]
@trel wrote:
My first reaction is that this should be on the calling script to handle/trap the errors/empty results.
We can make sure that all 'actual' errors do not produce a return code of 1 (similar/same as grep).
Having a disctinctive exit code is essential for reliability.
After that I see it as a choice in supporting different types of caller,
- the lazy ones who expect everything will be fine (no errors or unexpectedly empty results) and hopefully the process will stop upon error; they don't worry about complexities such as exit codes
- the thorough ones who check all the exit codes and raise relevant exceptions in response.
Not written to patronise anyone - I can be in either group depending on the context, and by using shell captures or pipelines one can too easily end up in the first group without realising.
There is a lot to be said for making it work like grep
, although GNU Grep has many flags to add flexibility.
from irods_client_icommands.
Related Issues (20)
- showing metadata ID HOT 5
- better verbosity for writes
- icd not handling special characters correctly HOT 4
- ihelp does not mention iunreg HOT 1
- Install icommands on CentOS 8 (arch: x84_64) and Red Hat 8 (arch: ppc64le) HOT 1
- irepl does not processing remaining existing data objects if it processes a nonexistent one HOT 4
- usr directory error HOT 12
- build error in rocky with main branch HOT 1
- some rule file tests failing
- iquest parses queries with tabs in the where clause incorrectly. HOT 4
- iquest reads query from stdin HOT 5
- iput numThreads HOT 1
- iCommands 4.3.0 fails to run with PAM HOT 2
- icp cannot copy files larger than 2GB HOT 7
- irods-icommands installs without irods-runtime on CentOS 8 HOT 2
- Bash autocomplete for iCommands not working right HOT 3
- Inconsistent iinit irods_authentication_scheme setting for pam in 4.3.0 HOT 1
- Extend ils -l to show system metadata about collections
- Install iCommands on Rocky Linux 9 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from irods_client_icommands.