Skip to content
Browse files

finish priority tutorial

  • Loading branch information...
1 parent 1418b55 commit 4fb64d15ad3fa63ec9d3ea3e0cb28d43b48cb0f9 @computron computron committed Mar 23, 2013
View
BIN docs/_static/AthenB.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN docs/_static/breadthfirst.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2 docs/index.rst
@@ -98,6 +98,7 @@ We recommend that all users read (or at least browse) the following tutorials be
failures_tutorial
security_tutorial
duplicates_tutorial
+ priority_tutorial
Python users and Power users will be interested in the following:
@@ -115,7 +116,6 @@ Planned future tutorials:
* File movement Task Operations
* Database Task Operations
* Assigning specific FireWorkers to run certain jobs
-* Assigning and modifying job priority
* Using a web interface to monitor FireWorks
* Checkpoint / restart of jobs
* Using the QueueLauncher outside of FW
View
77 docs/priority_tutorial.rst
@@ -0,0 +1,77 @@
+======================
+Assigning job priority
+======================
+
+You might want to control the order in which your FireWorks are run. Setting job priority is simple.
+
+How to set job priority
+=======================
+
+To set job priority, simply set a key named ``_priority`` in your FireWork spec. FireWorks will automatically prioritize jobs based on their value of this key. A few notes:
+
+* You can assign any numerical value to the ``_priority``, including negative numbers and decimals. Higher priorities are run first.
+
+* FireWorks with any value of ``_priority`` will be run before jobs without a priority defined. If two FireWorks have the same ``_priority``, one of those jobs will be chosen randomly.
+
+* Make sure that the ``_priority`` key is set at the root level of your FireWork spec.
+
+Example: Prioritize one workflow over another
+=============================================
+
+Imagine we have two workflows, A and B, with two steps each (1 and 2). We want to run workflow A in its entirety before beginning workflow B. Our execution should follow the blue arrow:
+
+.. image:: _static/AthenB.png
+ :width: 400px
+ :align: center
+ :alt: A then B
+
+Let's examine how we can set up such an execution model.
+
+#. Move to the ``A_then_B`` subdirectory of the ``priority`` tutorial directory on your FireServer::
+
+ cd <INSTALL_DIR>/fw_tutorials/priority/A_then_B
+
+#. Look inside the files ``wfA.yaml`` and ``wfB.yaml``. You'll notice that the ``_priority`` key for both steps of ``wfA.yaml`` is set to 2, whereas the corresponding values for the steps of ``wfB.yaml`` are only 1. This means that workflow A will execute in its entirety before starting workflow B.
+
+#. Add and run the FireWorks to confirm::
+
+ lpad reset <TODAY'S DATE>
+ lpad add_dir .
+ rlaunch --silencer rapidfire
+
+#. You should have noticed text printed to the Terminal in the following order::
+
+ Task A-1
+ Task A-2
+ Task B-1
+ Task B-2
+
+Example 2: A breadth-first workflow
+===================================
+
+Let's now try another execution order: A-1, B-1, B-2, A-2.
+
+.. image:: _static/breadthfirst.png
+ :width: 500px
+ :align: center
+ :alt: A then B
+
+#. Move to the ``breadthfirst`` subdirectory of the ``priority`` tutorial directory on your FireServer::
+
+ cd <INSTALL_DIR>/fw_tutorials/priority/breadthfirst
+
+#. Look inside the files ``wfA.yaml`` and ``wfB.yaml``. You'll notice that this time, the ``_priority`` key is highest for step A-1 and lowest for step A-2, corresponding to our desired execution order.
+
+#. Add and run the FireWorks to confirm::
+
+ lpad reset <TODAY'S DATE>
+ lpad add_dir .
+ rlaunch --silencer rapidfire
+
+#. You should have noticed text printed to the Terminal in the following order::
+
+ Task A-1
+ Task B-1
+ Task B-2
+ Task A-2
+
View
2 fw_tutorials/priority/breadthfirst/wfA.yaml
@@ -11,7 +11,7 @@ fws:
- created_on: '2013-03-22T06:43:43.878695'
fw_id: -1
spec:
- _priority: 2
+ _priority: 4
_tasks:
- _fw_name: Script Task
parameters:
View
2 fw_tutorials/priority/breadthfirst/wfB.yaml
@@ -2,7 +2,7 @@ fws:
- created_on: '2013-03-22T06:43:43.879697'
fw_id: -4
spec:
- _priority: 1
+ _priority: 3
_tasks:
- _fw_name: Script Task
parameters:

0 comments on commit 4fb64d1

Please sign in to comment.
Something went wrong with that request. Please try again.