Data_Turbine_Java_Notes - WordPress – www.wordpress.com

oralwideΔιακομιστές

17 Νοε 2013 (πριν από 3 χρόνια και 6 μήνες)

131 εμφανίσεις

Rationale: setting up a jython
-
python onramp to send data from a raw data file
(LoggerNet) to DataTurbine.

Download Java jre7 from Java’s website.

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Adding System Variable to “Path” for java

Purpose
:


Adding the Java system variable is useful, because you can simply double click the .jar file to
install the OSDT package. Once that is in
stalled,

you get a desktop Icon to launch an Apache Tomcat
Web Server with links to OSDT utilities and documentation
.


1.

Go to Start
-
> Run.

2.

Type in
sysdm.cpl

and hit enter.

3.

Navigate to the “Advanced” tab.

4.

Click Environment Variables… in the lower right corn
er.


5.

In the second white box, labeled system variables, find the variable named “Path” or “PATH”.

6.

Select Edit
*Be careful not to erase any content that’s already there*

7.

You will need to APPEND the java path to this variable if there is content there by ad
ding a
semicolon to the end.

So, for example,

depending on the location of where java was installed,

you would add:


;

C:
\
Program Files (x86)
\
Java
\
jre7
\
bin




Another set of instructions for setting the path variable.
http://www.java.com/en/download/help/path.xml


Once java is installed, then the full DataTurbine package can be ran.

1. Download DataTurbine (
http://www.dataturbine.org/content/full
-
distribution
)

2. Then, the DataTurbine install can be
double clicked
and installed

3. Once that is installed, then the next step is to connect to the server
u
sing WebTurbine

4. For testing purposes, start up the rbnbServer (
http://localhost/webTurbine/
)

Enter server Address (e.g.
localhost:3333
)

Click Start Server



Note



Configuring the on
-
ramp (jython)

1.

Install jython version 2.2.1 @
http://jyt
hon.org

2.

You’ll want to get the jython
-
installer.jar file and double click that.


3.

Once this is installed, get the LoggerNetSrc.py file at
http://code.google.com/p/oss
-
dataturbine/source/browse/#svn/trunk/apps/oss
-
jython
-
apps/src/driver

This file will load in your data, but since it’s a python file, that’s why we need jython to handle it so it
can convert it to a language the data turbine un
derstands.

4.

Next, you will want to tell LoggerNetSrc.py
and logger.py
where to find the DataTurbine service, and
also where to find your file:

a.

Edit line seven and change it to the location of your DataTurbine .jar file

makeLoadSet('DTunit', ['C:
\
\
\
\
Users
\
\
xxx
\
\
DT

\
\
rbnb.jar'])

(You can get rbnb.jar at
http://www.dataturbine.org/content/first
-
time
-
users
)

b.

Edit line 186 to tell the program where your data is.

(e.g. l
src = LoggerNetSrc('C:
\
\
\
\

Users
\
\
xxx
\
\
LoggerNet
\
\
CR1000_Table1.dat', 'C:
\
\

Users
\
\
xxx
\
\
LoggerNet
\
\
line_num.txt').

The f
irst parameter says where the i/p file is and second parameter saves the data pointer to
gracefully handle network disconnects.

5.

At this point, your DataTurbine se
rver should be running.

6.

Next, type
(This shows an example of a python script onramp used with LoggerNet)

java

jar [Path to jython.jar] LoggerNetSrc.py

(e.g. java

jar C:
\
jython2.2.1 C:
\
Users
\
xxx
\
LoggerNet
\
LogerNetSrc.py

7.

You should see data getting inserte
d message.

8.

You can now use RDV to see your data source sending data.


Linux
-

DT on linux.




Setting up WebTurbine on Linux

Make sure the JAVA_HOME path is installed… this part is always tricky.


export JAVA_HOME=/usr/bin/java


export PATH=$PATH:/usr/bin/java

(set the java bin)

Try doing those two lines, put them in root by typing


Sudo su



export JAVA_HOME=/usr/bin/java


export PATH=$PATH:/usr/bin/java

Alternatively, just add them to the startup.sh file (location below)

First make sure the default apache2 is stopped

/etc/init.d/apache2 stop

Next, you can startup the webturbine by going to

/opt/RBNB/V3.2B6/apache
-
tomcat
-
7.0.19/bin

And executing
sudo ./startup.sh

Checking to see if DataTurbine is running



Checking the logfiles in
/var/log/dataturbine/

o

tail

n 100 offramps.out



Checking the database server for table information. They go into optable_*_2011



Then, they are filtered out (QA check) for others.



Then they go to airport table



Also,
RDV

can help chec
k.


Mounting RBNB as WebDAV File System

On Windows, Map a Network Drive:

http://

144.92.62.139
/RBNB/

On linux, use the
davfs

(how to do this on linux?)

Using webDAV and webPlot and PNGplugin


Got webTurbine webDAV working by changing dt_wrapper.sh line cod
e for dataturbine to accept the
arguments “
-
a localhost:3333”. This means everything else should be localhost.


Creating custom links for my use, would be, adapting:

/opt/RBNB/V3.2B6/apache
-
tomcat
-
7.0.19/webapps/webTurbine/index.html

The webplot can
display timestamps in a few different ways:


-
newest (most recent data)


Time, current, would be 0. And duration would be “how long back”


-
oldest


-
absolute (time in seconds from 1970)

jan 2nd 2012, 0:00:00 (GMT) hours is 1325462400 on our data.

So, the
actual timestamp is 1/1/2012 at 6:00:00 PM (GMT
-
6) our local time.

In other words, the DT server records data in timezone GMT.


Why do I hav eto stay logge din fo rit to work?

Yes, use
sudo su

for it to run all the time. That way when
you log out of the us
er, then nothing will change.

WebPlot plugin bug, have to restart WebTurbine server for it to show PNG stuff corrrectly.

I didn't realize that to get to the actual plugin required the link:


http://144
.92.62.139/RBNB/
PNGPlugIn
/CrystalBog/

I was looking in documentation and didn't find that in there:

http://localhost/documentation/PlugIns/PortableNetworkG
raphicPlugIn.html


G
etting rdv. Jar to work

on linux

DOWNLOAD rdv.jar on the linux machine.

Make it an executible: chmod +x rdv.jar


Share the DT folders. Mount the folder.


Just share the folders over your local network.

Share the
\
DT
\

folder.

Add
\
M
atlab
\

to path

path(‘path’,dir)

Add rbnb.jar to java path. Javaaddpath(‘
\
dir
\
bin
\
rbnb.jar’)


You can add these two lines to matlab startup. In:

C:
\
Program Files
\
MATLAB
\
R2011b
\
toolbox
\
local
\
startupsav.m (rename to startup.m)

Sugesstions to improve DT on linux
machine

-
If DT restart
s, delete ALL line files.

#might be useful every x seconds to write to the textfile,

#because when DT randomly gets shut down it has to start over and the init phase

#won't work

-
Update logger.py to write out to the file as its
parsing a bunch of lines… maybe (not urgent)

-
properly kill the process when issuing /etc/init.d/dataturbine stop