Skip to content

Commit

Permalink
applying Yibei suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
djarecka committed Oct 17, 2023
1 parent fcd27ba commit 31078bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions notebooks/1_intro_pydra.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You'll also construct basic `Workflow`s that link multiple tasks together. Furth

+++

**Before going to the main notebooks, let's check if pydra is properly installed.** If you have any issues running the following cell, please revisit the Installation section. TODO-LINK
**Let's check if pydra is properly installed.** If you have any issues running the following cell, please revisit the Installation section. TODO-LINK

```{code-cell} ipython3
import pydra
Expand All @@ -42,4 +42,4 @@ At the beginning of each tutorial you will see:
import nest_asyncio
nest_asyncio.apply()
```
This is run because both *Jupyter* and *Pydra* use `asyncio` and in some cases you can see `RuntimeError: This event loop is already running` if `nest_asyncio` is not used. **This part is not needed if Pydra is used outside the Jupyter environment.**
This is because both *Jupyter* and *Pydra* use `asyncio` and you can get `RuntimeError: This event loop is already running` if `nest_asyncio` is not used. **This part is not needed if Pydra is used outside of Jupyter Notebook/Lab.**
12 changes: 6 additions & 6 deletions notebooks/2_intro_functiontask.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ nest_asyncio.apply()

+++

In this tutorial, you will generate your initial *pydra* `Task`, which is a fundamental *pydra*'s component capable of processing data. You will start from a `FunctionTask`, a type of `Task` that can be created from every *python* function by using *pydra* decorator: `pydra.mark.task`:
In this tutorial, you will generate your initial *Pydra* `Task`, which is a fundamental *Pydra*'s component capable of processing data. You will start from a `FunctionTask`, a type of `Task` that can be created from every *python* function by using *Pydra* decorator: `pydra.mark.task`:

```{code-cell} ipython3
import pydra
Expand All @@ -38,7 +38,7 @@ def add_var(a, b):
return a + b
```

Now that we decorated the function, we can create a pydra `Task` and specify the input, for this example values for `a` and `b` are needed.
After decorating the function, you can create a Pydra `Task` and specify the input. In this example, values for `a` and `b` are needed.

```{code-cell} ipython3
task0 = add_var(a=4, b=5)
Expand Down Expand Up @@ -93,7 +93,7 @@ If you want to practice, change the values of `a` and `b` and run the task again
+++

## Customizing output names
Note, that "out" is the default name for the task output, but you can always customize it by using *python* function annotation.
Note, that `out` from `result.output.out` is the default name for the task output, but you can always customize it by using *python* function annotation.

```{code-cell} ipython3
import typing as ty
Expand Down Expand Up @@ -169,7 +169,7 @@ os.listdir(task3.output_dir)
```

But you can also provide the path where you want to store the results.
**Note that if the same path is provided when you run the task again, pydra will use the cached results instead of recomputing the result.**
**Note that if the same path is provided when you run the task again, Pydra will use the cached results instead of recomputing the result.**

Let's create a temporary directory and a specific subdirectory "task4":

Expand Down Expand Up @@ -220,9 +220,9 @@ task4a = add_var_wait(a=4, b=6, cache_dir=cache_dir_tmp)
task4a()
```

This time the result should be ready right away! *pydra* uses available results and do not recompute the task. The wall time provided by `%%tinme` should be in milliseconds.
This time the result should be ready right away! *Pydra* uses available results and do not recompute the task. The wall time provided by `%%tinme` should be in milliseconds.

*pydra* not only checks for the results in `cache_dir`, but you can provide a list of other locations that should be checked. Let's create another directory that will be used as `cache_dir` and previous working directory will be used in `cache_locations`.
*Pydra* not only checks for the results in `cache_dir`, but you can provide a list of other locations that should be checked. Let's create another directory that will be used as `cache_dir` and previous working directory will be used in `cache_locations`.

```{code-cell} ipython3
cache_dir_tmp_new = Path(mkdtemp()) / 'task4b'
Expand Down

0 comments on commit 31078bf

Please sign in to comment.