From: Anthony B. <ant...@ir...> - 2009-09-02 17:51:45
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Hi!<br> After testing, I've managed to make job exec time visualization work with the following code (replace line 389 with it in src/edu/sdsc/nbcr/opal/dashboard/persistence/DBManager.java):<br> <br> }else if (dialect.equals("org.hibernate.dialect.MySQLDialect")){<br> //this is MySQL<br> query = "select jobInfo.start_time_date as date, " +<br> //number of day <br> " avg( ( last_update_date - start_time_date ) * 86400 + " +<br> //plus number of seconds (epoch returns seconds!)<br> " ( time_to_sec(last_update_time) - time_to_sec(start_time_time) )) as average " + queryTail;<br> }<br> <br> Feel free to include this in next release if it can help other users.<br> Thanks.<br> Anthony<br> <br> Anthony Bretaudeau a écrit : <blockquote cite="mid:4A9...@ir..." type="cite"> <pre wrap="">Oh yes, the exec time has a problem. I hadn't noticed that. Is this the only SQL request using local SQL dialect? In this case, something like "unix_timestamp( last_update_time - start_time_time ) as average" should work for MySQL (copying the rest of the request from PostgreSQL). If I have time, I'll try to test it. Thanks Anthony Luca Clementi a écrit : </pre> <blockquote type="cite"> <pre wrap="">Anthony Bretaudeau wrote: </pre> <blockquote type="cite"> <pre wrap="">Hi! We've had a problem using MySQL database for storing opal2 jobs data instead of the default HSQLDB. It turned out it was a timeout problem which is quite well described at the following address: <a class="moz-txt-link-freetext" href="http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/">http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/</a>. Briefly: mysql closes connection after an 8h timeout (which is quite frequent for us, but not for servers where there is more activity). We solved it by using c3p0 to manage database connection. Here is what we have done to use it: </pre> </blockquote> <pre wrap=""> Anthony, I expect the dashboard to have some problem visualizing the exec time of your jobs. Have a look at line 365: <a class="moz-txt-link-freetext" href="http://opaltoolkit.svn.sourceforge.net/viewvc/opaltoolkit/tags/opal2-core-2.0.0/src/edu/sdsc/nbcr/opal/dashboard/persistence/DBManager.java?revision=381&view=markup">http://opaltoolkit.svn.sourceforge.net/viewvc/opaltoolkit/tags/opal2-core-2.0.0/src/edu/sdsc/nbcr/opal/dashboard/persistence/DBManager.java?revision=381&view=markup</a> Unfortunately I could not find a way to make the query working using Hibernate SQL and I had to use the local SQL dialect. Given that I think we should start using some connection manager since it is also recommended by the Hibernate guys. Sincerely, Luca </pre> <blockquote type="cite"> <pre wrap="">-Added c3p0 package in $opal_sources/lib/ and modified build.xml consequently -Created $opal_sources /etc/c3p0.properties and added " c3p0.preferredTestQuery=SELECT 1; " in it. -In build.xml, after <include name="OpalState.hbm.xml"/> added <include name="c3p0.properties"/> -In $OPAL_SOURCES/etc/hibernate-opal.cfg.xml, replaced: <!-- JDBC connection pool (use the built-in) --> <!--<property name="connection.pool_size">1</property>--> By these lines: <!-- JDBC connection pool (use c3p0) --> <property name="c3p0.min_size">1</property> <property name="c3p0.max_size">20</property> <property name="c3p0.timeout">1800</property> <property name="c3p0.max_statements">50</property> <property name="c3p0.idle_test_period">1800</property> <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> Maybe it would be a good idea to include it in a future version of opal? Bye! </pre> </blockquote> </blockquote> <pre wrap=""><!----> ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. <a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/bobj-july">http://p.sf.net/sfu/bobj-july</a> _______________________________________________ Opaltoolkit-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Opa...@li...">Opa...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/opaltoolkit-users">https://lists.sourceforge.net/lists/listinfo/opaltoolkit-users</a> </pre> </blockquote> </body> </html> |