Commit 7fb70e6b authored by Franziska Koehn's avatar Franziska Koehn
Browse files

retry-decorator implemented (wrapper for search and get_additional_data functions)

parent 07f67d22
......@@ -165,6 +165,24 @@ def disconnect_xnat_server():
def retry_qry(fun):
def retry(*args, **kwargs):
last_exception = None
retries = 1
while retries >= 0:
return fun(*args, **kwargs)
except Exception as e:
print(("wrapped", e))
get_xnat_server_connection.cache = None
if type(last_exception) is type(e):
raise e
last_exception = e
retries -= 1
return retry
def query_for_additional_data(rest, result, host, creds):
import re
......@@ -185,7 +203,7 @@ def query_for_additional_data(rest, result, host, creds):
new_result[fieldname] = ''.join(value).replace("\n","")
return new_result
def search_for(host, root_element, constraints, search_fields, user, passw):
Does a search for given values. raises xsa -Exceptions
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment