Skip to content

Commit e376617

Browse files
dthainbtovar
andauthored
Vine: Update Taskgraph Format and Tool (#4243)
* Add description of taskgraph file format * Modify taskgraph log to generate abstract format, rather than writing graphviz dot directly. * Add vine_plot_taskgraph to consume new taskgraph format. * Organize plotting section to present each tool consistently: debug, performance, taskgraph, transactions. * Debug log first. * format * lint --------- Co-authored-by: Benjamin Tovar <[email protected]>
1 parent 8796c3c commit e376617

File tree

5 files changed

+292
-59
lines changed

5 files changed

+292
-59
lines changed

doc/manuals/taskvine/index.md

Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,9 +2455,8 @@ cores, memory and disk have modifiers `~` and `>` as follows:
24552455

24562456
## Logging, Plotting, and Tuning
24572457

2458-
A TaskVine manager produces several logs: `debug`, `taskgraph`, `performance`,
2459-
and `transactions`. These logs are always enabled, and appear in the current
2460-
working directory in the subdirectories:
2458+
A TaskVine manager produces several logs: `performance`, `taskgraph`, `debug`, and `transactions`.
2459+
These logs are always enabled, and appear in the current working directory in the subdirectories:
24612460

24622461
```sh
24632462
vine-run-info/YYYY-mm-ddTHH:MM:SS/vine-logs
@@ -2487,24 +2486,24 @@ If set, the environment variable `VINE_RUNTIME_INFO_DIR` determines the logging
24872486
directory. If `VINE_RUNTIME_INFO_DIR` is not an absolute path, then it is taken
24882487
relative to the current logging prefix (i.e. `vine-run-info/` by default).
24892488

2490-
24912489
### Debug Log
24922490

24932491
The debug log prints unstructured messages as the manager transfers files and
24942492
tasks, workers connect and report resources, etc. This is specially useful to
2495-
find failures, bugs, and other errors. It is located by default at:
2493+
find failures, bugs, and other errors when your workflow isn't running as expected.
2494+
It is located by default at:
24962495

24972496
```sh
24982497
vine-run-info/%Y-%m-%dT%H:%M:%S/vine-logs/debug
24992498
```
25002499

2501-
To enable debugging at the worker, set the `-d` option:
2502-
2500+
To view the debug log of the manager:
25032501
```sh
2504-
$ vine_worker -d all -o worker.debug -M myproject
2502+
less vine-run-info/most-recent/vine-logs/debug
25052503
```
25062504

2507-
Custom APPLICATION messages can be added to the log with the calls:
2505+
When writing an application, you may find it helpful to add your
2506+
own application-level messages to the log with code like this:
25082507

25092508
=== "Python"
25102509
```python
@@ -2515,29 +2514,42 @@ Custom APPLICATION messages can be added to the log with the calls:
25152514
```
25162515
vine_log_debug_app("your custom log message")
25172516
```
2517+
You may also find it helpful to view the debug log of a worker,
2518+
when running it locally. To enable debugging at the worker, add
2519+
the `-d all` option:
2520+
2521+
```sh
2522+
$ vine_worker -d all -o worker.debug -M myproject
2523+
```
2524+
2525+
And then view the debug output of the worker process:
2526+
```sh
2527+
less worker.debug
2528+
```
25182529

25192530
### Performance Log
25202531

25212532
The performance log contains a time series of the statistics collected by the manager,
25222533
such as number of tasks waiting and completed, number of workers busy,
2523-
total number of cores available, etc. The log is located by default at:
2534+
total number of cores available, etc.
2535+
It is located by default at:
25242536

25252537
```sh
25262538
vine-run-info/%Y-%m-%dT%H:%M:%S/vine-logs/performance
25272539
```
25282540

2529-
Install gnuplot to enable the use of `vine_graph_log`
2530-
2531-
```sh
2532-
conda install conda-forge::gnuplot
2533-
```
2541+
!!! note
2542+
To use `vine_graph_log`, you must first install the `gnuplot` package like this:
2543+
```
2544+
conda install conda-forge::gnuplot
2545+
```
25342546

2535-
The script `vine_graph_log` is a wrapper for `gnuplot`, and with it you
2536-
can plot some of the statistics, such as total time spent transferring tasks,
2537-
number of tasks running, and workers connected. For example, this command:
2547+
`vine_graph_log` will plot a wide variety of statistics from the performance log,
2548+
such as total time spent transferring tasks, number of tasks running, and workers connected.
2549+
For example, this command:
25382550

25392551
```sh
2540-
$ vine_graph_log -o myplots my.stats.log
2552+
$ vine_graph_log -o myplots vine-run-info/most-recent/vine-logs/performance
25412553
```
25422554

25432555
produces the following graphs:
@@ -2546,11 +2558,41 @@ produces the following graphs:
25462558

25472559
- [Performance Log File Format Details](log-file-formats.md#performance-log-format)
25482560

2561+
### Taskgraph Log
2562+
2563+
The `taskgraph` log file captures the graph relationship between every task and file in a workflow as it runs.
2564+
To generate a visual graph from the log file, run `vine_plot_taskgraph`:
2565+
It is located by default at:
2566+
2567+
```sh
2568+
vine-run-info/%Y-%m-%dT%H:%M:%S/vine-logs/taskgraph
2569+
```
2570+
2571+
!!! note
2572+
To use `vine_plot_taskgraph`, you must first install the `graphviz` package like this:
2573+
```
2574+
conda install conda-forge::graphviz
2575+
```
2576+
2577+
```sh
2578+
vine_plot_taskgraph vine-run-info/most-recent/vine-logs/taskgraph --output taskgraph.pdf
2579+
```
2580+
2581+
Which produces a graph like the following:
2582+
2583+
![Example Task Graph](images/plot-taskgraph.png)
2584+
2585+
Note that very large task graphs may take a long time to render, and make be impractical to display
2586+
if there are a large number of edges to be rendered.
2587+
2588+
- [Taskgraph Log File Format Details](log-file-formats.md#taskgraph-log-format)
2589+
25492590
### Transactions Log
25502591

25512592
The transactions log records the lifetime of tasks and workers. It is
25522593
specially useful for tracking the resources requested, allocated, and used by
2553-
specific tasks. It is located by default at:
2594+
specific tasks.
2595+
It is located by default at:
25542596

25552597
```sh
25562598
vine-run-info/%Y-%m-%dT%H:%M:%S/vine-logs/transactions
@@ -2570,7 +2612,6 @@ to produce a visualization of how tasks are packed into workers like this:
25702612

25712613
- [Transactions Log File Format Details](log-file-formats.md#transactions-log-format)
25722614

2573-
25742615
Custom APPLICATION messages can be added to the log with the calls:
25752616

25762617
=== "Python"
@@ -2667,28 +2708,6 @@ For the *workers* file:
26672708
| `disk` | Total disk space in MB available at the worker.|
26682709
| `gpus` | Total number of gpus available at the worker.|
26692710

2670-
### Task Graph Log
2671-
2672-
The complete graph of tasks and files is recorded in `taskgraph`
2673-
using the [Graphviz](https://graphviz.org) Dot file format. With the `dot` tool installed, you
2674-
can visualize the task graph as follows:
2675-
2676-
```sh
2677-
dot -Tpng vine-run-info/most-recent/vine-logs/taskgraph > taskgraph.png
2678-
```
2679-
2680-
This can produce results like this:
2681-
2682-
![Example Task Graph](images/plot-taskgraph.png)
2683-
2684-
Note that very large task graphs may be impractical to graph at this level of detail.
2685-
2686-
!!! note
2687-
You may need to install Graphviz Dot separately like this:
2688-
```
2689-
conda install -c conda-forge graphviz
2690-
```
2691-
26922711
### TaskVine Report Tool
26932712

26942713
The [TaskVine Report Tool](https://github.com/cooperative-computing-lab/taskvine-report-tool) is a separate repository maintained by our team that provides web-based visualization capabilities. It is highly optimized for parsing large log files and generating informative visualizations. Here are some screenshots of this tool:

doc/manuals/taskvine/log-file-formats.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,35 @@ Here is an example of the first few rows and columns:
1919
...
2020
```
2121

22+
## Taskgraph Log Format
23+
24+
The `taskgraph` log contains a sequence of records describing the basic
25+
properties of each file and task, and the relationships between the two.
26+
It is suitable for determining the provenance of files and tasks, and
27+
can be used to display the visual structure of a workflow.
28+
29+
Each line is ASCII text with words delimited by spaces, except where quoted.
30+
Lines beginning with `#` are comments. A file record consists of the word
31+
`FILE` followed by the unique file id, the quoted source path of the file,
32+
and the size of the file, if known.
33+
A task record consists of the word `TASK` followed by the unique task ID,
34+
the quoted name of the task, the keyword `INPUTS` followed by a list of input file IDs,
35+
and the keyword `OUTPUTS` followed by a list of output file IDs.
36+
37+
```text
38+
# taskvine taskgraph version 2
39+
# TASK taskid "program" INPUTS fileid1 fileid fileid3 ... OUTPUTS fileid4 fileid5 ...
40+
# FILE fileid "source" size
41+
FILE file-meta-9c24a99af02ce7f488fcc7461fba2423 "convert.sfx" 350768
42+
FILE url-rnd-qjmltcbhuctjrfl "A-Cat.jpg" 163047
43+
FILE temp-rnd-sfscsbmjstfkvob "temp" 0
44+
TASK T1 "convert.sfx" INPUTS file-meta-9c24a99af02ce7f488fcc7461fba2423 url-rnd-qjmltcbhuctjrfl OUTPUTS temp-rnd-sfscsbmjstfkvob
45+
TASK T4 "convert.sfx" INPUTS file-meta-9c24a99af02ce7f488fcc7461fba2423 url-rnd-qjmltcbhuctjrfl OUTPUTS temp-rnd-wqtpljproftkoym
46+
TASK T23 "convert.sfx" INPUTS file-meta-9c24a99af02ce7f488fcc7461fba2423 url-rnd-qjmltcbhuctjrfl OUTPUTS temp-rnd-ycbskigfhodnnuj
47+
TASK T5 "convert.sfx" INPUTS file-meta-9c24a99af02ce7f488fcc7461fba2423 url-rnd-qjmltcbhuctjrfl OUTPUTS temp-rnd-evtwiteajlpgwjn
48+
...
49+
```
50+
2251
## Transactions Log Format
2352

2453
The first few lines of the log document the possible log records:

taskvine/src/manager/vine_taskgraph_log.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
#include "vine_mount.h"
44
#include "vine_task.h"
55

6-
#include "path.h"
7-
86
#include <inttypes.h>
97
#include <stdio.h>
108

11-
static int show_names = 0;
12-
139
void vine_taskgraph_log_write_header(struct vine_manager *q)
1410
{
15-
fprintf(q->graph_logfile, "digraph \"taskvine\" {\n");
16-
fprintf(q->graph_logfile, "node [style=filled,font=Helvetica,fontsize=10];\n");
11+
fprintf(q->graph_logfile, "# taskvine taskgraph version 2\n");
12+
fprintf(q->graph_logfile, "# TASK taskid \"program\" INPUTS fileid1 fileid fileid3 ... OUTPUTS fileid4 fileid5 ...\n");
13+
fprintf(q->graph_logfile, "# FILE fileid \"source\" size\n");
1714
}
1815

1916
void vine_taskgraph_log_write_task(struct vine_manager *q, struct vine_task *t)
@@ -28,21 +25,25 @@ void vine_taskgraph_log_write_task(struct vine_manager *q, struct vine_task *t)
2825
if (p)
2926
*p = 0;
3027

31-
fprintf(q->graph_logfile, "\"task-%d\" [color=green,label=\"%s\"];\n", id, show_names ? path_basename(name) : "");
28+
fprintf(q->graph_logfile, "TASK T%d \"%s\" INPUTS ", id, name);
3229

3330
free(name);
3431

3532
struct vine_mount *m;
3633

3734
LIST_ITERATE(t->input_mounts, m)
3835
{
39-
fprintf(q->graph_logfile, "\"file-%s\" -> \"task-%d\";\n", m->file->cached_name, id);
36+
fprintf(q->graph_logfile, "%s ", m->file->cached_name);
4037
}
4138

39+
fprintf(q->graph_logfile, "OUTPUTS ");
40+
4241
LIST_ITERATE(t->output_mounts, m)
4342
{
44-
fprintf(q->graph_logfile, "\"task-%d\" -> \"file-%s\";\n", id, m->file->cached_name);
43+
fprintf(q->graph_logfile, "%s ", m->file->cached_name);
4544
}
45+
46+
fprintf(q->graph_logfile, "\n");
4647
}
4748

4849
void vine_taskgraph_log_write_mini_task(struct vine_manager *q, struct vine_task *t, const char *task_name, const char *output_name)
@@ -58,31 +59,35 @@ void vine_taskgraph_log_write_mini_task(struct vine_manager *q, struct vine_task
5859
if (p)
5960
*p = 0;
6061

61-
fprintf(q->graph_logfile, "\"task-%d\" [color=green,label=\"%s\"];\n", id, show_names ? task_name : "");
62+
fprintf(q->graph_logfile, "TASK T-%d \"%s\" INPUTS ", id, task_name);
6263

6364
free(name);
6465

6566
struct vine_mount *m;
6667

6768
LIST_ITERATE(t->input_mounts, m)
6869
{
69-
fprintf(q->graph_logfile, "\"file-%s\" -> \"task-%d\";\n", m->file->cached_name, id);
70+
fprintf(q->graph_logfile, "%s ", m->file->cached_name);
7071
}
7172

72-
/* A mini-task has one implied output that is named by provided argument, not the data structure */
73-
fprintf(q->graph_logfile, "\"task-%d\" -> \"file-%s\";\n", id, output_name);
73+
/* A mini-task has exactly one implied output that is named by provided argument, not the data structure */
74+
fprintf(q->graph_logfile, "OUTPUTS %s", output_name);
75+
76+
fprintf(q->graph_logfile, "\n");
7477
}
7578

7679
void vine_taskgraph_log_write_file(struct vine_manager *q, struct vine_file *f)
7780
{
7881
if (!f)
7982
return;
8083

81-
fprintf(q->graph_logfile, "\"file-%s\" [shape=rect,color=blue,label=\"%s\"];\n", f->cached_name, (show_names && f->source) ? path_basename(f->source) : "");
84+
fprintf(q->graph_logfile, "FILE %s \"%s\" %ld\n", f->cached_name, f->source ? f->source : "", f->size);
85+
86+
/* If this file was generated by a mini-task, then describe that too. */
8287
vine_taskgraph_log_write_mini_task(q, f->mini_task, f->source, f->cached_name);
8388
}
8489

8590
void vine_taskgraph_log_write_footer(struct vine_manager *q)
8691
{
87-
fprintf(q->graph_logfile, "}\n");
92+
fprintf(q->graph_logfile, "# end\n");
8893
}

taskvine/src/tools/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LOCAL_LINKAGE+=${CCTOOLS_HOME}/taskvine/src/manager/libtaskvine.a ${CCTOOLS_HOME
55
LOCAL_CCFLAGS+=-I ${CCTOOLS_HOME}/taskvine/src/manager
66

77
PROGRAMS = vine_status vine_benchmark
8-
SCRIPTS = vine_graph_log vine_graph_workers vine_plot_txn_log vine_profile_dispatch vine_submit_workers vine_transfer_plot_animate vine_plot_compose
8+
SCRIPTS = vine_graph_log vine_plot_taskgraph vine_graph_workers vine_plot_txn_log vine_profile_dispatch vine_submit_workers vine_transfer_plot_animate vine_plot_compose
99
TEST_PROGRAMS = vine_test
1010
TARGETS = $(PROGRAMS) $(TEST_PROGRAMS)
1111

0 commit comments

Comments
 (0)