Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Transfer file validate() from reduce.py to service #6

Open
Pasarus opened this issue Aug 18, 2022 · 0 comments
Open

Transfer file validate() from reduce.py to service #6

Pasarus opened this issue Aug 18, 2022 · 0 comments

Comments

@Pasarus
Copy link
Member

Pasarus commented Aug 18, 2022

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:

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant