Skip to content
Snippets Groups Projects
Commit b2c87a81 authored by Staiger, Christine's avatar Staiger, Christine
Browse files

Adding error message if rule execution fails on iRODS level.

parent b599a584
No related branches found
No related tags found
No related merge requests found
from irods.session import iRODSSession from irods.session import iRODSSession
from irods.access import iRODSAccess from irods.access import iRODSAccess
from irods.ticket import Ticket from irods.ticket import Ticket
from irods.exception import CATALOG_ALREADY_HAS_ITEM_BY_THAT_NAME, CAT_NO_ACCESS_PERMISSION from irods.exception import CATALOG_ALREADY_HAS_ITEM_BY_THAT_NAME, \
from irods.exception import CAT_SUCCESS_BUT_WITH_NO_INFO, CAT_INVALID_ARGUMENT, CAT_INVALID_USER, CAT_INVALID_AUTHENTICATION CAT_NO_ACCESS_PERMISSION, CAT_SUCCESS_BUT_WITH_NO_INFO, \
CAT_INVALID_ARGUMENT, CAT_INVALID_USER, CAT_INVALID_AUTHENTICATION,\
NO_RULE_OR_MSI_FUNCTION_FOUND_ERR
from irods.exception import CollectionDoesNotExist from irods.exception import CollectionDoesNotExist
from irods.connection import PlainTextPAMPasswordError from irods.connection import PlainTextPAMPasswordError
from irods.models import Collection, DataObject, Resource, ResourceMeta, CollectionMeta, DataObjectMeta from irods.models import Collection, DataObject, Resource, ResourceMeta, CollectionMeta, DataObjectMeta
...@@ -719,8 +722,13 @@ class irodsConnector(): ...@@ -719,8 +722,13 @@ class irodsConnector():
'*value': '"attr_value"' '*value': '"attr_value"'
} }
""" """
rule = Rule(self.session, ruleFile, params=params, output=output) try:
out = rule.execute() rule = Rule(self.session, ruleFile, params=params, output=output)
out = rule.execute()
except Exception as e:
logging.info('RULE EXECUTION ERROR', exc_info=True)
return [], [repr(e)]
stdout = [] stdout = []
stderr = [] stderr = []
if len(out.MsParam_PI) > 0: if len(out.MsParam_PI) > 0:
...@@ -730,7 +738,7 @@ class irodsConnector(): ...@@ -730,7 +738,7 @@ class irodsConnector():
stderr = [o.decode() stderr = [o.decode()
for o in (out.MsParam_PI[0].inOutStruct.stderrBuf.buf.strip(b'\x00')).split(b'\n')] for o in (out.MsParam_PI[0].inOutStruct.stderrBuf.buf.strip(b'\x00')).split(b'\n')]
except AttributeError: except AttributeError:
#logging.info('RULE EXECUTION ERROR: '+str(stdout+stderr), exc_info=True) logging.info('RULE EXECUTION ERROR: '+str(stdout+stderr), exc_info=True)
return stdout, stderr return stdout, stderr
return stdout, stderr return stdout, stderr
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment