I think this is a bit more complicated than what I am looking for. All I am looking for is a way to get the result of this query: 
jobs = trans.sa_session.query( trans.app.model.Job ) \
                               .filter( and_( trans.app.model.Job.table.c.update_time < cutoff_time,
                                              or_( trans.app.model.Job.state == trans.app.model.Job.states.NEW,
                                                   trans.app.model.Job.state == trans.app.model.Job.states.QUEUED,
                                                   trans.app.model.Job.state == trans.app.model.Job.states.RUNNING,
                                                   trans.app.model.Job.state == trans.app.model.Job.states.UPLOAD ) ) ) \
                               .order_by( trans.app.model.Job.table.c.update_time.desc() ).all()
from the file /lib/galaxy/web/base/controllers/admin.py, without having to use the UI. Has anyone done something like this before?  

On Fri, Jan 27, 2017 at 10:03 AM, Peter Cock <p.j.a.cock@googlemail.com> wrote:
Ah - I assumed you meant from the user-facing UI, or the reports page.

I would suggest exploring the advance job metrics options, see e.g.

https://github.com/galaxyproject/galaxy/blob/dev/config/job_metrics_conf.xml.sample

I've never used it, but perhaps the backend using Collectl
(http://collectl.sourceforge.net/) would cover this?

Peter

On Fri, Jan 27, 2017 at 2:50 PM, Katherine Beaulieu
<katherine.beaulieu014@gmail.com> wrote:
> Ok so there is no way to access the galaxy object outside of galaxy? I'm
> looking for something like the 'trans' variable often seen throughout the
> Galaxy code base so that I can use sqlalchemy and make a database query.
> Thanks for replying.
> Katherine