snek5000.util#

Miscellaneous utilities#

archive

Post simulation archive-creation utilities

console

Console script functions

files

restart

Utilities to restart a simulation

smake

Snakemake helper utilities

Functions

docstring_params(Class[, sections, indent_len])

Creates a parameter instance and generate formatted docs for it.

init_params(Class[, isolated_unit])

Instantiate an isolated params for a specific class.

isoformat(dt)

Returns timestamp in modified isoformat from a datetime object (- instead of :).

last_modified(path)

Find the last modified file in a directory tree.

modification_date(path)

Modification date of a file or directory.

now()

The current timestamp.

scantree(path)

Recursively yield DirEntry objects for given directory.

tar_info(filename)

Contents of a tar file.

timestamp(path)

Modification date of a file or directory as a timestamp.

zip_info(filename)

Contents of a zip file.

snek5000.util.get_nek_source_root()[source]#

Path of Nek5000 source code.

snek5000.util.get_status(path_dir, session_id=None, verbose=False)[source]#

Get status of a simulation run by verifying its contents. It checks if:

  • snakemake was ever executed

  • directory is locked by snakemake (either due to a running simulation or a terminated one)

  • necessary files for starting a simulation exist

  • restart files exist

Parameters
  • path (str or path-like) – Path to an existing simulation directory

  • session_id (int) – Integer suffix of the session directory

  • verbose (bool) – Print out the path and its contents

Returns

_ – Enumeration indicating status code and message

Return type

SimStatus