Jobflow

Jobflow

 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.
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.

Configuring Jobflow Remote

The following is a representative setup for Jobflow Remote, specifically for use on our tiger-arrk login node.
    Run pip install jobflow-remote[gui] in your Conda environment on tiger-arrk
    Run jf project generate cms in the terminal
    Replace the file ~/.jfremote/cms.yaml with the following. Edit any necessary fields (i.e. those with < >). If you have not completed the instructions in  💽Databases , do that first. This will create a project named cms with a worker named basic, but you can always add other workers to this file too for different kinds of calculations.
name: cms
workers:
basic:
type: local
scheduler_type: slurm
work_dir: /scratch/gpfs/ROSENGROUP/<NetID>/jobflow
pre_run: source ~/.bashrc && module load anaconda3/2024.10 && conda activate cms
timeout_execute: 60
resources:
account: rosengroup
time: 04:00:00
queue:
store:
type: MongoStore
host: localhost
database: <MongoDB Database Name>
username: <MongoDB UserName>
password: <MongoDB PW>
collection_name: jf_jobs
flows_collection: jf_flows
auxiliary_collection: jf_aux
exec_config: {}
jobstore:
docs_store:
type: MongoStore
database: <MongoDB Database Name>
host: localhost
username: <MongoDB UserName>
password: <MongoDB PW>
collection_name: jf_outputs
    Run jf project check --errors to confirm that everything is set up correctly.
    Run jf admin upgrade
    Launch the runner via jf runner start
    Confirm that everything truly works by running the following minimal example. If functional, you should see two job IDs via jf job list and one flow ID via jf flow list. Eventually, they should reach a state of COMPLETED once they get through the Slurm queue.
from jobflow_remote.utils.examples import add
from jobflow_remote import submit_flow
from jobflow import Flow

job1 = add(1, 2)
job2 = add(job1.output, 2)
flow = Flow([job1, job2])

print(submit_flow(flow, worker="basic"))
    If you'd like, check out the GUI via jf gui, which can be viewed in Firefox via the Desktop on Tiger3 Vis Nodes feature on  mytiger.princeton.edu 
    When you're done, make sure to terminate the daemon via jf runner stop

Jobflow Remote with Quacc

    Run quacc set WORKFLOW_ENGINE jobflow
    If you need to revert this, run quacc set WORKFLOW_ENGINE None
    Confirm that everything truly works by running the following minimal example. If functional, you should see 6 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.
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"), bulk("Ag")]
for atoms in atoms_list:
job1 = relax_job(atoms, relax_cell=True)
job2 = static_job(job1.output["atoms"])
flow = Flow([job1, job2])
print(submit_flow(flow, worker="basic"))