Skip to content

Commit ec9ae29

Browse files
authored
Merge pull request #202 from chu11/flux_mini_run
tutorials: add flux mini run tutorial/example
2 parents 18c5b38 + c361e3c commit ec9ae29

File tree

3 files changed

+44
-14
lines changed

3 files changed

+44
-14
lines changed

tutorials/commands/flux-mini-submit.rst

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.. _flux-mini-submit:
2+
.. _flux-mini-run:
23

34
==========================
45
How to Submit Jobs in Flux
@@ -14,7 +15,7 @@ From within a Flux instance, you can submit your job on the command line with
1415
optional arguments, resource options, per task options, and per resource
1516
options:
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
2829
task on just one node with 2 cores allocated for the task.
2930

3031
There 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
3435
the 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
-------------------------------------
4777
More 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
5585
to 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
6292
at the :ref:`jobspec<jobspec>` for your job, include the ``--dry-run`` option
6393
when 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

tutorials/commands/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Command Tutorials
66
Welcome to the Command Tutorials! These tutorials should help you to map specific Flux commands
77
with your use case, and then see detailed usage.
88

9-
- ``flux proxy`` (:ref:`ssh-across-clusters`): "Send commands to a flux instance across clusters using ssh"
10-
- ``flux-mini-submit`` (:ref:`flux-mini-submit`): "Submit a job in a Flux instance"
9+
- ``flux mini submit/flux mini run`` (:ref:`flux-mini-submit`): "Submit a job in a Flux instance"
10+
- ``flux proxy`` (:ref:`ssh-across-clusters`): "Send commands to a Flux instance across clusters using ssh"
1111

1212
This section is currently 🚧️ under construction 🚧️, so please come back later to see more command tutorials!
1313

@@ -16,5 +16,5 @@ This section is currently 🚧️ under construction 🚧️, so please come bac
1616
:maxdepth: 2
1717
:caption: Command Tutorials
1818

19-
ssh-across-clusters
2019
flux-mini-submit
20+
ssh-across-clusters

tutorials/commands/ssh-across-clusters.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Create a Flux Instance
1313
----------------------
1414

1515
First, let's create the allocation on the first cluster. We typically want to ask for an allocation,
16-
and run flux start via our job manager. Here we might be on a login node:
16+
and run ``flux start`` via our job manager. Here we might be on a login node:
1717

1818
.. code-block:: console
1919
@@ -22,7 +22,7 @@ and run flux start via our job manager. Here we might be on a login node:
2222
$ srun -N4 -n4 --pty --mpibind=off flux start
2323
2424
And then we get our allocation! You might adapt this command to be more specific to your resource manager. E.g., slurm uses srun.
25-
After you run flux start, you are inside of a Flux instance on your allocation!
25+
After you run ``flux start``, you are inside of a Flux instance on your allocation!
2626
Let's run a simple job on our allocation. This first example will ask to see the hostnames of your nodes:
2727

2828
.. code-block:: console

0 commit comments

Comments
 (0)