Example: Character frequencies in the Loremipsum

There are multiple ways to setup and run this example:

  1. Launch notebook on Binder
  2. Static notebook on GitHub
  3. Docker: docker run -ti riga/law:example loremipsum
  4. Local: source setup.sh

Introduction

This example demonstrates how to create and run a simple law task tree.

The actual payload of the tasks is rather trivial. Six different versions of the lorem ipsum dummy text are fetched from a website. Per version, the character frequencies are measured, and merged and visualized in the end.

You might want to checkout the implemention of the tasks below in (tasks.py) while executing the notebook.

Resources: luigi, law

Before you proceed, load the law ipython magics:

  • %law: runs the passed line in a subprocess
  • %ilaw: runs the passed line interactively in the current process (for tasks defined in notebooks)

Since we do not define any tasks in this notebook, we are fine with %law.


In [1]:
import law
law.contrib.load("ipython")
law.ipython.register_magics(init_cmd="source setup.sh", line_cmd="source setup.sh", log_level="INFO")


INFO: law.contrib.ipython.magic - running initialization command 'source setup.sh'
INFO: law.contrib.ipython.magic - magics successfully registered: %law, %ilaw

This is not specific to law but helps setting up the dependencies (luigi and six) in the example directory of this notebook.

This is equivalent to source setup.sh when running the commands in a terminal.


1. Let law index your the tasks and their parameters (optional)

Note that indexing is only required for auto-completion in the command line and therefore not that important for this notebook. However, it is a convenient feature to show your available tasks and complete their parameters when working with a terminal.


In [2]:
%law index --verbose


indexing tasks in 1 module(s)
loading module 'tasks', done

module 'tasks', 4 task(s):
    - ShowFrequencies
    - FetchLoremIpsum
    - CountChars
    - MergeCounts

written 4 task(s) to index file '/law/examples/loremipsum/.law/index'

Besides, while indexing always sounds cumbersome, the law index file is just a human-readable file summarizing your tasks, the corresponding python modules, and their parameters. Have a look at the index file if you're interested. Note that the output of the cell below might be hidden.


In [3]:
%law index --show


tasks:ShowFrequencies:fetch-output log-file print-deps print-output print-status remove-output slow
tasks:FetchLoremIpsum:fetch-output file-index log-file print-deps print-output print-status remove-output slow
tasks:CountChars:fetch-output file-index log-file print-deps print-output print-status remove-output slow
tasks:MergeCounts:fetch-output log-file print-deps print-output print-status remove-output slow

2. Check the status of the ShowFrequencies task

Now, we want to use the law run command for the first time. But to begin with, we add a parameter --print-status -1 to the command:


In [4]:
%law run ShowFrequencies --print-status -1


print task status with max_depth -1 and target_depth 0

> check status of ShowFrequencies(slow=False)
|   
|   > check status of MergeCounts(slow=False)
|   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_merged.json)
|   |     absent
|   |   
|   |   > check status of CountChars(file_index=1, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_1.json)
|   |   |     absent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=1, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_1.txt)
|   |   |   |     absent
|   |   
|   |   > check status of CountChars(file_index=2, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_2.json)
|   |   |     absent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=2, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_2.txt)
|   |   |   |     absent
|   |   
|   |   > check status of CountChars(file_index=3, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_3.json)
|   |   |     absent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=3, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_3.txt)
|   |   |   |     absent
|   |   
|   |   > check status of CountChars(file_index=4, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_4.json)
|   |   |     absent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=4, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_4.txt)
|   |   |   |     absent
|   |   
|   |   > check status of CountChars(file_index=5, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_5.json)
|   |   |     absent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=5, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_5.txt)
|   |   |   |     absent
|   |   
|   |   > check status of CountChars(file_index=6, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_6.json)
|   |   |     absent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=6, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_6.txt)
|   |   |   |     absent

You should see that all output targets are absent and no task is complete yet.

