# How to run Flux in command line

Once the settings of the memory and cores are set in the right environment variable, Flux must be invoked to run a python script. First, localize Flux executable and the python script to run, as:

PATH_TO_EXECUTABLE=/opt/altair/Flux2018.1/altair/flux/Flux/Bin/prg/lin64/flux
YOUR_PYTHON_SCRIPT=~/project1/pythonScript.py

Use absolute path is strongly advised. Also note that the python script can be passed through the qsub (or other scheduler submit function) invocation, as shown for MEM in Memory management section.

The last information required is the application of the problem to solve, i.e. Flux2D, Flux3D, etc. This can either be provided by you or the next commands allows to parse the python script to find out the application:

#Get the application off the python extracting from its header
FLUX_APP=$(head - n 1$YOUR_PYTHON_SCRIPT|cut -d ! -f 2 | awk'{$1=$1;print}'|cut -d ' ' -f 1)

Finally, Flux can be run using the next command line:

# Run Flux
$PATH_TO_FLUX_EXECUTABLE -application$FLUX_APP -runPyInSilentModeAndExit
\$YOUR_PYTHON_SCRIPT -batch

This command line will launch Flux according to the application (2D, 3D, ...) and run the python script in batch mode (i.e. non-interactive). For more details about Flux command line, see this How to launch Flux via command line.

Examples of python script and complete shell script are available at the end of the document.