forked from m3dev/gokart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.py
48 lines (38 loc) · 1.6 KB
/
info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from logging import getLogger
from typing import List, Optional, Set
import luigi
from gokart.task import TaskOnKart
from gokart.tree.task_info import make_task_info_as_tree_str
logger = getLogger(__name__)
def make_tree_info(task: TaskOnKart,
indent: str = '',
last: bool = True,
details: bool = False,
abbr: bool = True,
visited_tasks: Optional[Set[str]] = None,
ignore_task_names: Optional[List[str]] = None) -> str:
"""
Return a string representation of the tasks, their statuses/parameters in a dependency tree format
This function has moved to `gokart.tree.task_info.make_task_info_as_tree_str`.
This code is remained for backward compatibility.
Parameters
----------
- task: TaskOnKart
Root task.
- details: bool
Whether or not to output details.
- abbr: bool
Whether or not to simplify tasks information that has already appeared.
- ignore_task_names: Optional[List[str]]
List of task names to ignore.
Returns
-------
- tree_info : str
Formatted task dependency tree.
"""
return make_task_info_as_tree_str(task=task, details=details, abbr=abbr, ignore_task_names=ignore_task_names)
class tree_info(TaskOnKart):
mode = luigi.Parameter(default='', description='This must be in ["simple", "all"].') # type: str
output_path = luigi.Parameter(default='tree.txt', description='Output file path.') # type: str
def output(self):
return self.make_target(self.output_path, use_unique_id=False)