Although law run was called, no task was actually executed. A few parameters will make law only print helpful information in the command line, such as the status of a certain task (ShowFrequencies above) and its recursive dependencies. The value given to --print-status defines the recursion level, where 0 is the task given to law run itself.


In [5]:
%law run ShowFrequencies --print-status 0


print task status with max_depth 0 and target_depth 0

> check status of ShowFrequencies(slow=False)

Other so-called interactive parameters are --print-deps, --print-output, --fetch-output and --remove-output. Use the help for find out more about these parameters. Note that the output of the cell below might be hidden.


In [6]:
%law run ShowFrequencies --help


usage: law run [--local-scheduler [CORE_LOCAL_SCHEDULER]] [--module CORE_MODULE]
               [--help [CORE_HELP]] [--help-all [CORE_HELP_ALL]]
               [--ShowFrequencies-log-file SHOWFREQUENCIES_LOG_FILE]
               [--log-file LOG_FILE]
               [--ShowFrequencies-print-deps SHOWFREQUENCIES_PRINT_DEPS]
               [--print-deps PRINT_DEPS]
               [--ShowFrequencies-print-status SHOWFREQUENCIES_PRINT_STATUS]
               [--print-status PRINT_STATUS]
               [--ShowFrequencies-print-output SHOWFREQUENCIES_PRINT_OUTPUT]
               [--print-output PRINT_OUTPUT]
               [--ShowFrequencies-remove-output SHOWFREQUENCIES_REMOVE_OUTPUT]
               [--remove-output REMOVE_OUTPUT]
               [--ShowFrequencies-fetch-output SHOWFREQUENCIES_FETCH_OUTPUT]
               [--fetch-output FETCH_OUTPUT]
               [--ShowFrequencies-slow [SHOWFREQUENCIES_SLOW]] [--slow [SLOW]]
               [Required root task]

positional arguments:
  Required root task    Task family to run. Is not optional.

