11.. _flux-mini-submit :
2+ .. _flux-mini-run :
23
34==========================
45How to Submit Jobs in Flux
@@ -14,7 +15,7 @@ From within a Flux instance, you can submit your job on the command line with
1415optional arguments, resource options, per task options, and per resource
1516options:
1617
17- .. code-block :: sh
18+ .. code-block :: console
1819
1920 $ flux mini submit --nodes=2 --ntasks=4 --cores-per-task=2 ./my_compute_script.py 120
2021 ƒM5k8m7m
@@ -28,41 +29,70 @@ for each task. In the second submission, we are asking for our job to start 1
2829task on just one node with 2 cores allocated for the task.
2930
3031There are many different options to customize your job submission. For further
31- details, please see :core:man1: `flux-mini `.
32+ details, please see :core:man1: `flux-mini `.
3233
33- A :ref: `jobID <fluid> ` (e.g., ``ƒSUEFPDH ``) is returned for every job submitted. You can view
34+ A :ref: `jobid <fluid> ` (e.g., ``ƒSUEFPDH ``) is returned for every job submitted. You can view
3435the status of your running jobs with ``flux jobs ``:
3536
36- .. code-block :: sh
37+ .. code-block :: console
3738
3839 $ flux jobs
3940 JOBID USER NAME ST NTASKS NNODES TIME INFO
40- ƒSUEFPDH fluxuser my_other_s R 1 1 1.842s
41+ ƒSUEFPDH fluxuser my_other_s R 1 1 1.842s
4142 ƒM5k8m7m fluxuser my_compute R 4 2 3.255s
4243
43- And that's it! If you have any questions, please
44+ -----------------------
45+ Interactively Run a Job
46+ -----------------------
47+
48+ If you wish to run a job interactively, e.g. see standard output as it runs, you can
49+ use the ``flux mini run `` command. It is identical to ``flux mini submit `` except it
50+ will handle stdio and it will block until the job has finished. For example:
51+
52+ .. code-block :: console
53+
54+ $ flux mini run bash -c "echo start; sleep 5; echo done"
55+ start
56+ done
57+
58+ In the above example, we run a small bash script that will output "start", sleep for 5 seconds,
59+ and then echo "done". Unlike ``flux mini submit ``, you'll notice it does not output a jobid.
60+ If we check for the status of this job with ``flux jobs `` after it has run, you will not find the
61+ job listed because it is no longer running. Instead run ``flux jobs -a `` which will list all jobs,
62+ including completed jobs.
63+
64+ .. code-block :: console
65+
66+ $ flux jobs -a
67+ JOBID USER NAME ST NTASKS NNODES TIME INFO
68+ f2HnvmZy achu bash CD 1 1 5.119s catalyst159
69+
70+
71+ You will see that job is in the "CD" state or "Completed" state.
72+
73+ And that's it! If you have any questions, please
4474`let us know <https://github.com/flux-framework/flux-docs/issues >`_.
4575
4676-------------------------------------
4777More Examples of Submitting Flux Jobs
4878-------------------------------------
4979
50- .. code-block :: sh
80+ .. code-block :: console
5181
5282 $ flux mini submit --nodes=2 --queue=foo --name=my_special_job ./my_job.py
5383
5484 This submits a job to the `foo ` queue across two nodes, and sets a custom name
5585to the job.
5686
57- .. code-block :: sh
87+ .. code-block :: console
5888
5989 $ flux mini submit --dry-run ./my_cool_job.py
6090
6191 If you don't want your job to actually run, but you are interested in looking
6292at the :ref: `jobspec<jobspec> ` for your job, include the ``--dry-run `` option
6393when you submit your job.
6494
65- .. code-block :: sh
95+ .. code-block :: console
6696
6797 $ flux mini submit --output=job-{{id}}.out ./my_super_cool_job.py
6898 ƒ3D78hc3q
0 commit comments