Skip to content
This repository was archived by the owner on Nov 14, 2022. It is now read-only.
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

@Pasarus

Description

@Pasarus

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions