Run one task of myApp on one core of a node
$ flux run -n 1 myApp
This is the simplest way to run a job on a cluster. In this example, the lone flux run command defaults to asking for one task on one core on one node of the default queue charging the default account.
Run one task of myApp on all cores of a node
$ flux run -N 1 --exclusive -n 1 myApp
If you want myApp to have access to all of the cores on the node (e.g. myApp is multi-threaded), the --exclusive flag provides an easy shorthand for that.
Run hostname in an interactive allocation on one node
$ flux alloc -N 1 flux-job: f29ZRWATSQwZ waiting for resources
blocks here until job runs
flux-job: f29ZRWATSQwZ started $ flux run hostname fluke58
Run it again
$ flux run hostname fluke58
Now exit the job and allocation
$ exit exit [detached: session exiting]
Like flux run in the first example, flux alloc defaults to asking for one node of the default queue charging the default account. Once the job runs and the prompt appears, any further commands are run within the job's allocated resources until exit is invoked.
Create a batch job script and submit it
$ cat > myBatch.cmd #!/bin/bash #flux: -N 4 #flux: -q pdebug #flux: -B myBank #flux: -t 30m flux run -N 4 -n 32 myApp ^D
This script asks for 4 nodes from the pdebug queue for no more than 30 minutes charging the myBank account. The flux run command launches 32 tasks of myApp across the four nodes.
Now submit the job:
$ flux batch myBatch.cmd fjNZTFDe8hm
See the job pending in the queue:
$ flux jobs -A JOBID QUEUE USER NAME ST NTASKS NNODES TIME INFO fjNZTFDe8hm batch day36 myBatch.c+ R 4 4 3.385s fluke[53-56]
After the job runs, the output will be found in a file named after the job id: flux-fjNZTFDe8hm.out
See only your jobs in the queue
$ flux jobs
See all the jobs in the queue
$ flux jobs -A
List queued jobs displaying the fields that are important to you
$ man flux-jobs
and scroll to the OUTPUT FORMAT section. You can save a custom output format that contains the fields you like to see in $HOME/.config/flux/flux-jobs.toml.
For example:
$ cat $HOME/.config/flux/flux-jobs.toml # $HOME/.config/flux/flux-jobs.toml [formats.lots] description = "Show lots of info" format = "{id.f58:>12} ?:{queue:>8.8} {username:<8.8} ?:{bank:<8.8} {name:<10.10+} {status_abbrev:>2.2} {nnodes:>6h} {ntasks:>6} {contextual_info}"
Now run flux jobs:
$ flux jobs -A -o lots JOBID QUEUE USER BANK NAME ST NNODES NTASKS INFO fjNecV7rNnK batch day36 guests myBatch.c+ R 4 4 fluke[49-52]
Display the pending jobs
$ flux jobs -A -f pending
Display details about a specific job
$ flux jobs <jobID>
Display the job script for one of your jobs
$ flux job info <jobid> jobspec | jq .attributes.system.files.script.data
Show all the jobs you have run recently
$ flux jobs -f inactive JOBID QUEUE USER NAME ST NTASKS NNODES TIME INFO fjNecV7rNnK batch day36 myBatch.c+ F 4 4 13.21s fluke[49-52] fjNZTFDe8hm batch day36 myBatch.c+ F 4 4 13.17s fluke[53-56] fjNYtsJ1rsy batch day36 hostname CD 1 1 9.514s fluke57 ...
List the banks you are permitted to use ( flux batch/alloc/run/submit -B option)
$ flux account view-user <username>
This command also shows the historical usage your jobs have accrued to each bank. The fair-share factor is also displayed for you for each of your banks. This factor will be used in calculating the priority for your current pending jobs and any job you submit. For details, see Multi-factor Priority and Fair-Tree.
Display the factors contributing to the priority for a user's jobs
$ flux account jobs <username>
Cancel a job, whether it is pending in the queue or running
$ flux cancel <job_ID>
Send a signal to a running job
For example, send SIGUSR1:
$ flux job kill -s USR1 <job_ID>
Display the queues available
$ flux queue list
Display information about the states of nodes
$ flux resource list