flux-framework / cheat-sheet

command tips and tricks
https://flux-framework.org/cheat-sheet/
MIT License
2 stars 1 forks source link

Developer Cheats #9

Open vsoch opened 19 hours ago

vsoch commented 19 hours ago

To add eventually

# What is my rank?
flux overlay lookup $(hostname)
0

# Count the nodes (including control plane)
count=$(flux hostlist --count local)
worker_count=$(flux hostlist -x $(hostname) --count local)
echo "Found ${count} total nodes, and ${worker_count} not including the control plane"

nodes=$(flux job info $FLUX_JOB_ID R | jq -r .execution.nodelist[0])
echo "Found nodes ${nodes} in Job ${FLUX_JOB_ID}"

flux kvs put ${kvs_path}.usernetes=yes
flux kvs put ${kvs_path}.usernetes_root=${usernetes_root}
usernetes_root=$(flux kvs get ${kvs_path}.usernetes_root)
grondo commented 19 hours ago

There are simpler ways to get much of this information:

To get the current broker's rank

$ flux getattr rank

Get the total number of brokers:

$ flux getattr size

Get the hostlist for a job:

$ flux hostlist JOBID

(Note that flux job info $FLUX_JOB_ID R | jq -r .execution.nodelist[0] could actually return incorrect information since there may be more than one entry in the execution.nodelist array)