optional arguments:
  --local-scheduler [CORE_LOCAL_SCHEDULER]
                        Use an in-memory central scheduler. Useful for
                        testing.
  --module CORE_MODULE  Used for dynamic loading of modules
  --help [CORE_HELP]    Show most common flags and all task-specific flags
  --help-all [CORE_HELP_ALL]
                        Show all command line flags
  --ShowFrequencies-log-file SHOWFREQUENCIES_LOG_FILE
                        a custom log file, default: <task.default_log_file>
  --log-file LOG_FILE   a custom log file, default: <task.default_log_file>
  --ShowFrequencies-print-deps SHOWFREQUENCIES_PRINT_DEPS
                        print task dependencies but do not run any task; this
                        CSV parameter accepts a single integer value which
                        sets the task recursion depth (0 means non-recursive)
  --print-deps PRINT_DEPS
                        print task dependencies but do not run any task; this
                        CSV parameter accepts a single integer value which
                        sets the task recursion depth (0 means non-recursive)
  --ShowFrequencies-print-status SHOWFREQUENCIES_PRINT_STATUS
                        print the task status but do not run any task; this
                        CSV parameter accepts up to three values: 1. the task
                        recursion depth (0 means non-recursive), 2. the depth
                        of the status text of target collections (default: 0),
                        3. a flag that is passed to the status text creation
                        (default: '')
  --print-status PRINT_STATUS
                        print the task status but do not run any task; this
                        CSV parameter accepts up to three values: 1. the task
                        recursion depth (0 means non-recursive), 2. the depth
                        of the status text of target collections (default: 0),
                        3. a flag that is passed to the status text creation
                        (default: '')
  --ShowFrequencies-print-output SHOWFREQUENCIES_PRINT_OUTPUT
                        print a flat list of output targets but do not run any
                        task; this CSV parameter accepts a single integer
                        value which sets the task recursion depth (0 means
                        non-recursive
  --print-output PRINT_OUTPUT
                        print a flat list of output targets but do not run any
                        task; this CSV parameter accepts a single integer
                        value which sets the task recursion depth (0 means
                        non-recursive
  --ShowFrequencies-remove-output SHOWFREQUENCIES_REMOVE_OUTPUT
                        remove task outputs but do not run any task; this CSV
                        parameter accepts up to three values: 1. the task
                        recursion depth (0 means non-recursive), 2. one of the
                        modes 'i' (interactive), 'a' (all), 'd' (dry run)
                        (default: 'i'), 3. a flag that decides whether outputs
                        of external tasks should be removed (default: False)
  --remove-output REMOVE_OUTPUT
                        remove task outputs but do not run any task; this CSV
                        parameter accepts up to three values: 1. the task
                        recursion depth (0 means non-recursive), 2. one of the
                        modes 'i' (interactive), 'a' (all), 'd' (dry run)
                        (default: 'i'), 3. a flag that decides whether outputs
                        of external tasks should be removed (default: False)
  --ShowFrequencies-fetch-output SHOWFREQUENCIES_FETCH_OUTPUT
                        copy all task outputs into a local directory but do
                        not run any task; this CSV parameter accepts up to
                        four values: 1. the task recursion depth (0 means non-
                        recursive), 2. one of the modes 'i' (interactive), 'a'
                        (all), 'd' (dry run) (default: 'i'), 3. the target
                        directory (default: '.'), 4. a flag that decides
                        whether outputs of external tasks should be fetched
                        (default: False)
  --fetch-output FETCH_OUTPUT
                        copy all task outputs into a local directory but do
                        not run any task; this CSV parameter accepts up to
                        four values: 1. the task recursion depth (0 means non-
                        recursive), 2. one of the modes 'i' (interactive), 'a'
                        (all), 'd' (dry run) (default: 'i'), 3. the target
                        directory (default: '.'), 4. a flag that decides
                        whether outputs of external tasks should be fetched
                        (default: False)
  --ShowFrequencies-slow [SHOWFREQUENCIES_SLOW]
                        before running, wait between 5 and 15 seconds
  --slow [SLOW]         before running, wait between 5 and 15 seconds

3. Run the ShowFrequencies task

Now we run the task and all its dependencies with a single command.


In [7]:
%law run ShowFrequencies


INFO: Informed scheduler that task   ShowFrequencies_False_9ba313c494   has status   PENDING
INFO: Informed scheduler that task   MergeCounts_False_9ba313c494   has status   PENDING
INFO: Informed scheduler that task   CountChars_6_False_d07face2c7   has status   PENDING
INFO: Informed scheduler that task   FetchLoremIpsum_6_False_d07face2c7   has status   PENDING
INFO: Informed scheduler that task   CountChars_5_False_675cf0b527   has status   PENDING
INFO: Informed scheduler that task   FetchLoremIpsum_5_False_675cf0b527   has status   PENDING
INFO: Informed scheduler that task   CountChars_4_False_c828a5a8e7   has status   PENDING
INFO: Informed scheduler that task   FetchLoremIpsum_4_False_c828a5a8e7   has status   PENDING
INFO: Informed scheduler that task   CountChars_3_False_21e31eaf1d   has status   PENDING
INFO: Informed scheduler that task   FetchLoremIpsum_3_False_21e31eaf1d   has status   PENDING
INFO: Informed scheduler that task   CountChars_2_False_5579299431   has status   PENDING
INFO: Informed scheduler that task   FetchLoremIpsum_2_False_5579299431   has status   PENDING
INFO: Informed scheduler that task   CountChars_1_False_50b924af96   has status   PENDING
INFO: Informed scheduler that task   FetchLoremIpsum_1_False_50b924af96   has status   PENDING
INFO: Done scheduling tasks
INFO: Running Worker with 1 processes
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   FetchLoremIpsum(file_index=6, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      FetchLoremIpsum(file_index=6, slow=False)
INFO: Informed scheduler that task   FetchLoremIpsum_6_False_d07face2c7   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   CountChars(file_index=6, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      CountChars(file_index=6, slow=False)
INFO: Informed scheduler that task   CountChars_6_False_d07face2c7   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   FetchLoremIpsum(file_index=5, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      FetchLoremIpsum(file_index=5, slow=False)
INFO: Informed scheduler that task   FetchLoremIpsum_5_False_675cf0b527   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   CountChars(file_index=5, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      CountChars(file_index=5, slow=False)
INFO: Informed scheduler that task   CountChars_5_False_675cf0b527   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   FetchLoremIpsum(file_index=4, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      FetchLoremIpsum(file_index=4, slow=False)
INFO: Informed scheduler that task   FetchLoremIpsum_4_False_c828a5a8e7   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   CountChars(file_index=4, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      CountChars(file_index=4, slow=False)
INFO: Informed scheduler that task   CountChars_4_False_c828a5a8e7   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   FetchLoremIpsum(file_index=3, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      FetchLoremIpsum(file_index=3, slow=False)
INFO: Informed scheduler that task   FetchLoremIpsum_3_False_21e31eaf1d   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   CountChars(file_index=3, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      CountChars(file_index=3, slow=False)
INFO: Informed scheduler that task   CountChars_3_False_21e31eaf1d   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   FetchLoremIpsum(file_index=2, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      FetchLoremIpsum(file_index=2, slow=False)
INFO: Informed scheduler that task   FetchLoremIpsum_2_False_5579299431   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   CountChars(file_index=2, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      CountChars(file_index=2, slow=False)
INFO: Informed scheduler that task   CountChars_2_False_5579299431   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   FetchLoremIpsum(file_index=1, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      FetchLoremIpsum(file_index=1, slow=False)
INFO: Informed scheduler that task   FetchLoremIpsum_1_False_50b924af96   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   CountChars(file_index=1, slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      CountChars(file_index=1, slow=False)
INFO: Informed scheduler that task   CountChars_1_False_50b924af96   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   MergeCounts(slow=False)
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      MergeCounts(slow=False)
INFO: Informed scheduler that task   MergeCounts_False_9ba313c494   has status   DONE
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) running   ShowFrequencies(slow=False)
e: xxxxxxxxxxxxxxxxxx 9%
a: xxxxxxxxxxxxxxxx 8%
i: xxxxxxxxxxxxxxxx 8%
o: xxxxxxxxxxxxxxxx 8%
u: xxxxxxxxxxxxxx 7%
t: xxxxxxxxxxxxxx 7%
s: xxxxxxxxxxxx 6%
n: xxxxxxxxxx 5%
r: xxxxxxxxxx 5%
m: xxxxxxxx 4%
l: xxxxxxxx 4%
c: xxxxxx 3%
d: xxxxxx 3%
p: xxxxxx 3%
g: xxxx 2%
b: xx 1%
h: xx 1%
k: xx 1%
w: xx 1%
f: - 0%
j: - 0%
q: - 0%
v: - 0%
y: - 0%
x: - 0%
z: - 0%
INFO: [pid 32184] Worker Worker(salt=032422033, workers=1, pid=32184) done      ShowFrequencies(slow=False)
INFO: Informed scheduler that task   ShowFrequencies_False_9ba313c494   has status   DONE
INFO: Worker Worker(salt=032422033, workers=1, pid=32184) was stopped. Shutting down Keep-Alive thread
INFO: 
===== Luigi Execution Summary =====

Scheduled 14 tasks of which:
* 14 ran successfully:
    - 6 CountChars(...)
    - 6 FetchLoremIpsum(...)
    - 1 MergeCounts(...)
    - 1 ShowFrequencies(...)

This progress looks :) because there were no failed tasks or missing dependencies

===== Luigi Execution Summary =====

The task execution should be successful within a few seconds. You can scroll through the output and read the logs to get a sense of the way luigi is building up the dependency tree, followed by the scheduling of tasks, and eventually closing with an execution summary.

Also, you might want to add the --slow parameter to make the tasks somewhat slower in order to see the progress logs appearing in the output. This is of course not a feature of law, but only implemented by the tasks in this example 😉.

4. Check the status again

As above, we add --print-status -1 again, to see the task status, represented by the existence of their output targets.


In [8]:
%law run ShowFrequencies --print-status -1


print task status with max_depth -1 and target_depth 0

> check status of ShowFrequencies(slow=False)
|   
|   > check status of MergeCounts(slow=False)
|   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_merged.json)
|   |     existent
|   |   
|   |   > check status of CountChars(file_index=1, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_1.json)
|   |   |     existent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=1, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_1.txt)
|   |   |   |     existent
|   |   
|   |   > check status of CountChars(file_index=2, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_2.json)
|   |   |     existent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=2, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_2.txt)
|   |   |   |     existent
|   |   
|   |   > check status of CountChars(file_index=3, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_3.json)
|   |   |     existent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=3, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_3.txt)
|   |   |   |     existent
|   |   
|   |   > check status of CountChars(file_index=4, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_4.json)
|   |   |     existent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=4, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_4.txt)
|   |   |   |     existent
|   |   
|   |   > check status of CountChars(file_index=5, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_5.json)
|   |   |     existent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=5, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_5.txt)
|   |   |   |     existent
|   |   
|   |   > check status of CountChars(file_index=6, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_6.json)
|   |   |     existent
|   |   |   
|   |   |   > check status of FetchLoremIpsum(file_index=6, slow=False)
|   |   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_6.txt)
|   |   |   |     existent

Note that the ShowFrequencies task itself has no outputs. It is run once, but every time it is invoked, independent of the presence of a persistent file. The other tasks do have outputs, which we are going to delete in the next step.

5. Remove outputs interactively

As mentioned above, another interactive parameter to pass to law run commands is --remove-output. The passed value is interpreted as the recursion depth of dependent tasks whose output should be removed as well.

However, in order to avoid removing files by mistake, law interactively asks for confirmation before irreversibly removing anything. The prompt looks like this:

> law run ShowFrequencies --remove-output N

remove task output with max_depth N
removal mode? [i*(interactive), d(dry), a(all)]

The default mode (marked with *) is interactive (type 'i'), which means that law traverses the task tree interactively and asks for confirmation on every target. dry mode (type 'd') traverses the tree without actually removing anything. The all mode should be handled with care. Once you type 'a', the outputs of all tasks down to the requested recursion depth are removed.

To avoid interactive prompts in this example notebook, you can either do (though not recommended)

> echo a | law run ShowFrequencies --remove-output N

or add the mode with a comma to the value of the --remove-output parameter. Here, we only want to remove the outputs down to the CountChars task, i.e., at a depth of 2 (see the task tree above in the --print-status outputs). This way, the FetchLoremIpsum outputs are preserved.


In [9]:
%law run ShowFrequencies --remove-output 2,a


remove task output with max_depth 2
selected all mode

> remove output of ShowFrequencies(slow=False)
|   
|   > remove output of MergeCounts(slow=False)
|   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_merged.json)
|   |     removed
|   |   
|   |   > remove output of CountChars(file_index=1, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_1.json)
|   |   |     removed
|   |   
|   |   > remove output of CountChars(file_index=2, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_2.json)
|   |   |     removed
|   |   
|   |   > remove output of CountChars(file_index=3, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_3.json)
|   |   |     removed
|   |   
|   |   > remove output of CountChars(file_index=4, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_4.json)
|   |   |     removed
|   |   
|   |   > remove output of CountChars(file_index=5, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_5.json)
|   |   |     removed
|   |   
|   |   > remove output of CountChars(file_index=6, slow=False)
|   |   |   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_6.json)
|   |   |     removed

Verify your action by printing the status of, let's say, the first CountChars task.


In [10]:
%law run CountChars --file-index 1 --print-status -1


print task status with max_depth -1 and target_depth 0

> check status of CountChars(file_index=1, slow=False)
|   - LocalFileTarget(path=/law/examples/loremipsum/data/chars_1.json)
|     absent
|   
|   > check status of FetchLoremIpsum(file_index=1, slow=False)
|   |   - LocalFileTarget(path=/law/examples/loremipsum/data/loremipsum_1.txt)
|   |     existent