LLNL / scr

SCR caches checkpoint data in storage on the compute nodes of a Linux cluster to provide a fast, scalable checkpoint / restart capability for MPI codes.
http://computing.llnl.gov/projects/scalable-checkpoint-restart-for-mpi
Other
99 stars 36 forks source link

python: refresh scripts to be more pythonic #559

Closed adammoody closed 1 year ago

adammoody commented 1 year ago

In our original implementation of the python SCR job scripts, our goal was to directly convert from bash/perl to python. This allowed for the quickest workable conversion, and it also enables one to swap in the new python scripts in a piecemeal fashion if needed. Now that this is complete, the next step is to refresh the scripts to be more pythonic.

For example, since the earlier scripts combined bash and perl, the commands often communicated via output strings and return codes. There are many spots where we compress a list of hosts into a string, only to expand it back from a string to a list of nodes. With everything being python, we can simplify and just keep this as a python list, until it is really needed as a string. Similarly, we could raise python exceptions when things go wrong, instead of having the caller check whether the return code is 0 or 1.

In other cases, we might convert for loops into list comprehensions. It may be useful to convert comments to docstrings, etc.

adammoody commented 1 year ago

Resolved by https://github.com/LLNL/scr/pull/558