Hey Guys,

  Thanks for the patches - it looks like Eric Enns came up with similar ones a while back (http://dev.list.galaxyproject.org/Patch-in-reference-to-trello-card-968-td4660438.html). The bad news is I just went through and made a bunch PEP-8 fixes to the reports code so all the patches are potentially invalid now - the good news is I followed up with an alternative fix that should maintain the current behavior for postgres but also work with MySQL based on your patches (https://bitbucket.org/galaxy/galaxy-central/commits/ce2776f88e9db53886b8879a948b19ce2a513835) - so hopefully Galaxy will work without modification with the next release (March I suppose).

Thanks again!

-John

P.S. Like Hans said though - if you can migrate Galaxy off MySQL take the opportunity to do so though.


On Thu, Feb 5, 2015 at 12:00 PM, Fernandez Edgar <edgar.fernandez@umontreal.ca> wrote:

Here’s some other modifications I’ve made that should be logged somewhere :

 

diff workflows.py ARCHIVES/workflows.py_20150205_11.37.57

143c143

<         q = sa.select( ( sa.func.date( model.StoredWorkflow.table.c.create_time ).label( 'date' ),sa.func.count( model.StoredWorkflow.table.c.id ).label( 'total_workflows' ) ),

---

>         q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date( model.StoredWorkflow.table.c.create_time ) ).label( 'date' ),sa.func.count( model.StoredWorkflow.table.c.id ).label( 'total_workflows' ) ),

145c145

<                        group_by = [ sa.func.year ( model.StoredWorkflow.table.c.create_time ), sa.func.month ( sa.func.date( model.StoredWorkflow.table.c.create_time ) ) ],

---

>                        group_by = [ sa.func.date_trunc( 'month', sa.func.date( model.StoredWorkflow.table.c.create_time ) ) ],

177c177

<         q = sa.select( ( sa.func.date( model.StoredWorkflow.table.c.create_time ).label( 'date' ),

---

>         q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date( model.StoredWorkflow.table.c.create_time ) ).label( 'date' ),

181c181

<                        group_by = [ sa.func.year ( model.StoredWorkflow.table.c.create_time ), sa.func.month ( sa.func.date( model.StoredWorkflow.table.c.create_time ) )],

---

>                        group_by = [ sa.func.date_trunc( 'month', sa.func.date( model.StoredWorkflow.table.c.create_time ) ) ],

 

 

diff sample_tracking.py ARCHIVES/sample_tracking.py_20150205_11.37.50

136c136

<         q = sa.select( ( sa.func.date( model.Request.table.c.create_time ).label( 'date' ),sa.func.count( model.Request.table.c.id ).label( 'total' ) ),

---

>         q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date( model.Request.table.c.create_time ) ).label( 'date' ),sa.func.count( model.Request.table.c.id ).label( 'total' ) ),

138c138

<                        group_by = [ sa.func.year ( model.Request.table.c.create_time ), sa.func.month ( sa.func.date( model.Request.table.c.create_time ) ) ],

---

>                        group_by = [ sa.func.date_trunc( 'month', sa.func.date( model.Request.table.c.create_time ) ) ],

169c169

