Changes in pyslk v1.9.2#
updated: 2023-09-18 (removed note)
Summary for users who used releases of pyslk prior to 1.9.0#
A major structural change was implemented in pyslk version 1.9.0 compared to older versions. The implementation of this change did start in version 1.7.0 but most parts where implemented in 1.9.0. All functions which are meant to be used by end-users, can be used without specifying the module’s name: pyslk.example_function instead of pyslk.module_name.example_function.
The wrapper functions pyslk.parsers.*, which return handy datatypes and structures, were copied to pyslk.core.* and many new useful functions were added (API doc of functions with nice output<https://hsm-tools.gitlab-pages.dkrz.de/pyslk/api.html#wrapper-functions-which-return-nice-output>). These functions do not exactly match existing slk and slk_helpers commands but rather are oriented towards users needs and existing functions of other Python packages – e.g. pyslk.mkdir and pyslk.makedirs work very similar to os.mkdir and os.makedirs.
The simple wrapper functions pyslk.pyslk.slk_* / pyslk.slk_* are now available as pyslk.raw.*_raw / pyslk.*_raw (API doc of basic wrapper functions<https://hsm-tools.gitlab-pages.dkrz.de/pyslk/api.html#basic-wrappers-without-proper-parsing-of-the-output>). The original pyslk.pyslk.slk_* and pyslk.parsers.* functions are still available but are deprecated. We plan to remove all deprecated functions in pyslk 2.x.y.
Summary for users who never used pyslk before#
The Python library pyslk provides two types of wrapper functions:
basic wrapper functions which return the raw text output of the corresponding
slkorslk_helperscommand; each command has a corresponding wrapper; see API doc of basic wrapper functions<https://hsm-tools.gitlab-pages.dkrz.de/pyslk/api.html#basic-wrappers-without-proper-parsing-of-the-output>advanced wrapper functions which return nice data types like
boolean,integer,Pandas.DataFrameor whatever datatype/structure is reasonable in the context of the function’s usage; see API doc of functions with nice output<https://hsm-tools.gitlab-pages.dkrz.de/pyslk/api.html#wrapper-functions-which-return-nice-output>
These functions are located in different modules of the library. This does not matter for the user/you. All functions, which are meant to be used by end-users, can be used via pyslk.FUNCTION_NAME without providing the module’s name. The basic wrapper functions have the names [SLK_COMMAND_NAME]_raw and the advanced wrappers are mostly named independent of the slk / slk_helpers commands. Functions with the names like slk_* are old basic wrapper functions, which are deprecated. Please do not use them.
Detailed Changes#
pyslkadapted toslk_helpersversion 1.9.7 and earlier releasesfunctions from the module
pyslk.pyslk(== names have the prefixslk_) are marked as deprecated and have been replaced by*_rawfunctions (modulepyslk.raw)functions from the module
pyslk.parsersare marked as deprecated and have been partly copied to the modulepyslk.core; functions frompyslk.corethan frompyslk.parsersalthough they have the same name- new:
*_rawfunctions in modulepyslk.raw(started with 1.7.0; mostly in 1.9.x): the
pyslk.rawmodule contains a wrapper function for eachslkandslk_helperscommand (same name + suffix_raw)each
*_rawfunction returns the raw text output of the respectiveslk/slk_helperscommandthe
*_rawfunctions raise errors if theslk/slk_helperscommand returns non-zero exit codes
- new:
- some functions in
utilsmade public convert_expiration_date(new inpyslk1.9.0)login_validrun_slk
- some functions in
- new: _nice_ wrapper functions in
pyslk.code: nearly all public functions which do not end on
_raw, not start withslk_and/or not throw deprecated warnings are frompyslk.coresome function names similar to those of the
oslibrary:mkdir,makedirs,chown(cannot changegid),chmod(does not follow definition ofmodeas inos.chmod)intuitive function names (a selection):
is_cached,is_on_tape,is_file,is_namespace,get_tag,get_metadata- handy return types:
pyslk.list(...)returnsPandas.DataFramepyslk.is_*,pyslk.has_*returnbooleansexcept for functions ending on_detailspyslk.*_detailsreturndictwith detailled file listsdictare returned where reasonable (e.g.arch_size,job_queue,hsm2json,get_metadata)
- new: _nice_ wrapper functions in
Availability#
pyslk interacts with the StrongLink system via the command line interfaces slk and slk_helpers. Therefore, the slk/3.3.91 and slk_helpers/1.9.7 have to be loaded or your PATH needs to point to the bin folders of slk and slk_helpers. You cannot use pyslk outside of DKRZ to interact with StrongLink because access to StrongLink is only granted from within the DKRZ. However, you are welcome to install pyslk on your local machine in order to write code using pyslk outside DKRZ.
pre-installed: Levante module
python3/unstable, default conda environment;own installation: download from https://hsm-tools.gitlab-pages.dkrz.de/pyslk/availability.html (PIP and conda packages)
API documentation#
please see: https://hsm-tools.gitlab-pages.dkrz.de/pyslk/api.html