This repository was archived by the owner on Nov 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
This repository was archived by the owner on Nov 14, 2022. It is now read-only.
Transfer file validate() from reduce.py to service #6
Copy link
Copy link
Open
Description
Issue raised by: developer
What?
Currently in all reduce.py we have:
def validate(file, dir):
"""
Function that validates if a file and/or directory exist. If not a
RunTimeError is raised which is picked up by Autoreduction.
:param file: full path of data file. Provide empty string to ignore
:type file: str
:param dir: full path of a directory. Provide empty string to ignore
:type dir: str
"""
print("Running validation")
if file:
if not os.path.isfile(file):
raise RuntimeError("Unable to find file: {}".format(file))
if dir:
if not os.path.isdir(dir):
raise RuntimeError("Unable to find directory: {}".format(dir))
print("Validation successful")
and this method is called in main to check input_file and output_dir exist and return error messages back to users which can be presented in Webapp.
With this issue:
- move this validate step to sit within Autoreduction service, work as before and with furhter potential benefit not starting reduction in the first place if this validation fails (Dimitar)
- update http://reduce.isis.cclrc.ac.uk/help/ accordingly
- delete (I suggest rather than update) example_reduce.py and example_reduce_vars.py in https://github.com/ISISScientificComputing/autoreduce/tree/master/WebApp. I suggest delete these because no longer any point of these I believe with this info in http://reduce.isis.cclrc.ac.uk/help/
Follow up after validation of this work:
- contact the instrument scientists that are known maintainers of reduce.py and inform of this simplication change to their scripts, and this include Pascal, Rob and Duc
- remove validate() code from all reduce.py files including for production instruments
How to test the issue is resolved
unit testing please
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels