Jobflow and its companion Jobflow-Remote are useful tools for orchestrating large numbers of jobs, especially those with complex workflows. As of right now, it is the recommended workflow tool in the group for most tasks due to its close integration with Slurm.
Using Jobflow
Before configuring Jobflow-Remote, it is strongly recommended that you check out the Jobflow tutorials that you can run on your local machine. Then you can start using Jobflow-Remote to run workflows on the Slurm cluster.
The simplest example of using Jobflow locally is shown below:
from jobflow import job, Flow, run_locally
@job
defadd(a, b):
return a + b
job1 = add(1,2)
job2 = add(job1.output,2)
flow = Flow([job1, job2])
response = run_locally(flow)
Configuring and Testing Jobflow Remote
Setup instructions are provided for the following machines:
Run the following example that runs a simple two-step flow with a quick Effective Medium Theory (EMT) set of calculations on two structures. If functional, you should see 4 new job IDs via jf job list and 3 new flow IDs via jf flow list. Eventually, they should reach a state of COMPLETED once they get through the Slurm queue.
If you are changing the quacc environment variables in a Python script, you must do this before any quacc-related imports otherwise they will not be registered.
import os
os.environ["QUACC_WORKFLOW_ENGINE"]="jobflow"
from ase.build import bulk
from jobflow import Flow
from jobflow_remote import submit_flow
from quacc.recipes.emt.core import relax_job, static_job
atoms_list =[bulk("Al"), bulk("Cu")]
for atoms in atoms_list:
job1 = relax_job(atoms, relax_cell=True)
job2 = static_job(job1.output["atoms"])
flow = Flow([job1, job2])
submit_flow(flow, worker="basic_python")
VASP Example
The following example will use the basic_vasp runner and run a representative VASP workflow consisting of a relaxation and subsequent static calculation on bulk Si.
If you are changing the quacc environment variables in a Python script, you must do this before any quacc-related imports otherwise they will not be registered.
import os
os.environ["QUACC_WORKFLOW_ENGINE"]="jobflow"
from ase.build import bulk
from jobflow import Flow
from jobflow_remote import submit_flow
from quacc.recipes.vasp.core import relax_job, static_job