Fixed Renderer, to enbale multi-processing Rendering
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@688 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -5328,7 +5328,8 @@ isday</pre>
|
|||||||
<ul>
|
<ul>
|
||||||
The FHEMRENDERER module is intended to render (draw) graphics based on the FHEM Log-Files.
|
The FHEMRENDERER module is intended to render (draw) graphics based on the FHEM Log-Files.
|
||||||
This can be done either based on a timer (used in the module) or based on a direct call of GET.
|
This can be done either based on a timer (used in the module) or based on a direct call of GET.
|
||||||
The rendered graphics will be stored in a pre-defined directory with a predefined prefix of the files.
|
The rendered graphics will be stored in a pre-defined directory with a predefined prefix of the files. The renderer can also work in a multi-process mode,
|
||||||
|
which doesn't block the main FHEM-Loop.
|
||||||
<br> <br>
|
<br> <br>
|
||||||
|
|
||||||
<a name="FHEMRENDERERdefine"></a>
|
<a name="FHEMRENDERERdefine"></a>
|
||||||
@@ -5340,12 +5341,13 @@ isday</pre>
|
|||||||
Otherwise this option has no real meaning for FHEMRENDERER.<br>
|
Otherwise this option has no real meaning for FHEMRENDERER.<br>
|
||||||
<br>
|
<br>
|
||||||
As a side-effect of defining this "device" the following attributes will be set for this "device":<br>
|
As a side-effect of defining this "device" the following attributes will be set for this "device":<br>
|
||||||
plotmode gnuplot <br>
|
plotmode gnuplot <br>
|
||||||
plotsize 800,200 <br>
|
plotsize 800,200 <br>
|
||||||
refresh 00:10:00 <br>
|
refresh 00:10:00 <br>
|
||||||
room Unsorted <br>
|
room Unsorted <br>
|
||||||
status off <br>
|
status off <br>
|
||||||
tmpfile /tmp/ <br>
|
tmpfile /tmp/ <br>
|
||||||
|
multiprocess off <br>
|
||||||
<br>
|
<br>
|
||||||
NOTE: The Logfile will report (with LogLevel 2) that the FHEMRENDERER has been defined.
|
NOTE: The Logfile will report (with LogLevel 2) that the FHEMRENDERER has been defined.
|
||||||
|
|
||||||
@@ -5448,7 +5450,16 @@ isday</pre>
|
|||||||
filenames.<br/> You can specify a path to which the files will be
|
filenames.<br/> You can specify a path to which the files will be
|
||||||
rendered. If you also specify a prefix, this will be used to build the
|
rendered. If you also specify a prefix, this will be used to build the
|
||||||
resulting filename.
|
resulting filename.
|
||||||
</li><br> </li> </ul>
|
</li><br>
|
||||||
|
<li>multiprocess<br/>
|
||||||
|
This defines if the Renderer works in a multiprocessing mode.<br/>
|
||||||
|
You can set multiprocessing either to ON / OFF and the renderer will draw the
|
||||||
|
time-scheduled tasks either in multiprocessing mode, or not.
|
||||||
|
NOTE: Direct GET calls, except for a general GET (for all weblinks) will be renderer
|
||||||
|
in an interactive mode, meaning that the FHEM-Loop will be block as long as the graphics are rendered.
|
||||||
|
If you want to use multiprocessing, set the RENDERER and multiprocessing to ON and the
|
||||||
|
weblink-graphics will be rendered in the background.
|
||||||
|
</li><br></li> </ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ my $__data; # Filecontent from browser when editing a file
|
|||||||
my $__svgloaded; # Do not load the SVG twice
|
my $__svgloaded; # Do not load the SVG twice
|
||||||
my $__lastxmllist; # last time xmllist was parsed
|
my $__lastxmllist; # last time xmllist was parsed
|
||||||
my $FHEMRENDERER_tmpfile; # TempDir & File for the rendered graphics
|
my $FHEMRENDERER_tmpfile; # TempDir & File for the rendered graphics
|
||||||
|
my $__mp;
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
@@ -94,7 +95,7 @@ FHEMRENDERER_Initialize($)
|
|||||||
# $hash->{ReadFn} = "FHEMRENDERER_Read";
|
# $hash->{ReadFn} = "FHEMRENDERER_Read";
|
||||||
$hash->{DefFn} = "FHEMRENDERER_Define";
|
$hash->{DefFn} = "FHEMRENDERER_Define";
|
||||||
$hash->{UndefFn} = "FHEMRENDERER_Undef";
|
$hash->{UndefFn} = "FHEMRENDERER_Undef";
|
||||||
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 plotmode:gnuplot,gnuplot-scroll plotsize refresh tmpfile status";
|
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 plotmode:gnuplot,gnuplot-scroll plotsize refresh tmpfile status multiprocess";
|
||||||
$hash->{SetFn} = "FHEMRENDERER_Set";
|
$hash->{SetFn} = "FHEMRENDERER_Set";
|
||||||
$hash->{GetFn} = "FHEMRENDERER_Get";
|
$hash->{GetFn} = "FHEMRENDERER_Get";
|
||||||
}
|
}
|
||||||
@@ -121,6 +122,7 @@ FHEMRENDERER_Define($$)
|
|||||||
$__timeinterval = FHEMRENDERER_getAttr("refresh", "00:10:00");
|
$__timeinterval = FHEMRENDERER_getAttr("refresh", "00:10:00");
|
||||||
$__plotmode = FHEMRENDERER_getAttr("plotmode", "gnuplot");
|
$__plotmode = FHEMRENDERER_getAttr("plotmode", "gnuplot");
|
||||||
$__plotsize = FHEMRENDERER_getAttr("plotsize", "800,200");
|
$__plotsize = FHEMRENDERER_getAttr("plotsize", "800,200");
|
||||||
|
$__mp = FHEMRENDERER_getAttr("multiprocess", "off");
|
||||||
$FHEMRENDERER_tmpfile = FHEMRENDERER_getAttr("tmpfile", "/tmp/");
|
$FHEMRENDERER_tmpfile = FHEMRENDERER_getAttr("tmpfile", "/tmp/");
|
||||||
FHEMRENDERER_setAttr("status", "off");
|
FHEMRENDERER_setAttr("status", "off");
|
||||||
|
|
||||||
@@ -174,6 +176,7 @@ FHEMRENDERER_Get($@)
|
|||||||
my $ret = undef;
|
my $ret = undef;
|
||||||
my $v;
|
my $v;
|
||||||
my $t;
|
my $t;
|
||||||
|
my $pid;
|
||||||
|
|
||||||
FHEMRENDERER_parseXmlList(0);
|
FHEMRENDERER_parseXmlList(0);
|
||||||
|
|
||||||
@@ -183,8 +186,9 @@ FHEMRENDERER_Get($@)
|
|||||||
$__plotmode = FHEMRENDERER_getAttr("plotmode", "gnuplot");
|
$__plotmode = FHEMRENDERER_getAttr("plotmode", "gnuplot");
|
||||||
$__plotsize = FHEMRENDERER_getAttr("plotsize", "800,200");
|
$__plotsize = FHEMRENDERER_getAttr("plotsize", "800,200");
|
||||||
$FHEMRENDERER_tmpfile = FHEMRENDERER_getAttr("tmpfile", "/tmp/");
|
$FHEMRENDERER_tmpfile = FHEMRENDERER_getAttr("tmpfile", "/tmp/");
|
||||||
|
$__mp = FHEMRENDERER_getAttr("multiprocess", "off");
|
||||||
|
|
||||||
if (@a <= 2) {
|
if (@a <= 2) {
|
||||||
if (@a == 2) {
|
if (@a == 2) {
|
||||||
my ($p,$v) = split("=",$a[1], 2);
|
my ($p,$v) = split("=",$a[1], 2);
|
||||||
|
|
||||||
@@ -197,6 +201,16 @@ FHEMRENDERER_Get($@)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($__mp ne "off") {
|
||||||
|
$pid = fork();
|
||||||
|
if (not defined $pid) {
|
||||||
|
return ("ERROR: No MultiProcessing possible");
|
||||||
|
}
|
||||||
|
if ($pid > 0) {
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $type (sort keys %__types) {
|
foreach my $type (sort keys %__types) {
|
||||||
if($type eq "weblink") {
|
if($type eq "weblink") {
|
||||||
foreach my $d (sort keys %__devs ) {
|
foreach my $d (sort keys %__devs ) {
|
||||||
@@ -255,7 +269,11 @@ FHEMRENDERER_Get($@)
|
|||||||
} else {
|
} else {
|
||||||
return "\"get FHEMRENDERER\" needs either none, 1(pos) or 3-5 arguments ([file-name] device type logfile [pos=zoom=XX&off=YYY])";
|
return "\"get FHEMRENDERER\" needs either none, 1(pos) or 3-5 arguments ([file-name] device type logfile [pos=zoom=XX&off=YYY])";
|
||||||
}
|
}
|
||||||
return $ret;
|
if (not defined $pid) {
|
||||||
|
return $ret;
|
||||||
|
} else {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
|
|||||||
@@ -47,12 +47,15 @@ The FHEMRENDERER uses attributes to control the behaviour:
|
|||||||
room Unsorted
|
room Unsorted
|
||||||
status off
|
status off
|
||||||
tmpfile /tmp/
|
tmpfile /tmp/
|
||||||
|
multiprocess off
|
||||||
|
|
||||||
These attributes have the following meaning:
|
These attributes have the following meaning:
|
||||||
plotmode, plotsize: Control gnuplot and the desired output
|
plotmode, plotsize: Control gnuplot and the desired output
|
||||||
refresh: type HH:MM:SS, is the time-interval in which the re-rendering is done
|
refresh: type HH:MM:SS, is the time-interval in which the re-rendering is done
|
||||||
status: Tells if the timer-based re-rendering is on/off
|
status: Tells if the timer-based re-rendering is on/off
|
||||||
tmpfile: Is the path (and prefix, if given) of the graphic-files, that will be rendered
|
tmpfile: Is the path (and prefix, if given) of the graphic-files, that will be rendered
|
||||||
|
multiprocess: You can set "on" or "off". If multiprocess is "on" the time-scheduled renderings will be done in a
|
||||||
|
mutli-process manner, and FHEM will not be blocked by the rendering process.
|
||||||
|
|
||||||
NOTE: The timer-based rendering renders ONLY those fileplots, for which you have defined a WebLink !
|
NOTE: The timer-based rendering renders ONLY those fileplots, for which you have defined a WebLink !
|
||||||
See WebLink for more details on how to define.
|
See WebLink for more details on how to define.
|
||||||
@@ -88,6 +91,7 @@ DEFINE
|
|||||||
room Unsorted
|
room Unsorted
|
||||||
status off
|
status off
|
||||||
tmpfile /tmp/
|
tmpfile /tmp/
|
||||||
|
multiprocess off
|
||||||
|
|
||||||
|
|
||||||
NOTE: The Logfile will report (with LogLevel 2) that the FHEMRENDERER has been defined.
|
NOTE: The Logfile will report (with LogLevel 2) that the FHEMRENDERER has been defined.
|
||||||
@@ -169,6 +173,7 @@ ATTR
|
|||||||
refresh Timer-Interval for rerendering (HH:MM:SS)
|
refresh Timer-Interval for rerendering (HH:MM:SS)
|
||||||
status Status of the Timer (off/on)
|
status Status of the Timer (off/on)
|
||||||
tmpfile Path and prefix of for the rendered graphics (e.g. /tmp/)
|
tmpfile Path and prefix of for the rendered graphics (e.g. /tmp/)
|
||||||
|
multiprocess on / off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user