<jupyter_start><jupyter_text>Five-minute quickstartIn this quickstart, you will:- Create some jobs.- Use the jobs in a Flow.- Run the Flow.- Examine the outputs of the Flow.- Get a flavor of the Python APIThis tutorial will emphasize "hands-on" usage of jobflow and not explain things in detail. Define jobsThe atomic building block of jobflows are jobs. Creating a job is as easy as writing a python function. All you need to do is use the `@job` decorator.<jupyter_code>import warnings
warnings.filterwarnings("ignore", "Using `tqdm.autonotebook.tqdm`")
from jobflow import job

@job
def add(a, b):
    return a + b<jupyter_output><empty_output><jupyter_text>Any call to the `add` function will return a `Job` object. This is essentially a function call that will be executed later.<jupyter_code>add_first = add(1, 5)<jupyter_output><empty_output><jupyter_text>Jobs have outputs that can be accessed using the `output` attribute. As the job has not yet been executed, the output is currently a reference to the future output.<jupyter_code>add_first.output<jupyter_output><empty_output><jupyter_text>The output of a job can be used as the input to another job.<jupyter_code>add_second = add(add_first.output, 3)<jupyter_output><empty_output><jupyter_text>Create a FlowA Flow is a collection of Jobs or other Flow objects. Let's create a Flow from the `add_first` and `add_second` jobs we just made:<jupyter_code>from jobflow import Flow

flow = Flow([add_first, add_second])<jupyter_output><empty_output><jupyter_text>The order of the jobs in the input array does not matter. Their execution order will be determined by their connectivity. Because `add_second` takes the output of `add_first` as an input, the `add_first` will always run before `add_second`.The connectivity of the jobs in a flow can be visualized using:<jupyter_code>flow.draw_graph(figsize=(3, 3)).show()<jupyter_output><empty_output><jupyter_text>Run the Flow Jobflow supports running Flows locally or on remote clusters. Below we run the Flow locally using the `run_locally` function.**Note**Running Flows on remote clusters can be achieved using the FireWorks package and is covered in the [Running Flows with FireWorks tutorial](https://hackingmaterials.lbl.gov/jobflow/tutorials/6-fireworks.html).<jupyter_code>from jobflow.managers.local import run_locally

responses = run_locally(flow)<jupyter_output>2021-06-04 17:56:25,875 INFO Started executing jobs locally
2021-06-04 17:56:25,877 INFO Starting job - add (3bc98d5e-b593-4ad1-a409-cef9136bb835)
2021-06-04 17:56:25,878 INFO Finished job - add (3bc98d5e-b593-4ad1-a409-cef9136bb835)
2021-06-04 17:56:25,879 INFO Starting job - add (846add3f-1d37-47a1-a7f5-94a0fdf57b1b)
2021-06-04 17:56:25,880 INFO Finished job - add (846add3f-1d37-47a1-a7f5-94a0fdf57b1b)
2021-06-04 17:56:25,881 INFO Finished executing jobs locally<jupyter_text>The numbers in brackets after the job function name give the job unique identifier (UUID).  Examine Flow outputs The `run_locally` function returns the output of all jobs. The format of the output is:```python{    job_uuid: {        job_index: {            Response()        }    }}```The `job_index` and `Response()` objects are introduced in later tutorials. The main thing to know is that the Response contains the output of the Job and any other commands for controlling the Flow execution.<jupyter_code>responses<jupyter_output><empty_output><jupyter_text>We can check the output of specific jobs using:<jupyter_code>responses[add_first.uuid][1].output<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08286358511837655, 'fraction_numerical': 0.05157835400225479, 'mean_word_length': 5.646067415730337, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '459761', 'license': 'BSD-3-Clause-LBNL', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1117, 'n_words': 400, 'path': 'tutorials/1-quickstart.ipynb', 'repo_name': 'mjwen/jobflow', 'size': '3548'}