I am trying to change the current working history using the API. In order to do so I have imported the python module requests. The python code I am running is:
import requests
requests.put('http://localhost:8080/api/histories/e144222fed44799a/set_as_current?key=ee91bee815264e77d38e16dd5ed2e5c9')
e144222fed44799a is the history id I want to set as current
ee91bee815264e77d38e16dd5ed2e5c9 is my current API key
When I run the code the following error is returned in the terminal where I am running galaxy:
galaxy.web.framework ERROR 2014-07-21 19:08:30,597 Uncaught exception in exposed API method:
Traceback (most recent call last):
File "/Users/derekgygax/Desktop/galaxy-dist/lib/galaxy/web/framework/__init__.py", line 331, in decorator
rval = func( self, trans, *args, **kwargs)
File "/Users/derekgygax/Desktop/galaxy-dist/lib/galaxy/webapps/galaxy/api/histories.py", line 139, in set_as_current
trans.history = history
File "/Users/derekgygax/Desktop/galaxy-dist/lib/galaxy/web/framework/__init__.py", line 1022, in set_history
self.galaxy_session.current_history = history
AttributeError: 'NoneType' object has no attribute 'current_history'
127.0.0.1 - - [21/Jul/2014:19:08:30 -0400] "PUT /api/histories/e144222fed44799a/set_as_current?key=ee91bee815264e77d38e16dd5ed2e5c9 HTTP/1.1" 500 - "-" "python-requests/2.3.0 CPython/2.7.5 Darwin/13.3.0"
Any help resolving this issue would be much appreciated.
Hi, dgygax.
Martin's right. This API call is used exclusively by the UI/client-side code. There's unfortunately no way to make it work purely with the API (with no browser session for the user) alone.
It's on my list to:
Is there a reason you need to set the current history? Most functionality (running tools, uploading datasets, etc.) should work using a 'history_id' parameter to specify which history you want 'to work in' (similar to the browser UI's notion of a 'current history'). Please let us know if you see something that doesn't work that way or that requires a current history.
Thanks for the report and apologies for the confusion,
Carl
We are using galaxy to automate a workflow for lab technicians. Each time they run the workflow for a given batch we want a separate history for that batch. Rather than relying on the technician to create a history we want galaxy to automatically create a history each time the workflow is run and switch to it. Do you have any suggestion for how we might accomplish this?
Ok. That should be do-able by: