Hi Peter and thank you for your answer,

I think I have misspoken when I said that I would like to retrieve the history ID from a tool.  As you suggest, I was indeed speaking about retrieving the history ID from the XML file instead.
And I agree with you that showing the history ID on the galaxy page would look terrible from a GUI point of view. :)

About your alternative suggestion, I already looked at Galaxy's environment variables (such as $__user_id__), but I don't think the history ID can be access this way.  In fact, and I could be wrong, but I've found that the only Galaxy's environment variables are : $GALAXY_HOME, ${GALAXY_DATA_INDEX_DIR}, $__new_file_path__ , $__tool_data_path__, $__root_dir__, $__datatypes_config__ , $__user_id__, $__user_email__ and $__app__.

About the $__app__ variable.. I was aware that it might be used to retrieve the history ID (even though I didn't found how to do it), but as you said, this variable is marked as "to be used in last resort and that it could go away in future releases".  So I was seeking a way to retrieve the history ID (from the XML file) that would be stable and that would not risks to become non-functional with new Galaxy releases..

Best regards,
Jean-François






From:        Peter Cock <p.j.a.cock@googlemail.com>
To:        Jean-Francois Payotte <jean-francois.payotte@dnalandmarks.ca>
Cc:        galaxy-dev@lists.bx.psu.edu
Date:        14/06/2012 09:17 AM
Subject:        Re: [galaxy-dev] How to retrieve the current history ID




On Thu, Jun 14, 2012 at 2:08 PM, Jean-Francois Payotte
<jean-francois.payotte@dnalandmarks.ca> wrote:
>
> My question is then: Is it possible, from a tool, to retrieve the history ID
> of the current history?

I think the answer is no - assuming you mean tool as in the script or
binary being executed - after all the tool might be running on a cluster
node with no direct connection to the Galaxy server. But see below...

> If not, would it be possible to make some changes in galaxy's files, that
> would make the history ID appear somewhere on the galaxy page, so
> the user could manually enter the history ID as a tool parameter?

That sounds like a horrible UI :(

I do have an alternative suggestion: Is it possible for the tool XML file
to access the history ID, just like $__user_id__ can be used to get
the user's ID etc? See this wiki page for other available information:
http://wiki.g2.bx.psu.edu/Admin/Tools/Tool%20Config%20Syntax

It is possible this can already be done via $__app__, but as noted
on the wiki that is considered a last resort and liable to change.

Peter