This article is intended to serve as an overview to batch process execution for ParaView (or running a ParaView script).
What is a batch process?
A batch process is a series of one or more “jobs” that are executed in succession on a computer without any interaction from the end-user.
The user, or an external system, is responsible for starting the batch process, and it then runs to completion on its own.
Why is batch execution useful?
Scientists and engineers spend a tremendous amount of time organizing data. Much of this work can be automated.
For a given test or experiment, it’s likely that the bulk of the time spent inside the ParaView GUI would be better spent on reviewing and analyzing results that have been automatically post-processed, especially where post-processing tasks are identical between experiments.
Then, users have additional free time to perform non-standard interrogations of experimental data.
Simply put, scientific workflow automation affords additional time to focus on critical thinking as opposed to rote task execution.
Running ParaView as a Batch Process
ParaView has 2 executables from which batch processes can be executed:
pvpython. They are largely the same, and for simple script
execution they are virtually interchangeable. The differences are highlighted
pvpython is the Python interface to ParaView. It can be run interactively,
inside the interpreter, or can be used to execute Python scripts.
To run commands inside the interpreter, simply run:
Alternatively, python scripts can be executed with:
pvbatch is an MPI-enabled (if ParaView was compiled with MPI support) batch
application for ParaView, and the primary execution code for batch processes.
It is only available in batch mode (non-interactive). Outside of these
characteristics, it is the same as
To run a script with
pvbatch, execute it in the following format:
Alternatively, to leverage the MPI capabilities of pvbatch for large data sets, you can use:
mpiexec -n N pvbatch /path/to/script.py
N is your MPI process count.
Often times, you’ll want to create a simple executable to define additional characteristics of the execution of your script.
Below is an example where we’ll execute a Python script with
all command-line arguments to the script, and logging the output to a file.
#!/bin/bash pvbatch=/opt/paraview-5.4.1/bin/pvbatch script_path=/full/path/to/script.py log_path=/path/to/logging/output.log $pvbatch $script_path "$@" >> $log_path 2>&1
Then, ensure the script has execution permissions:
chmod +x /path/to/bash/script
To run the script, simple use: