Debian Codegraph @

sources/visualization_interfaces/DrawGantt-SVG/drawgantt-config.inc.php

raw
1 <?php
2 /**
3 * OAR Drawgantt-SVG
4 * @author Pierre Neyron <[email protected]>
5 *
6 */
7
8 // OAR Drawgantt SVG configuration file
9
10 ////////////////////////////////////////////////////////////////////////////////
11 // Configuration
12 ////////////////////////////////////////////////////////////////////////////////
13
14 // Default settings for the default view
15 $CONF['default_start'] = ""; // default start and stop times (ctime values) ; unless you want to always show a
16 $CONF['default_stop'] = ""; // same time frame, keep those values to ""
17 $CONF['default_relative_start'] = ""; // default relative start and stop times ([+-]<seconds>), mind setting it
18 $CONF['default_relative_stop'] = ""; // accordingly to the nav_forecast values below, eg -24*3600*0.1 and 24*3600*0.9
19 $CONF['default_timespan'] = 6*3600; // default timespan, should be one of the nav_timespans below
20 $CONF['default_resource_base'] = 'cpuset'; // default base resource, should be one of the nav_resource_bases below
21 $CONF['default_scale'] = 10; // default vertical scale of the grid, should be one of the nav_scales below
22
23 // Navigation bar configuration
24 $CONF['nav_timespans'] = array( // proposed timespan in the "set" bar
25 '1 hour' => 3600,
26 '3 hours' => 3*3600,
27 '6 hours' => 6*3600,
28 '12 hours' => 12*3600,
29 '1 day' => 24*3600,
30 '3 day' => 3*24*3600,
31 '1 week' => 7*24*3600,
32 );
33
34 $CONF['nav_forecast'] = array( // forecast display
35 '1 day' => 24*3600,
36 '3 days' => 3*24*3600,
37 '1 week' => 7*24*3600,
38 '2 weeks' => 2*7*24*3600,
39 '3 weeks' => 3*7*24*3600,
40 );
41 $CONF['nav_forecast_past_part'] = 0.1; // past part to show (percentage if < 1, otherwise: number of seconds)
42
43 $CONF['nav_scales'] = array( // proposed scales for resources
44 'small' => 10,
45 'big' => 20,
46 'huge' => 40,
47 );
48
49 $CONF['nav_timeshifts'] = array( // proposed time-shifting buttons
50 '1h' => 3600,
51 '6h' => 6*3600,
52 '1d' => 24*3600,
53 '1w' => 7*24*3600,
54 );
55
56 $CONF['nav_filters'] = array( // proposed filters in the "misc" bar
57 'all clusters' => 'resources.type = \'default\'',
58 'cluster1 only' => 'resources.cluster=\'cluster1\'',
59 'cluster2 only' => 'resources.cluster=\'cluster2\'',
60 'cluster3 only' => 'resources.cluster=\'cluster3\'',
61 );
62
63 $CONF['nav_resource_bases'] = array( // proposed base resources
64 'network_address',
65 'cpuset',
66 );
67
68 $CONF['nav_timezones'] = array( // proposed timezones in the "misc" bar (the first one will be selected by default)
69 'UTC',
70 'Europe/Paris',
71 );
72
73 $CONF['nav_custom_buttons'] = array( // custom buttons, click opens the url in a new window
74 'my label' => 'http://my.url' // remove all lines to disable (empty array)
75 );
76
77 // Database access configuration
78 $CONF['db_type']="pg"; // choices: mysql for Mysql or pg for PostgreSQL
79 $CONF['db_server']="127.0.0.1";
80 $CONF['db_port']="5432"; // usually 3306 for Mysql or 5432 for PostgreSQL
81 $CONF['db_name']="oar"; // OAR read only user account
82 $CONF['db_user']="oar_ro";
83 $CONF['db_passwd']="oar_ro";
84 $CONF['db_max_job_rows']=20000; // max number of job rows retrieved from database, which can be handled.
85
86 // Data display configuration
87 $CONF['timezone'] = "UTC";
88 $CONF['site'] = "My OAR resources"; // name for your infrastructure or site
89 $CONF['resource_labels'] = array('network_address','cpuset'); // properties to describe resources (labels on the left). Must also be part of resource_hierarchy below
90 $CONF['cpuset_label_display_string'] = "%02d";
91 $CONF['label_display_regex'] = array( // shortening regex for labels (e.g. to shorten node-1.mycluster to node-1). label will be replaced with the 1st selection of the regex, unless an array is used with the replacement string as the second argument.
92 'network_address' => '/^([^.]+)\..*$/',
93 'type' => array('/^default$/','proc'),
94 );
95 $CONF['label_display_functions'] = array( // custom functions to format labels for display. The function takes the resource object as argument. This object returns the value for each property of the resource in $obj->data[property]
96 );
97 $CONF['label_cmp_regex'] = array( // substring selection regex for comparing and sorting labels (resources)
98 'network_address' => '/^([^-]+)-(\d+)\..*$/',
99 );
100 $CONF['label_cmp_functions'] = array( // custom functions to format labels for comparison. The function takes the resource object as argument. This object returns the value for each property of the resource in $obj->data[property].
101 );
102 $CONF['resource_properties'] = array( // properties to display in the pop-up on top of the resources labels (on the left)
103 'deploy', 'cpuset', 'besteffort', 'network_address', 'type', 'drain');
104 $CONF['resource_hierarchy'] = array( // properties to use to build the resource hierarchy drawing
105 'network_address','cpuset',
106 );
107 $CONF['resource_base'] = "cpuset"; // base resource of the hierarchy/grid
108 $CONF['resource_group_level'] = "network_address"; // level of resources to separate with blue lines in the grid
109 $CONF['resource_drain_property'] = "drain"; // if set, must also be one of the resource_properties above to activate the functionnality
110 $CONF['state_descriptions'] = array( // description of the states
111 //'Absent#current' => 'Resource temporarily unavailable because rebooting/redeploying after either a deploy job or a job using sudo-g5k',
112 //'Absent#past' => 'Resource temporarily unavailable: temporarily shut down for energy saving or rebooting/redeploying after either a deploy job or a job using sudo-g5k',
113 //'Suspected' => 'Resource temporarily failing, should be repaired',
114 //'Dead' => 'Resource out of order, may never be repaired',
115 //'Standby' => 'Resource shut down for energy saving, will power on when required for a job',
116 //'Drain' => 'Resource not accepting jobs any more, waiting for a maintenance',
117 );
118 $CONF['state_colors'] = array( // colors for the states of the resources in the gantt
119 'Absent' => 'url(#absentPattern)', 'Suspected' => 'url(#suspectedPattern)', 'Dead' => 'url(#deadPattern)', 'Standby' => 'url(#standbyPattern)', 'Drain' => 'url(#drainPattern)');
120 $CONF['job_colors'] = array( // colors for the types of the jobs in the gantt
121 'besteffort' => 'url(#besteffortPattern)',
122 'deploy(=\w)?' => 'url(#deployPattern)',
123 'container(=\w+)?' => 'url(#containerPattern)',
124 'timesharing=(\*|user),(\*|name)' => 'url(#timesharingPattern)',
125 'placeholder=\w+' => 'url(#placeholderPattern)',
126 );
127 $CONF['job_click_url'] = ''; // set a URL to open when a job is double-clicked, %%JOBID%% is to be replaced by the jobid in the URL
128 $CONF['resource_click_url'] = ''; // set a URL to open when a resource is double-clicked, %%TYPE%% is to be replaced by the resource type and %%ID%% by the resource id in the URL
129
130 // Geometry customization
131 $CONF['hierarchy_resource_width'] = 10; // default: 10
132 $CONF['scale'] = 10; // default: 10
133 $CONF['text_scale'] = 10; // default: 10
134 $CONF['time_ruler_scale'] = 6; // default: 6
135 $CONF['time_ruler_steps'] = array(60,120,180,300,600,1200,1800,3600,7200,10800,21600,28800,43200,86400,172800,259200,604800);
136 $CONF['gantt_top'] = 50; // default: 50
137 $CONF['bottom_margin'] = 45; // default: 45
138 $CONF['right_margin'] = 30; // default 30
139 $CONF['label_right_align'] = 105; // default: 105
140 $CONF['hierarchy_left_align'] = 110; // default: 110
141 $CONF['gantt_left_align'] = 160; // default: 160
142 $CONF['gantt_min_width'] = 900; // default: 900
143 $CONF['gantt_min_height'] = 100; // default: 100
144 $CONF['gantt_min_job_width_for_label'] = 40; // default: 40
145 $CONF['min_state_duration'] = 2; // default: 2
146
147 // Colors and fill patterns for jobs and states
148 $CONF['job_color_saturation_lightness'] = "75%,75%"; // default: "75%,75%"
149 $CONF['job_color_saturation_lightness_highlight'] = "50%,50%"; // default: "50%,50%"
150 $CONF['static_patterns'] = <<<EOT
151 <pattern id="absentPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" >
152 <polygon points="0,0 3,0 0,3" fill="#0000ff" stroke="#0000ff" stroke-width="1" />
153 <polygon points="7,0 10,0 10,3 3,10 0,10 0,7" fill="#0000ff" stroke="#0000ff" stroke-width="1" />
154 <polygon points="10,7 10,10 7,10" fill="#0000ff" stroke="#0000ff" stroke-width="1" />
155 </pattern>
156 <pattern id="suspectedPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" >
157 <polygon points="0,0 3,0 0,3" fill="#ff0000" stroke="#ff0000" stroke-width="1" />
158 <polygon points="7,0 10,0 10,3 3,10 0,10 0,7" fill="#ff0000" stroke="#ff0000" stroke-width="1" />
159 <polygon points="10,7 10,10 7,10" fill="#ff0000" stroke="#ff0000" stroke-width="1" />
160 </pattern>
161 <pattern id="deadPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" >
162 <polygon points="0,0 3,0 0,3" fill="#404040" stroke="#404040" stroke-width="1" />
163 <polygon points="7,0 10,0 10,3 3,10 0,10 0,7" fill="#404040" stroke="#404040" stroke-width="1" />
164 <polygon points="10,7 10,10 7,10" fill="#404040" stroke="#404040" stroke-width="1" />
165 </pattern>
166 <pattern id="standbyPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" >
167 <polygon points="0,0 3,0 0,3" fill="#88ffff" stroke="#88ffff" stroke-width="1" />
168 <polygon points="7,0 10,0 10,3 3,10 0,10 0,7" fill="#88ffff" stroke="#88ffff" stroke-width="1" />
169 <polygon points="10,7 10,10 7,10" fill="#88ffff" stroke="#88ffff" stroke-width="1" />
170 </pattern>
171 <pattern id="drainPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="15" height="10" viewBox="0 0 10 10" >
172 <circle cx="5" cy="5" r="4" fill="#ff0000" stroke="#ff0000" stroke-width="1" />
173 <line x1="2" y1="5" x2="9" y2="5" stroke="#ffffff" stroke-width="2" />
174 </pattern>
175 <pattern id="containerPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" >
176 <text font-size="10" x="0" y="20" fill="#888888">C</text>
177 </pattern>
178 <pattern id="besteffortPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" >
179 <text font-size="10" x="10" y="20" fill="#888888">B</text>
180 </pattern>
181 <pattern id="placeholderPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" >
182 <text font-size="10" x="10" y="20" fill="#888888">P</text>
183 </pattern>
184 <pattern id="deployPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" >
185 <text font-size="10" x="10" y="10" fill="#888888">D</text>
186 </pattern>
187 <pattern id="timesharingPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" >
188 <text font-size="10" x="10" y="20" fill="#888888">T</text>
189 </pattern>
190 EOT;
191
192 // Standby state display options for the part shown in the future
193 $CONF['standby_truncate_state_to_now'] = 1; // default: 1
194 // Besteffort job display options for the part shown in the future
195 $CONF['besteffort_truncate_job_to_now'] = 1; // default: 1
196 $CONF['besteffort_pattern'] = <<<EOT
197 <pattern id="%%PATTERN_ID%%" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" >
198 <polygon points="0,0 7,0 10,5 7,10 0,10 3,5" fill="%%PATTERN_COLOR%%" stroke-width="0"/>
199 </pattern>'
200 EOT;
201
202 // Advanced customization for the computation of the colors of the jobs
203 // Uncomment and adapt the following to override the default function
204 //class MyShuffle extends Shuffle {
205 // // Default function: get the color's hue value as a function of the job_id
206 // function job2int($job) {
207 // // compute a suffled number for job_id, so that colors are not too close
208 // $magic_number = (1+sqrt(5))/2;
209 // return (int)(360 * fmod($job->job_id * $magic_number, 1));
210 // }
211 // // Other example: get the color's hue value as a function of the job_user value
212 // protected $cache = array();
213 // function job2int($job) {
214 // // shuffled number based on the job_user:
215 // if (! array_key_exists($job->job_user, $this->cache)) {
216 // $n = (int) base_convert(substr(md5($job->job_user) ,0, 5), 16, 10);
217 // $magic_number = (1+sqrt(5))/2;
218 // $this->cache[$job->job_user] = (int)(360 * fmod($n * $magic_number, 1));
219 // }
220 // return $this->cache[$job->job_user];
221 // }
222 //}
223 //Shuffle::init(new MyShuffle()); // this line must be uncommented for the overiding to take effect
224
225 // Minimum timespan the gantt can handle
226 $CONF['min_timespan']= 480; // gantt does not show if (stop date - start date) < 8 minutes
227
228 // Debugging
229 $CONF['debug'] = 0; // Set to > 0 to enable debug prints in the web server error logs
230
231 ?>