TaskPipe/Task/Settings.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 14 / 14 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« TaskPipe/SchemaManager/Settings_Project.pm ↑ Summary TaskPipe/TaskUtils/Settings.pm »
1 package TaskPipe::Task::Settings;
2  
3 38 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 38 with 'MooseX::ConfigCascade';
5  
6 =head1 NAME
7  
8 TaskPipe::Task::Settings - Settings for L<TaskPipe::Task>
9  
10 =head1 OPTIONS
11  
12 =over
13  
14 =item plan_mode
15  
16 The format that taskpipe expects to find your plan in. There are 2 modes, C<tree> and C<branch>. If your tasks will always be executed in order (ie your plan is completely linear) then this is the mode to choose. This way you can write your plan thus:
17  
18 ---
19  
20 - name: Scrape_Example
21 url: www.example.com
22  
23 - name: Record
24 example_param: $this
25  
26 C<tree> format is slightly more complex, offering the ability to execute different tasks in parallel (ie the plan can have more than one branch). In C<tree> format, tasks should be designated using the keyword C<task:> and cascaded using C<pipe_to:>. For example:
27  
28 ---
29 task:
30 _name: Scrape_Example
31 url: www.example.com
32  
33 pipe_to:
34 task:
35 name: Record
36 example_param: $this
37  
38 An example of how to achieve branching in tree format is as follows:
39
40 ---
41 task:
42 _name: Scrape_Example
43 url: www.example.com
44
45 pipe_to:
46  
47 - task:
48 name: Record
49 example_param: $this
50  
51 - task:
52 name: Scrape_SomethingElse
53 another_param: $this[1]
54  
55 The tasks C<Record> and C<Scrape_SomethingElse> execute in parallel. See the general documentation for more information on plan modes and branching
56  
57 =cut
58  
59 38 has plan_mode => (is => 'ro', isa => 'Str', default => 'branch');
60  
61  
62 =item cache_results
63  
64 Cache xtask results. This prevents the same xtask (ie the same task with the same C<pinterp> being executed again (the results will just be piped to the next task without the task being executed).
65  
66 =cut
67  
68 38 has cache_results => (is => 'ro', isa => 'Bool', default => 0);
69  
70  
71  
72 =item test_result_limit
73  
74 The maximum number of results to output when testing a task
75  
76 =cut
77  
78 38 has test_result_limit => (is => 'ro', isa => 'Int', default => 10);
79  
80  
81  
82  
83 =item seen_xbranch_policy
84  
85 Whether to remember xbranches that have been completed or not. TaskPipe can C<skip> seen xbranches (ie prevent them from being executed more than once) or C<delete> them (if they are not expected to be seen more than once, this option keeps the database trim)
86  
87 =cut
88  
89 38 has seen_xbranch_policy => (is => 'ro', isa => 'Str', default => 'delete');
90  
91  
92  
93 =item xbranch_key_mode
94  
95 Choose 'md5' to have taskpipe create xbranch identifiers using md5 hashes. Choose 'id' to use raw id values (less flexible, but also less CPU intensive)
96  
97 =cut
98  
99 38 has xbranch_key_mode => (is => 'ro', isa => 'Str', default => 'md5');
100  
101  
102  
103 =item resume_record_interval
104  
105 The number of records to process between recording resume information. For example C<resume_record_interval=1> would mean recording resume information every time a new record is processed. If C<resume_record_interval=100>, 100 records would be processed between recording resume information. This hits the database a lot less, but means after premature termination, the next run may repeat processing for up to 100 records
106  
107 =cut
108  
109 38 has resume_record_interval => (is => 'ro', isa => 'Int', default => '100');
110  
111  
112  
113 =item on_task_error
114  
115 What to do if an error is encountered. Options are C<stop> (ie attempt to stop all threads), and C<continue> (which will log the error and continue)
116  
117 =back
118  
119 =cut
120  
121 38 has on_task_error => (is => 'ro', isa => 'Str', default => 'stop');
122  
123  
124 =head1 AUTHOR
125  
126 Tom Gracey <tomgracey@gmail.com>
127  
128 =head1 COPYRIGHT AND LICENSE
129  
130 Copyright (c) Tom Gracey 2018
131  
132 TaskPipe is free software, licensed under
133  
134 The GNU Public License Version 3
135  
136 =cut
137  
138  
139 38 __PACKAGE__->meta->make_immutable;
140 38 1;
« TaskPipe/SchemaManager/Settings_Project.pm ↑ Summary TaskPipe/TaskUtils/Settings.pm »