smartsexplore.util module

Contains reusable utility code for the SMARTSexplore application.

smartsexplore.util.run_process(cmd, timeout=None, stdout=None, stderr=None, reraise_exceptions=False, **kwargs)

Helper function that wraps subprocess.run with some additional exception handling that is useful to us.

Note

Will log an error message via the logging module if anything goes wrong. Passes shell=False to subprocess.run.

Parameters
  • cmd – Just like for subprocess.run.

  • timeout – Just like for subprocess.run.

  • stdout – Just like for subprocess.run.

  • stderr – Just like for subprocess.run.

  • reraise_exceptions – False by default. If True, caught exceptions will be re-raised. The False case is likely more useful for console-based interactions; the True case for interactions of a running web application to properly handle errors.

  • kwargs – Will be passed directly to subprocess.run.