<         q = sa.select( ( sa.func.date( model.Request.table.c.create_time ).label( 'date' ),

---

>         q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date( model.Request.table.c.create_time ) ).label( 'date' ),

173c173

<                        group_by = [ sa.func.year ( model.Request.table.c.create_time ), sa.func.month ( sa.func.date( model.Request.table.c.create_time ) ) ],

---

>                        group_by = [ sa.func.date_trunc( 'month', sa.func.date( model.Request.table.c.create_time ) ) ],

 

 

 

Cordialement / Regards,

Edgar Fernandez

 

 

-----Message d'origine-----
De : Fernandez Edgar
Envoyé : February-05-15 10:55 AM
À : 'Hans-Rudolf Hotz'; galaxy-dev@bx.psu.edu
Objet : RE: [galaxy-dev] galaxy report page - server error solution?

 

Good catch on that one!

There wasn't originally the date_trunc function there but that groups the jobs by months together.

Thanks!!!

 

Cordialement / Regards,

Edgar Fernandez

 

-----Message d'origine-----

De : Hans-Rudolf Hotz [mailto:hrh@fmi.ch] Envoyé : February-05-15 10:49 AM À : Fernandez Edgar; galaxy-dev@bx.psu.edu Objet : Re: [galaxy-dev] galaxy report page - server error solution?

 

Hi again

 

for "jobs.py" I have modified the same lines as you,

               plus line 285 (group_by....)

 

for "users.py I have modified the same lines as you

 

 

Hans-Rudolf

 

 

 

On 02/05/2015 04:20 PM, Fernandez Edgar wrote:

> Actually, here’s what I came up with :

> 

> diff users.py ARCHIVES/users.py_20150205_9.28.18

> 

> 23c23

> 

> <         q = sa.select( ( sa.func.date(

> galaxy.model.User.table.c.create_time ).label( 'date' ),

> 

> ---

> 

>>         q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date(

>> galaxy.model.User.table.c.create_time ) ).label( 'date' ),

> 

> 26c26

> 

> <                        group_by = [ sa.func.year (

> galaxy.model.User.table.c.create_time ), sa.func.month (

> galaxy.model.User.table.c.create_time ) ],

> 

> ---

> 

>>                        group_by = [ sa.func.date_trunc( 'month',

>> sa.func.date( galaxy.model.User.table.c.create_time ) ) ],

> 

> 48c48

> 

> <         q = sa.select( ( sa.func.date(

> galaxy.model.User.table.c.create_time ).label( 'date' ),

> 

> ---

> 

>>         q = sa.select( ( sa.func.date_trunc( 'day', sa.func.date(

>> galaxy.model.User.table.c.create_time ) ).label( 'date' ),

> 

> 53c53

> 

> <                        group_by = [ sa.func.day( sa.func.date(

> galaxy.model.User.table.c.create_time ) ) ],

> 

> ---

> 

>>                        group_by = [ sa.func.date_trunc( 'day',

>> sa.func.date( galaxy.model.User.table.c.create_time ) ) ],

> 

> 79c79

> 

> <         q = sa.select( ( sa.func.date(

> galaxy.model.User.table.c.create_time ).label( 'date' ),

> 

> ---

> 

>>         q = sa.select( ( sa.func.date_trunc( 'day', sa.func.date(

>> galaxy.model.User.table.c.create_time ) ).label( 'date' ),

> 

> diff jobs.py ARCHIVES/jobs.py_20150205_9.28.22

> 

> 282c282

> 

> <         jobs_by_month = sa.select( ( sa.func.date(

> model.Job.table.c.create_time ).label( 'date' ),

> 

> ---

> 

>>         jobs_by_month = sa.select( ( sa.func.date_trunc( 'month',

>> model.Job.table.c.create_time ).label( 'date' ),

> 

> 315c315

> 

> <         jobs_in_error_by_month = sa.select( ( sa.func.date(

> model.Job.table.c.create_time ).label( 'date' ),

> 

> ---

> 

>>         jobs_in_error_by_month = sa.select( ( sa.func.date_trunc(

>> 'month', sa.func.date( model.Job.table.c.create_time ) ).label(

>> 'date' ),

> 

> 320c320

> 

> <                                            group_by=[ sa.func.year (

> model.Job.table.c.create_time ), sa.func.month ( sa.func.date(

> model.Job.table.c.create_time ) ) ],

> 

> ---

> 

>>                                            group_by=[

>> sa.func.date_trunc( 'month', sa.func.date(

>> model.Job.table.c.create_time ) ) ],

> 

> 364c364

> 

> <         q = sa.select( ( sa.func.date( model.Job.table.c.create_time

> ).label( 'date' ),

> 

> ---

> 

>>         q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date(

>> model.Job.table.c.create_time ) ).label( 'date' ),

> 

> 371c371

> 

> <                        group_by=[ sa.func.year (

> model.Job.table.c.create_time ), sa.func.month ( sa.func.date(

> model.Job.table.c.create_time ) ) ],

> 

> ---

> 

>>                        group_by=[ sa.func.date_trunc( 'month',

>> sa.func.date( model.Job.table.c.create_time ) ) ],

> 

> 420c420

> 

> <         q = sa.select( ( sa.func.date( model.Job.table.c.create_time

> ).label( 'date' ),

> 

> ---

> 

>>         q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date(

>> model.Job.table.c.create_time ) ).label( 'date' ),

> 

> 425c425

> 

> <                        group_by=[ sa.func.year (

> model.Job.table.c.create_time ), sa.func.month ( sa.func.date(

> model.Job.table.c.create_time ) ) ],

> 

> ---

> 

>>                        group_by=[ sa.func.date_trunc( 'month',

>> sa.func.date( model.Job.table.c.create_time ) ) ],

> 

> Let me know what you think!!!

> 

> Cordialement / Regards,

> 

> Edgar Fernandez

> 

> *De :*Fernandez Edgar

> *Envoyé :* February-05-15 9:49 AM

> *À :* 'galaxy-dev@bx.psu.edu'

> *Objet :* galaxy report page - server error solution?

> 

> Hello guys,

> 

> So I’ve been working on the Galaxy report page.

> 

> It works fine however I’m using MySQL and I’m getting some server

> errors on some webpages.

> 

> I found the solution:

> https://lists.galaxyproject.org/pipermail/galaxy-dev/2009-August/00064

> 1.html

> 

> But can some please confirm the following:

> 

> 1.The location of the files users.py and jobs.py is

> /home/galaxy/galaxy-prod/lib/galaxy/webapps/reports/controllers

> 

> 2.There is three (3) "select closes" using five (5) "date_trunc"

> functions in users.py.

> 

> 3.There is eight (8) "select closes" using fourteen (4) "date_trunc"

> functions in jobs.py.

> 

> 4.Here is an example of what I can come up with. Is it correct?

> 

> ·WRONG:

> 

> jobs_in_error_by_month = sa.select( ( sa.func.date_trunc( 'month',

> sa.func.date( model.Job.table.c.create_time ) ).label( 'date' ),

> sa.func.count( model.Job.table.c.id ).label('total_jobs' ) ),

> 

> whereclause=sa.and_ ( model.Job.table.c.state == 'error',

> 

> model.Job.table.c.user_id != monitor_user_id ),

> 

> from_obj=[ model.Job.table ],

> 

> group_by=[ sa.func.date_trunc( 'month', sa.func.date(

> model.Job.table.c.create_time ) ) ],

> 

> order_by=[ sa.desc( 'date' ) ] )

> 

> ·RIGHT:

> 

> jobs_in_error_by_month = sa.select( ( sa.func.count(

> model.Job.table.c.id ).label('total_jobs' ) ),

> 

> whereclause=sa.and_ ( model.Job.table.c.state == 'error',

> 

> model.Job.table.c.user_id != monitor_user_id ),

> 

> from_obj=[ model.Job.table ],

> 

> group_by=[ day(model.Job.table.c.create_time),

> month(model.Job.table.c.create_time),

> year(model.Job.table.c.create_time) ],

> 

> order_by=[ sa.desc( 'date' ) ] )

> 

> Cordialement / Regards,

> 

> **

> 

> *Edgar Fernandez*

> 

> System Administrator (Linux)

> 

> Direction Générale des Technologies de l'Information et de la

> Communication

> 

> (  Bur. : *1-514-343-6111 poste 16568**//*

> 

> *//*

> 

> */Université de Montréal/**//*

> 

> PAVILLON ROGER-GAUDRY, bureau X-218

> 

> 

> 

> ___________________________________________________________

> Please keep all replies on the list by using "reply all"

> in your mail client.  To manage your subscriptions to this and other

> Galaxy lists, please use the interface at:

>    https://lists.galaxyproject.org/

> 

> To search Galaxy mailing lists use the unified search at:

>    http://galaxyproject.org/search/mailinglists/

> 


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/