| 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'] = 'slash_22'; // 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 bellow |
| 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 |
|
| 42 |
$CONF['nav_forecast_past_part'] = 0.1; // past part to show (percentage if < 1, otherwise: number of seconds) |
| 43 |
|
| 44 |
$CONF['nav_scales'] = array( // proposed scales for resources |
| 45 |
'small' => 10, |
| 46 |
'big' => 20, |
| 47 |
'huge' => 40, |
| 48 |
); |
| 49 |
|
| 50 |
$CONF['nav_timeshifts'] = array( // proposed time-shifting buttons |
| 51 |
'1h' => 3600, |
| 52 |
'6h' => 6*3600, |
| 53 |
'1d' => 24*3600, |
| 54 |
'1w' => 7*24*3600, |
| 55 |
); |
| 56 |
|
| 57 |
$CONF['nav_filters'] = array( |
| 58 |
'subnet' => "type='subnet'", |
| 59 |
); |
| 60 |
|
| 61 |
$CONF['nav_resource_bases'] = array( // proposed base resources |
| 62 |
'slash_16', |
| 63 |
'slash_17', |
| 64 |
'slash_18', |
| 65 |
'slash_19', |
| 66 |
'slash_20', |
| 67 |
'slash_21', |
| 68 |
'slash_22', |
| 69 |
); |
| 70 |
|
| 71 |
$CONF['nav_timezones'] = array( // proposed timezones in the "misc" bar (the first one will be selected by default) |
| 72 |
'UTC', |
| 73 |
'Europe/Paris', |
| 74 |
); |
| 75 |
|
| 76 |
$CONF['nav_custom_buttons'] = array( // custom buttons, click opens the url in a new window |
| 77 |
'my label' => 'http://my.url' // remove all lines to disable (empty array) |
| 78 |
); |
| 79 |
|
| 80 |
// Database access configuration |
| 81 |
$CONF['db_type']="pg"; // choices: mysql for Mysql or pg for PostgreSQL |
| 82 |
$CONF['db_server']="oardb.luxembourg.grid5000.fr"; |
| 83 |
$CONF['db_port']="5432"; // usually 3306 for Mysql or 5432 for PostgreSQL |
| 84 |
$CONF['db_name']="oar2"; // OAR read only user account |
| 85 |
$CONF['db_user']="oarreader"; |
| 86 |
$CONF['db_passwd']="read"; |
| 87 |
$CONF['db_max_job_rows']=70000; // max number of job rows retrieved from database, which can be handled. |
| 88 |
|
| 89 |
// Data display configuration |
| 90 |
$CONF['timezone'] = "Europe/Paris"; |
| 91 |
$CONF['site'] = "Nancy"; // name for your infrastructure or site |
| 92 |
$CONF['resource_labels'] = array( // properties to describe resources (labels on the left). Must also be part of resource_hierarchy below. If empty, the base_resource will be used as label. |
| 93 |
); |
| 94 |
$CONF['cpuset_label_display_string'] = "%02d"; |
| 95 |
$CONF['label_display_regex'] = array( // shortening regex for labels (e.g. to shorten node-1.mycluster to node-1 |
| 96 |
); |
| 97 |
$CONF['label_display_functions'] = array( // functions that compute labels (e.g. to shorten node-1.mycluster to node-1 |
| 98 |
'slash_16' => function($obj) { |
| 99 |
return (long2ip(ip2long($obj->data["subnet_address"]) & (pow(2,32) - pow(2,32-substr($obj->type,6)))))."/". substr($obj->type,6); |
| 100 |
}, |
| 101 |
'slash_17' => function($obj) { |
| 102 |
return (long2ip(ip2long($obj->data["subnet_address"]) & (pow(2,32) - pow(2,32-substr($obj->type,6)))))."/". substr($obj->type,6); |
| 103 |
}, |
| 104 |
'slash_18' => function($obj) { |
| 105 |
return (long2ip(ip2long($obj->data["subnet_address"]) & (pow(2,32) - pow(2,32-substr($obj->type,6)))))."/". substr($obj->type,6); |
| 106 |
}, |
| 107 |
'slash_19' => function($obj) { |
| 108 |
return (long2ip(ip2long($obj->data["subnet_address"]) & (pow(2,32) - pow(2,32-substr($obj->type,6)))))."/". substr($obj->type,6); |
| 109 |
}, |
| 110 |
'slash_20' => function($obj) { |
| 111 |
return (long2ip(ip2long($obj->data["subnet_address"]) & (pow(2,32) - pow(2,32-substr($obj->type,6)))))."/". substr($obj->type,6); |
| 112 |
}, |
| 113 |
'slash_21' => function($obj) { |
| 114 |
return (long2ip(ip2long($obj->data["subnet_address"]) & (pow(2,32) - pow(2,32-substr($obj->type,6)))))."/". substr($obj->type,6); |
| 115 |
}, |
| 116 |
'slash_22' => function($obj) { |
| 117 |
return (long2ip(ip2long($obj->data["subnet_address"]) & (pow(2,32) - pow(2,32-substr($obj->type,6)))))."/". substr($obj->type,6); |
| 118 |
}, |
| 119 |
); |
| 120 |
$CONF['label_cmp_regex'] = array( // substring selection regex for comparing and sorting labels (resources) |
| 121 |
); |
| 122 |
|
| 123 |
$CONF['label_cmp_functions'] = array( // functions for comparing and sorting labels (resources) |
| 124 |
'slash_16' => function($obj) { |
| 125 |
return ip2long($obj->data['subnet_address']); |
| 126 |
}, |
| 127 |
'slash_17' => function($obj) { |
| 128 |
return ip2long($obj->data['subnet_address']); |
| 129 |
}, |
| 130 |
'slash_18' => function($obj) { |
| 131 |
return ip2long($obj->data['subnet_address']); |
| 132 |
}, |
| 133 |
'slash_19' => function($obj) { |
| 134 |
return ip2long($obj->data['subnet_address']); |
| 135 |
}, |
| 136 |
'slash_20' => function($obj) { |
| 137 |
return ip2long($obj->data['subnet_address']); |
| 138 |
}, |
| 139 |
'slash_21' => function($obj) { |
| 140 |
return ip2long($obj->data['subnet_address']); |
| 141 |
}, |
| 142 |
'slash_22' => function($obj) { |
| 143 |
return ip2long($obj->data['subnet_address']); |
| 144 |
}, |
| 145 |
); |
| 146 |
|
| 147 |
$CONF['resource_properties'] = array( // properties to display in the pop-up on top of the resources labels (on the left) |
| 148 |
'subnet_address', 'subnet_prefix', |
| 149 |
); |
| 150 |
|
| 151 |
$CONF['resource_hierarchy'] = array( // properties to use to build the resource hierarchy drawing |
| 152 |
'slash_16', 'slash_17', 'slash_18', 'slash_19', 'slash_20', 'slash_21', 'slash_22', |
| 153 |
); |
| 154 |
$CONF['resource_base'] = "slash_22"; // base resource of the hierarchy/grid |
| 155 |
$CONF['resource_group_level'] = "slash_16"; // level of resources to separate with blue lines in the grid |
| 156 |
$CONF['resource_drain_property'] = "drain"; // if set, must also be one of the resource_properties above to activate the functionnality |
| 157 |
$CONF['state_colors'] = array( // colors for the states of the resources in the gantt |
| 158 |
'Absent' => 'url(#absentPattern)', 'Suspected' => 'url(#suspectedPattern)', 'Dead' => 'url(#deadPattern)', 'Standby' => 'url(#standbyPattern)', 'Drain' => 'url(#drainPattern)'); |
| 159 |
$CONF['job_colors'] = array( // colors for the types of the jobs in the gantt |
| 160 |
'besteffort' => 'url(#besteffortPattern)', |
| 161 |
'deploy(=\w)?' => 'url(#deployPattern)', |
| 162 |
'container(=\w+)?' => 'url(#containerPattern)', |
| 163 |
'timesharing=(\*|user),(\*|name)' => 'url(#timesharingPattern)', |
| 164 |
'placeholder=\w+' => 'url(#placeholderPattern)', |
| 165 |
); |
| 166 |
$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 |
| 167 |
$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 |
| 168 |
|
| 169 |
// Geometry customization |
| 170 |
$CONF['hierarchy_resource_width'] = 10; // default: 10 |
| 171 |
$CONF['scale'] = 10; // default: 10 |
| 172 |
$CONF['text_scale'] = 10; // default: 10 |
| 173 |
$CONF['time_ruler_scale'] = 6; // default: 6 |
| 174 |
$CONF['time_ruler_steps'] = array(60,120,180,300,600,1200,1800,3600,7200,10800,21600,28800,43200,86400,172800,259200,604800); |
| 175 |
$CONF['gantt_top'] = 50; // default: 50 |
| 176 |
$CONF['bottom_margin'] = 45; // default: 45 |
| 177 |
$CONF['right_margin'] = 30; // default 30 |
| 178 |
$CONF['label_right_align'] = 105; // default: 105 |
| 179 |
$CONF['hierarchy_left_align'] = 110; // default: 110 |
| 180 |
$CONF['gantt_left_align'] = 160; // default: 160 |
| 181 |
$CONF['gantt_min_width'] = 900; // default: 900 |
| 182 |
$CONF['gantt_min_height'] = 100; // default: 100 |
| 183 |
$CONF['gantt_min_job_width_for_label'] = 40; // default: 40 |
| 184 |
$CONF['min_state_duration'] = 2; // default: 2 |
| 185 |
|
| 186 |
// Colors and fill patterns for jobs and states |
| 187 |
$CONF['job_color_saturation_lightness'] = "75%,75%"; // default: "75%,75%" |
| 188 |
$CONF['job_color_saturation_lightness_highlight'] = "50%,50%"; // default: "50%,50%" |
| 189 |
$CONF['static_patterns'] = <<<EOT |
| 190 |
<pattern id="absentPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" > |
| 191 |
<polygon points="0,0 3,0 0,3" fill="#0000ff" stroke="#0000ff" stroke-width="1" /> |
| 192 |
<polygon points="7,0 10,0 10,3 3,10 0,10 0,7" fill="#0000ff" stroke="#0000ff" stroke-width="1" /> |
| 193 |
<polygon points="10,7 10,10 7,10" fill="#0000ff" stroke="#0000ff" stroke-width="1" /> |
| 194 |
</pattern> |
| 195 |
<pattern id="suspectedPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" > |
| 196 |
<polygon points="0,0 3,0 0,3" fill="#ff0000" stroke="#ff0000" stroke-width="1" /> |
| 197 |
<polygon points="7,0 10,0 10,3 3,10 0,10 0,7" fill="#ff0000" stroke="#ff0000" stroke-width="1" /> |
| 198 |
<polygon points="10,7 10,10 7,10" fill="#ff0000" stroke="#ff0000" stroke-width="1" /> |
| 199 |
</pattern> |
| 200 |
<pattern id="deadPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" > |
| 201 |
<polygon points="0,0 3,0 0,3" fill="#404040" stroke="#404040" stroke-width="1" /> |
| 202 |
<polygon points="7,0 10,0 10,3 3,10 0,10 0,7" fill="#404040" stroke="#404040" stroke-width="1" /> |
| 203 |
<polygon points="10,7 10,10 7,10" fill="#404040" stroke="#404040" stroke-width="1" /> |
| 204 |
</pattern> |
| 205 |
<pattern id="standbyPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" > |
| 206 |
<polygon points="0,0 3,0 0,3" fill="#88ffff" stroke="#88ffff" stroke-width="1" /> |
| 207 |
<polygon points="7,0 10,0 10,3 3,10 0,10 0,7" fill="#88ffff" stroke="#88ffff" stroke-width="1" /> |
| 208 |
<polygon points="10,7 10,10 7,10" fill="#88ffff" stroke="#88ffff" stroke-width="1" /> |
| 209 |
</pattern> |
| 210 |
<pattern id="drainPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="15" height="10" viewBox="0 0 10 10" > |
| 211 |
<circle cx="5" cy="5" r="4" fill="#ff0000" stroke="#ff0000" stroke-width="1" /> |
| 212 |
<line x1="2" y1="5" x2="9" y2="5" stroke="#ffffff" stroke-width="2" /> |
| 213 |
</pattern> |
| 214 |
<pattern id="containerPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" > |
| 215 |
<text font-size="10" x="0" y="20" fill="#888888">C</text> |
| 216 |
</pattern> |
| 217 |
<pattern id="besteffortPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" > |
| 218 |
<text font-size="10" x="10" y="20" fill="#888888">B</text> |
| 219 |
</pattern> |
| 220 |
<pattern id="placeholderPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" > |
| 221 |
<text font-size="10" x="10" y="20" fill="#888888">P</text> |
| 222 |
</pattern> |
| 223 |
<pattern id="deployPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" > |
| 224 |
<text font-size="10" x="10" y="10" fill="#888888">D</text> |
| 225 |
</pattern> |
| 226 |
<pattern id="timesharingPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="20" height="20" viewBox="0 0 20 20" > |
| 227 |
<text font-size="10" x="10" y="20" fill="#888888">T</text> |
| 228 |
</pattern> |
| 229 |
EOT; |
| 230 |
|
| 231 |
// Standby state display options for the part shown in the future |
| 232 |
$CONF['standby_truncate_state_to_now'] = 1; // default: 1 |
| 233 |
// Besteffort job display options for the part shown in the future |
| 234 |
$CONF['besteffort_truncate_job_to_now'] = 1; // default: 1 |
| 235 |
$CONF['besteffort_pattern'] = <<<EOT |
| 236 |
<pattern id="%%PATTERN_ID%%" patternUnits="userSpaceOnUse" x="0" y="0" width="10" height="10" viewBox="0 0 10 10" > |
| 237 |
<polygon points="0,0 7,0 10,5 7,10 0,10 3,5" fill="%%PATTERN_COLOR%%" stroke-width="0"/> |
| 238 |
</pattern>' |
| 239 |
EOT; |
| 240 |
|
| 241 |
// Advanced customization for the computation of the colors of the jobs |
| 242 |
// Uncomment and adapt the following to override the default function |
| 243 |
//class MyShuffle extends Shuffle { |
| 244 |
// // Default function: get the color's hue value as a function of the job_id |
| 245 |
// function job2int($job) { |
| 246 |
// // compute a suffled number for job_id, so that colors are not too close |
| 247 |
// $magic_number = (1+sqrt(5))/2; |
| 248 |
// return (int)(360 * fmod($job->job_id * $magic_number, 1)); |
| 249 |
// } |
| 250 |
// // Other example: get the color's hue value as a function of the job_user value |
| 251 |
// protected $cache = array(); |
| 252 |
// function job2int($job) { |
| 253 |
// // shuffled number based on the job_user: |
| 254 |
// if (! array_key_exists($job->job_user, $this->cache)) { |
| 255 |
// $n = (int) base_convert(substr(md5($job->job_user) ,0, 5), 16, 10); |
| 256 |
// $magic_number = (1+sqrt(5))/2; |
| 257 |
// $this->cache[$job->job_user] = (int)(360 * fmod($n * $magic_number, 1)); |
| 258 |
// } |
| 259 |
// return $this->cache[$job->job_user]; |
| 260 |
// } |
| 261 |
//} |
| 262 |
//Shuffle::init(new MyShuffle()); // this line must be uncommented for the overiding to take effect |
| 263 |
|
| 264 |
// Minimum timespan the gantt can handle |
| 265 |
$CONF['min_timespan']= 480; // gantt does not show if (stop date - start date) < 8 minutes |
| 266 |
|
| 267 |
// Debugging |
| 268 |
$CONF['debug'] = 5; // Set to > 0 to enable debug prints in the web server error logs |
| 269 |
|
| 270 |
?> |