CABLE-LSM / benchcab

Tool for evaluation of CABLE land surface model
https://benchcab.readthedocs.io/en/latest/
Apache License 2.0
2 stars 4 forks source link

Test for validation for `project` value #246

Closed abhaasgoyal closed 9 months ago

abhaasgoyal commented 9 months ago

Right now, a user can input any value in $PROJECT / project keyword in config.yaml. It isn't checked whether the user belongs to a certain group until the job has been submitted to PBS.

Reproduce

Run benchcab with the following parameter

project: optional

...

Next steps

Add a validation check by checking the groups of a user, and whether project lies within the corresponding set

abhaasgoyal commented 9 months ago

We could use a subprocess for lquota/ os.listdir - but that'd be very specific to Gadi in terms of unit tests,.

Since running an invalid project name on PBS could provide an error, do we still need this at an earlier steps (potentially to make benchcab more user-friendly? Also, are there other ways to check which groups is a user in

SeanBryan51 commented 9 months ago

Benchcab should complain if the project is not in the groups of the user, but it isn't that user friendly:

https://github.com/CABLE-LSM/benchcab/blob/b7227bbeb7c0ba1cba6ae0425a55a256a4fe26d8/benchcab/benchcab.py#L67-L75

abhaasgoyal commented 9 months ago

I see, for now it is resolved in validate_environment, when doing integration tests. A more robust way would be in Unit Tests when we could separate the abstraction of environment in benchcab