Hi again!

I was able to implement a quite dirty solution:


first I edited /lib/galaxy/model/mapping.py and extended


assign_mapper( context, User, User.table,

    properties=dict( histories=relation( History, backref="user",

order_by=desc(History.table.c.update_time) ),

                     active_histories=relation( History, primaryjoin=( ( 
History.table.c.user_id == User.table.c.id ) & ( not_( History.table.c.deleted 
) ) ), order_by=desc( History.table.c.update_time ) ),

                     galaxy_sessions=relation( GalaxySession, order_by=desc( 
GalaxySession.table.c.update_time ) ),

StoredWorkflowMenuEntry, backref="user",


collection_class=ordering_list( ?order_index? ) ),

                     _preferences=relation( UserPreference, backref="user", 

#                     addresses=relation( UserAddress,

#                                         primaryjoin=( User.table.c.id == 
UserAddress.table.c.user_id ) )

                     values=relation( FormValues,

                                      primaryjoin=( User.table.c.form_values_id 
== FormValues.table.c.id ) ),

                     api_keys=relation( APIKeys, backref="user", order_by=desc( 
APIKeys.table.c.create_time ) ),

                     ) )


by this:

currentHistory=relation( History, primaryjoin=( ( History.table.c.user_id == 
User.table.c.id ) & ( not_( History.table.c.deleted ) ) & 
(GalaxySession.table.c.current_history_id == History.table.c.id) ), 
order_by=desc( GalaxySession.table.c.update_time ) )


As far as I am correct, this selects all current histories of all sessions per 
user. These histories get sorted by the latest session change

which should always lead to the current history as the first entry.


Inside my tool I use this to get the current history id and hash it to an id 
which can be used for API calls:


${__app__.security.encode_id( ?%s? % 
$__app__.model.User.get($__user_id__).currentHistory[0].id )}


Until now everything seems to work as it should.


Finally I have another question about the histories and API. Referring to this 


Are you working on this? Updating history items via the API would be really 
helpful for my usecase. If not, can you give me some hints where I can have a 
look at to enable it by my own?


Thanks a lot!





Original Message

processed by CONSOLIDATE


[galaxy-dev] Some questions about histories


Dienstag, 14. August 2012 12:10


Sascha Kastens (s.kast...@gatc-biotech.com)

Hi all!


I have two questions about histories in Galaxy:


1. Is it possible to mark/set a history as published via the API?

2. How can I get the ID of the current users history via a tool? Something like

    ${__app__.model.User.get($__user_id__).histories[0].id} ?!



Thanks in advance!




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:


Reply via email to