Skip to content

Commit

Permalink
differences for PR #65
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Feb 4, 2025
1 parent 8d86d99 commit 166ef94
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 86 deletions.
6 changes: 3 additions & 3 deletions basic-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,10 @@ tar_make()
▶ dispatched target penguins_csv_file
● completed target penguins_csv_file [0.001 seconds, 190 bytes]
▶ dispatched target penguins_data_raw
● completed target penguins_data_raw [0.149 seconds, 10.403 kilobytes]
● completed target penguins_data_raw [0.189 seconds, 10.403 kilobytes]
▶ dispatched target penguins_data
● completed target penguins_data [0.006 seconds, 1.614 kilobytes]
▶ ended pipeline [0.32 seconds]
● completed target penguins_data [0.009 seconds, 1.614 kilobytes]
▶ ended pipeline [0.339 seconds]
```

Congratulations, you've run your first workflow with `targets`!
Expand Down
59 changes: 24 additions & 35 deletions branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ tar_plan(


``` output
✔ skipped target penguins_data_raw_file
✔ skipped target penguins_data_raw
✔ skipped target penguins_data
✔ skipping targets (1 so far)...
▶ dispatched target combined_model
● completed target combined_model [0.148 seconds, 11.201 kilobytes]
● completed target combined_model [0.017 seconds, 11.201 kilobytes]
▶ ended pipeline [0.257 seconds]
```

Expand Down Expand Up @@ -151,14 +149,11 @@ tar_plan(


``` output
✔ skipped target penguins_data_raw_file
✔ skipped target penguins_data_raw
✔ skipped target penguins_data
✔ skipped target combined_model
✔ skipping targets (1 so far)...
▶ dispatched target adelie_model
● completed target adelie_model [0.008 seconds, 6.475 kilobytes]
● completed target adelie_model [0.009 seconds, 6.475 kilobytes]
▶ dispatched target gentoo_model
● completed target gentoo_model [0.003 seconds, 5.88 kilobytes]
● completed target gentoo_model [0.001 seconds, 5.88 kilobytes]
▶ dispatched target chinstrap_model
● completed target chinstrap_model [0.002 seconds, 4.535 kilobytes]
▶ dispatched target combined_summary
Expand All @@ -168,8 +163,8 @@ tar_plan(
▶ dispatched target gentoo_summary
● completed target gentoo_summary [0.003 seconds, 348 bytes]
▶ dispatched target chinstrap_summary
● completed target chinstrap_summary [0.003 seconds, 348 bytes]
▶ ended pipeline [0.314 seconds]
● completed target chinstrap_summary [0.002 seconds, 348 bytes]
▶ ended pipeline [0.285 seconds]
```

Let's look at the summary of one of the models:
Expand Down Expand Up @@ -251,21 +246,19 @@ First, let's look at the messages provided by `tar_make()`.


``` output
✔ skipped target penguins_data_raw_file
✔ skipped target penguins_data_raw
✔ skipped target penguins_data
✔ skipping targets (1 so far)...
▶ dispatched target combined_summary
● completed target combined_summary [0.016 seconds, 348 bytes]
● completed target combined_summary [0.009 seconds, 348 bytes]
▶ dispatched target penguins_data_grouped
● completed target penguins_data_grouped [0.008 seconds, 1.527 kilobytes]
● completed target penguins_data_grouped [0.009 seconds, 1.527 kilobytes]
▶ dispatched branch species_summary_7fe6634f7c7f6a77
● completed branch species_summary_7fe6634f7c7f6a77 [0.005 seconds, 348 bytes]
▶ dispatched branch species_summary_c580675a85977909
● completed branch species_summary_c580675a85977909 [0.003 seconds, 348 bytes]
▶ dispatched branch species_summary_af3bb92d1b0f36d3
● completed branch species_summary_af3bb92d1b0f36d3 [0.004 seconds, 348 bytes]
● completed pattern species_summary
▶ ended pipeline [0.308 seconds]
▶ ended pipeline [0.299 seconds]
```

There is a series of smaller targets (branches) that are each named like species_summary_7fe6634f7c7f6a77, then one overall `species_summary` target.
Expand Down Expand Up @@ -366,20 +359,17 @@ Since `targets` tracks the contents of each custom function, it realizes that it


``` output
✔ skipped target penguins_data_raw_file
✔ skipped target penguins_data_raw
✔ skipped target penguins_data
✔ skipping targets (1 so far)...
▶ dispatched target combined_summary
● completed target combined_summary [0.027 seconds, 371 bytes]
✔ skipped target penguins_data_grouped
● completed target combined_summary [0.019 seconds, 371 bytes]
▶ dispatched branch species_summary_7fe6634f7c7f6a77
● completed branch species_summary_7fe6634f7c7f6a77 [0.011 seconds, 368 bytes]
● completed branch species_summary_7fe6634f7c7f6a77 [0.009 seconds, 368 bytes]
▶ dispatched branch species_summary_c580675a85977909
● completed branch species_summary_c580675a85977909 [0.007 seconds, 372 bytes]
● completed branch species_summary_c580675a85977909 [0.006 seconds, 372 bytes]
▶ dispatched branch species_summary_af3bb92d1b0f36d3
● completed branch species_summary_af3bb92d1b0f36d3 [0.006 seconds, 369 bytes]
● completed pattern species_summary
▶ ended pipeline [0.334 seconds]
▶ ended pipeline [0.309 seconds]
```

And this time, when we load the `model_summaries`, we can tell which model corresponds to which row (the `.before = 1` in `mutate()` ensures that it shows up before the other columns).
Expand Down Expand Up @@ -525,29 +515,28 @@ And run it once more:


``` output
✔ skipped target penguins_data_raw_file
✔ skipped target penguins_data_raw
✔ skipping targets (1 so far)...
▶ dispatched target penguins_data
● completed target penguins_data [0.025 seconds, 1.527 kilobytes]
● completed target penguins_data [0.024 seconds, 1.527 kilobytes]
▶ dispatched target combined_summary
● completed target combined_summary [0.013 seconds, 371 bytes]
● completed target combined_summary [0.014 seconds, 371 bytes]
▶ dispatched branch species_summary_1598bb4431372f32
● completed branch species_summary_1598bb4431372f32 [0.01 seconds, 368 bytes]
● completed branch species_summary_1598bb4431372f32 [0.012 seconds, 368 bytes]
▶ dispatched branch species_summary_6b9109ba2e9d27fd
● completed branch species_summary_6b9109ba2e9d27fd [0.006 seconds, 372 bytes]
▶ dispatched branch species_summary_625f9fbc7f62298a
● completed branch species_summary_625f9fbc7f62298a [0.006 seconds, 369 bytes]
● completed pattern species_summary
▶ dispatched target combined_predictions
● completed target combined_predictions [0.007 seconds, 25.908 kilobytes]
● completed target combined_predictions [0.008 seconds, 25.908 kilobytes]
▶ dispatched branch species_predictions_1598bb4431372f32
● completed branch species_predictions_1598bb4431372f32 [0.01 seconds, 11.581 kilobytes]
▶ dispatched branch species_predictions_6b9109ba2e9d27fd
● completed branch species_predictions_6b9109ba2e9d27fd [0.006 seconds, 6.248 kilobytes]
● completed branch species_predictions_6b9109ba2e9d27fd [0.005 seconds, 6.248 kilobytes]
▶ dispatched branch species_predictions_625f9fbc7f62298a
● completed branch species_predictions_625f9fbc7f62298a [0.006 seconds, 9.626 kilobytes]
● completed branch species_predictions_625f9fbc7f62298a [0.005 seconds, 9.626 kilobytes]
● completed pattern species_predictions
▶ ended pipeline [0.384 seconds]
▶ ended pipeline [0.38 seconds]
```

::::::::::::::::::::::::::::::::::::: {.callout}
Expand Down
18 changes: 9 additions & 9 deletions files.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ tar_plan(
``` output
▶ dispatched target some_data
● completed target some_data [0.001 seconds, 64 bytes]
▶ ended pipeline [0.049 seconds]
▶ ended pipeline [0.086 seconds]
```

If we inspect the contents of `some_data` with `tar_read(some_data)`, it will contain the string `"Hello World"` as expected.
Expand All @@ -76,8 +76,8 @@ tar_plan(


``` output
skipped target some_data
✔ skipped pipeline [0.049 seconds]
skipping targets (1 so far)...
✔ skipped pipeline [0.073 seconds]
```

The target `some_data` was skipped, even though the contents of the file changed.
Expand All @@ -101,7 +101,7 @@ tar_plan(
● completed target data_file [0.001 seconds, 26 bytes]
▶ dispatched target some_data
● completed target some_data [0 seconds, 78 bytes]
▶ ended pipeline [0.065 seconds]
▶ ended pipeline [0.103 seconds]
```

This time we see that `targets` does successfully re-build `some_data` as expected.
Expand Down Expand Up @@ -186,10 +186,10 @@ tar_plan(
▶ dispatched target penguins_data_raw_file
● completed target penguins_data_raw_file [0.001 seconds, 53.098 kilobytes]
▶ dispatched target penguins_data_raw
● completed target penguins_data_raw [0.222 seconds, 10.403 kilobytes]
● completed target penguins_data_raw [0.097 seconds, 10.403 kilobytes]
▶ dispatched target penguins_data
● completed target penguins_data [0.011 seconds, 1.495 kilobytes]
▶ ended pipeline [0.31 seconds]
● completed target penguins_data [0.016 seconds, 1.495 kilobytes]
▶ ended pipeline [0.366 seconds]
```

::::::::::::::::::::::::::::::::::
Expand Down Expand Up @@ -262,14 +262,14 @@ tar_plan(

``` output
▶ dispatched target hello_file
● completed target hello_file [0 seconds, 26 bytes]
● completed target hello_file [0.001 seconds, 26 bytes]
▶ dispatched target hello
● completed target hello [0 seconds, 78 bytes]
▶ dispatched target hello_caps
● completed target hello_caps [0 seconds, 78 bytes]
▶ dispatched target hello_caps_out
● completed target hello_caps_out [0 seconds, 26 bytes]
▶ ended pipeline [0.08 seconds]
▶ ended pipeline [0.115 seconds]
```

Take a look at `hello_caps.txt` in the `results` folder and verify it is as you expect.
Expand Down
7 changes: 3 additions & 4 deletions functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,10 @@ tar_make()
```

``` output
✔ skipped target penguins_csv_file
✔ skipped target penguins_data_raw
✔ skipping targets (1 so far)...
▶ dispatched target penguins_data
● completed target penguins_data [0.007 seconds, 1.614 kilobytes]
▶ ended pipeline [0.087 seconds]
● completed target penguins_data [0.008 seconds, 1.614 kilobytes]
▶ ended pipeline [0.144 seconds]
```

We will learn more soon about the messages that `targets()` prints out.
Expand Down
26 changes: 10 additions & 16 deletions lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ tar_make()
```

``` output
✔ skipped target penguins_csv_file
✔ skipped target penguins_data_raw
✔ skipped target penguins_data
✔ skipped pipeline [0.073 seconds]
✔ skipping targets (1 so far)...
✔ skipped pipeline [0.074 seconds]
```

Remember how the first time we ran the pipeline, `targets` printed out a list of each target as it was being built?
Expand Down Expand Up @@ -83,11 +81,10 @@ tar_make()
```

``` output
✔ skipped target penguins_csv_file
✔ skipped target penguins_data_raw
✔ skipping targets (1 so far)...
▶ dispatched target penguins_data
● completed target penguins_data [0.017 seconds, 1.495 kilobytes]
▶ ended pipeline [0.105 seconds]
● completed target penguins_data [0.013 seconds, 1.495 kilobytes]
▶ ended pipeline [0.252 seconds]
```

What happened?
Expand Down Expand Up @@ -249,10 +246,8 @@ tar_make()
```

``` output
✔ skipped target penguins_csv_file
✔ skipped target penguins_data_raw
✔ skipped target penguins_data
✔ skipped pipeline [0.088 seconds]
✔ skipping targets (1 so far)...
✔ skipped pipeline [0.223 seconds]
```

Let's invalidate `penguins_data` and run it again:
Expand All @@ -264,11 +259,10 @@ tar_make()
```

``` output
✔ skipped target penguins_csv_file
✔ skipped target penguins_data_raw
✔ skipping targets (1 so far)...
▶ dispatched target penguins_data
● completed target penguins_data [0.017 seconds, 1.495 kilobytes]
▶ ended pipeline [0.106 seconds]
● completed target penguins_data [0.014 seconds, 1.495 kilobytes]
▶ ended pipeline [0.248 seconds]
```

If you want to reset **everything** and start fresh, you can use `tar_invalidate(everything())` (`tar_invalidate()` [accepts `tidyselect` expressions](https://docs.ropensci.org/targets/reference/tar_invalidate.html) to specify target names).
Expand Down
2 changes: 1 addition & 1 deletion md5sum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
"learners/reference.md" "3f06251c1f932e767ae8f22db25eb5a2" "site/built/reference.md" "2025-02-04"
"learners/setup.md" "2c9965f182c4d73141cbf0bef2990f16" "site/built/setup.md" "2025-02-04"
"profiles/learner-profiles.md" "44d8b9d8aca7963e6577e8c67d23eac0" "site/built/learner-profiles.md" "2025-02-04"
"renv/profiles/lesson-requirements/renv.lock" "efd6bc74b2dafaac8884413ac53adcd8" "site/built/renv.lock" "2025-02-04"
"renv/profiles/lesson-requirements/renv.lock" "a90f543f378beac1e260eec44f10d540" "site/built/renv.lock" "2025-02-04"
2 changes: 1 addition & 1 deletion organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Error:
doTryCatch(return(expr), name, parentenv, handler)
base::withCallingHandlers({ NULL base::saveRDS(base::do.call(base::do.ca...
base::saveRDS(base::do.call(base::do.call, base::c(base::readRDS("/tmp/R...
base::do.call(base::do.call, base::c(base::readRDS("/tmp/RtmpKJPaCa/call...
base::do.call(base::do.call, base::c(base::readRDS("/tmp/RtmpNvyZSd/call...
(function (what, args, quote = FALSE, envir = parent.frame()) { if (!is....
(function (targets_function, targets_arguments, options, envir = NULL, s...
tryCatch(out <- withCallingHandlers(targets::tar_callr_inner_try(targets...
Expand Down
10 changes: 5 additions & 5 deletions packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ tar_plan(

``` output
▶ dispatched target adelie_data
● completed target adelie_data [0.021 seconds, 1.544 kilobytes]
▶ ended pipeline [0.069 seconds]
● completed target adelie_data [0.018 seconds, 1.544 kilobytes]
▶ ended pipeline [0.105 seconds]
```

This method gets around the slow-downs that may sometimes be experienced with Method 1.
Expand Down Expand Up @@ -101,7 +101,7 @@ tar_plan(
``` output
▶ dispatched target adelie_data
● completed target adelie_data [0.018 seconds, 1.544 kilobytes]
▶ ended pipeline [0.067 seconds]
▶ ended pipeline [0.102 seconds]
```

This can be more memory efficient in some cases than loading all packages, since not every target is always made during a typical run of the workflow.
Expand All @@ -127,8 +127,8 @@ tar_plan(

``` output
▶ dispatched target adelie_data
● completed target adelie_data [0.008 seconds, 1.544 kilobytes]
▶ ended pipeline [0.056 seconds]
● completed target adelie_data [0.01 seconds, 1.544 kilobytes]
▶ ended pipeline [0.095 seconds]
```

The benefits of this approach are that the origins of all functions is explicit, so you could browse your code (for example, by looking at its source in GitHub), and immediately know where all the functions come from.
Expand Down
22 changes: 10 additions & 12 deletions parallel.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,28 +195,26 @@ Finally, run the pipeline with `tar_make()` as normal.


``` output
✔ skipped target penguins_data_raw_file
✔ skipped target penguins_data_raw
✔ skipped target penguins_data
✔ skipping targets (1 so far)...
▶ dispatched target combined_summary
▶ dispatched branch species_summary_1598bb4431372f32
● completed target combined_summary [4.663 seconds, 371 bytes]
● completed target combined_summary [4.669 seconds, 371 bytes]
▶ dispatched branch species_summary_6b9109ba2e9d27fd
● completed branch species_summary_1598bb4431372f32 [4.661 seconds, 368 bytes]
● completed branch species_summary_1598bb4431372f32 [4.671 seconds, 368 bytes]
▶ dispatched branch species_summary_625f9fbc7f62298a
● completed branch species_summary_6b9109ba2e9d27fd [4.01 seconds, 372 bytes]
● completed branch species_summary_6b9109ba2e9d27fd [4.137 seconds, 372 bytes]
▶ dispatched target combined_predictions
● completed branch species_summary_625f9fbc7f62298a [4.01 seconds, 369 bytes]
● completed branch species_summary_625f9fbc7f62298a [4.141 seconds, 369 bytes]
● completed pattern species_summary
▶ dispatched branch species_predictions_1598bb4431372f32
● completed target combined_predictions [4.012 seconds, 25.911 kilobytes]
● completed target combined_predictions [4.133 seconds, 25.911 kilobytes]
▶ dispatched branch species_predictions_6b9109ba2e9d27fd
● completed branch species_predictions_1598bb4431372f32 [4.012 seconds, 11.585 kilobytes]
● completed branch species_predictions_1598bb4431372f32 [4.135 seconds, 11.585 kilobytes]
▶ dispatched branch species_predictions_625f9fbc7f62298a
● completed branch species_predictions_6b9109ba2e9d27fd [4.007 seconds, 6.252 kilobytes]
● completed branch species_predictions_625f9fbc7f62298a [4.009 seconds, 9.629 kilobytes]
● completed branch species_predictions_6b9109ba2e9d27fd [4.11 seconds, 6.252 kilobytes]
● completed branch species_predictions_625f9fbc7f62298a [4.114 seconds, 9.629 kilobytes]
● completed pattern species_predictions
▶ ended pipeline [18.892 seconds]
▶ ended pipeline [19.327 seconds]
```

Notice that although the time required to build each individual target is about 4 seconds, the total time to run the entire workflow is less than the sum of the individual target times! That is proof that processes are running in parallel **and saving you time**.
Expand Down

0 comments on commit 166ef94

Please sign in to comment.