Determining galaxy api path automatically from a tool via dynamic_options?
After uploading my beta status tool to our test toolshed, I tried installing it on another of our galaxy servers but it wasn't able to find the api endpoint url. Is there a way to automatically do this within tool forms? I was hoping to avoid hardcoding this as part of the tool installation process. I'd thought I had it automated: In tool's form, a dynamic_options param <param name="api_url" display="radio" type="drill_down" label="For user with Galaxy API Key" dynamic_options="vdb_init_tool_user(__trans__)" /> was able to pass "trans" galaxy structure so I got as far as this python: self.api_url = 'http://' + trans.request.host ... but this yeilds http://acme.com/ rather than what's needed, the path to a particular installation: http://acme.com/galaxy/ I couldn't find a way to read the /galaxylab/ setting from the (slightly dated) universe_wsgi.ini config file - without say reading the file and parsing it. Is there an __app__.config.prefix or somesuch variable where this info is? Thanks! Damion
Well host is probably not enough - it doesn't seem like a good idea to assume http right? There is the prefix and (trans.request.scheme) that could be missing. Is trans.request.base what you want? Maybe trans.request.path_url? It should be possible to recover that from trans I guess - though I don't know exactly what parts of the request you need to use. So this isn't in stable yet - but there is going to be a sanctioned way for Galaxy deployers to describe what the URL to their Galaxy instance should be for internal consumption (stuff like docker containers and Pulsar) https://bitbucket.org/natefoo/galaxy-central/commits/4348618b4b8dd5f0c6d6cca.... It will be settable in config/galaxy.ini and accessible via trans.app.config.galaxy_infrastructure_url. There is a related attribute trans.app.config.galaxy_infrastructure_url_set which if True specifies that the deployer actually filled in a value and this is not Galaxy's best guess at what URL should be used to access it. If it is false - probably best to fallback to something like trans and the request if you have it. Hope this helps some. -John On Wed, Oct 22, 2014 at 9:28 PM, Dooley, Damion <Damion.Dooley@bccdc.ca> wrote:
After uploading my beta status tool to our test toolshed, I tried installing it on another of our galaxy servers but it wasn't able to find the api endpoint url. Is there a way to automatically do this within tool forms? I was hoping to avoid hardcoding this as part of the tool installation process. I'd thought I had it automated:
In tool's form, a dynamic_options param
<param name="api_url" display="radio" type="drill_down" label="For user with Galaxy API Key" dynamic_options="vdb_init_tool_user(__trans__)" />
was able to pass "trans" galaxy structure so I got as far as this python:
self.api_url = 'http://' + trans.request.host
... but this yeilds
rather than what's needed, the path to a particular installation:
I couldn't find a way to read the /galaxylab/ setting from the (slightly dated) universe_wsgi.ini config file - without say reading the file and parsing it. Is there an __app__.config.prefix or somesuch variable where this info is?
Thanks!
Damion ___________________________________________________________ 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: http://lists.bx.psu.edu/
To search Galaxy mailing lists use the unified search at: http://galaxyproject.org/search/mailinglists/
Hi folks, It was the universe_wsgi.ini 'prefix' parameter I was needing, though yes, http/https was an issue too. Good to know that the trans.app.config.galaxy_infrastructure_url is in the works. It turns out for now - thanks Eric Raschle - that the trans.request.application_url is the magic pill, it has the complete url. self.api_url = trans.request.application_url Cheers, Damion Hsiao lab, BC Public Health Microbiology & Reference Laboratory, BC Centre for Disease Control 655 West 12th Avenue, Vancouver, British Columbia, V5Z 4R4 Canada ________________________________________ From: John Chilton [jmchilton@gmail.com] Sent: Wednesday, October 22, 2014 6:42 PM To: Dooley, Damion Cc: galaxy-dev@lists.bx.psu.edu Subject: Re: [galaxy-dev] Determining galaxy api path automatically from a tool via dynamic_options? Well host is probably not enough - it doesn't seem like a good idea to assume http right? There is the prefix and (trans.request.scheme) that could be missing. Is trans.request.base what you want? Maybe trans.request.path_url? It should be possible to recover that from trans I guess - though I don't know exactly what parts of the request you need to use. So this isn't in stable yet - but there is going to be a sanctioned way for Galaxy deployers to describe what the URL to their Galaxy instance should be for internal consumption (stuff like docker containers and Pulsar) https://bitbucket.org/natefoo/galaxy-central/commits/4348618b4b8dd5f0c6d6cca.... It will be settable in config/galaxy.ini and accessible via trans.app.config.galaxy_infrastructure_url. There is a related attribute trans.app.config.galaxy_infrastructure_url_set which if True specifies that the deployer actually filled in a value and this is not Galaxy's best guess at what URL should be used to access it. If it is false - probably best to fallback to something like trans and the request if you have it. Hope this helps some. -John
participants (2)
-
Dooley, Damion
-
John Chilton