Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-24 Thread Chorny, Ilya
Any more thought on how to accomplish this without  my current hack? Ideally it 
would be great if this feature could become part of galaxy-central. This is a 
feature that we would really like to implement so that our reports can link to 
the output files. 

Thanks,

Ilya


-Original Message-
From: James Taylor [mailto:ja...@jamestaylor.org] 
Sent: Friday, October 21, 2011 9:47 AM
To: Chorny, Ilya
Cc: galaxy-dev@lists.bx.psu.edu
Subject: RE: [galaxy-dev] FW: how do I pass the URL of the input and output 
files to my tool wrapper?

Excerpts from Chorny, Ilya's message of 2011-10-21 01:51:03 +:
 I get the following error from routes
 
 AttributeError: 'thread._local' object has no attribute 'mapper'

Okay, what I suspected. This is a product of the fact that job running is 
decoupled from the web frontend. The job runner doesn't necessarily live in the 
same process or even on the same machine as the web interface. You could have 
multiple web interfaces serving different base urls feeding one job runner. 

I don't have any simple answer to this. You could try to initialize route's 
mapper in the job runner, but I think this would be a big mistake. Instead you 
probably want to capture the URL somehow when the job is created. I need to 
think about it some more.
--
James Taylor, Assistant Professor, Biology / Computer Science, Emory University

___
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/


Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-21 Thread Greg Von Kuster
Ilya, you can use trans.request.host to get the base url.


On Oct 20, 2011, at 11:52 AM, Chorny, Ilya wrote:

 I thought I would add this to the list in case anyone in the galaxy :) knew 
 the answer. I get a mapping error every time I invoke  url_for. What variable 
 stores the base url for the galaxy instance?
 
 Thanks,
 
 Ilya
 
 -Original Message-
 From: Chorny, Ilya 
 Sent: Wednesday, October 19, 2011 4:21 PM
 To: 'James Taylor'
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
 to my tool wrapper?
 
 Hi James,
 
 I got the code working but I can't figure out how to set the URL. I have a 
 hack right now (i.e. url = 'http://' + socket.getfqdn() + 
 config_info.cookie_path + '/datasets/' + sec.encode_id(dataset.id) + 
 '/display/?preview=True' ).  I tried using url_for() but was unable to get 
 that to work. Attached are the diff's for the files I made changes to.
 
 If you have any suggestions on how to properly set the url please let me know.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: James Taylor [mailto:ja...@jamestaylor.org]
 Sent: Tuesday, October 18, 2011 11:38 AM
 To: Chorny, Ilya
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
 to my tool wrapper?
 
 Hi Ilya, I think any case where $__app__ is used should raise red flags, it 
 is definitely breaking abstraction. In this case, you're passing a very 
 specific implementation detail of the web layer all the way down to your tool.
 
 I think the right way to do what you want is to add a 'web_display_url'
 attribute to the class DatasetFilenameWrapper in tools/__init__.py.
 Every dataset gets wrapped by this when put into the namespace for building 
 command lines. If you added an attribute it would them be available as 
 ${input.web_display_url} in the command line template. 
 
 Historically tool wrappers were designed so that they have no knowledge of 
 the UI, allowing non-web UIs to be added on top. At this point it seems 
 unlikely that this will ever happen, but it is still a good idea to avoid 
 this kind of coupling. Otherwise we can't change how the web interface does 
 security without changing individual tools.
 
 Excerpts from Chorny, Ilya's message of 2011-10-17 22:56:40 +:
 So we came up with a work around and I wouldn't mind getting your opinion on 
 it. Specifically with respect to passing cookie_path. I could not figure out 
 how to get the proxy prefix from the universe_wsgi.ini file via the $__app__ 
 call. Also you mention in the wiki the the $__app__ may get deprecated.
 
 Thanks,
 
 Ilya
 
 
 We copied the encryption code (i.e)
 
 def encode_id(dataset_id,id_secret):
id_cipher = Blowfish.new(id_secret)
s = dataset_id
s = ( ! * ( 8 - len(s) % 8 ) ) + s
encrypted_id = id_cipher.encrypt( s ).encode( 'hex' )
return encrypted_id
 
 and we passed to the too wrapperl:
 
 -i input -i $input.dataset.id
 
 as well as
 
 --id_secret=$__app__.config.id_secret
 --cookie_path=$__app__.config.cookie_path
 
 -Original Message-
 From: Chorny, Ilya
 Sent: Monday, October 17, 2011 11:10 AM
 To: Chorny, Ilya; James Taylor
 Cc: galaxy-dev
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 Would it be difficult to add the url as an attribute of the input and output 
 parameters ($param.url)? If you point me to where these values are set, I 
 can try to make the changes to the code.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: galaxy-dev-boun...@lists.bx.psu.edu
 [mailto:galaxy-dev-boun...@lists.bx.psu.edu] On Behalf Of Chorny, Ilya
 Sent: Sunday, October 16, 2011 7:36 AM
 To: James Taylor
 Cc: galaxy-dev
 Subject: Re: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 PDF report.
 
 Sent from my iPhone
 
 On Oct 15, 2011, at 7:36 PM, James Taylor ja...@jamestaylor.org wrote:
 
 Excerpts from Chorny, Ilya's message of 2011-10-14 23:46:25 +:
 Anyone know if it possible to pass the url (shown in the eye ball) to a 
 tool wrapper?
 
 Ilya, this isn't currently supported because it breaks the 
 abstraction between the web interface and tools (tools shouldn't 
 know they are being invoked by a web application). What are you trying to 
 achieve with this?
 Is this for a tool generating an HTML report? 
 --
 James Taylor, Assistant Professor, Biology / Computer Science, Emory 
 University 
 ___
 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/
 
 ___
 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/
 --
 James Taylor, Assistant 

Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-21 Thread Chorny, Ilya
I need the base_url and the proxy. That is why I am using cookie_path. Any 
thoughts on how to get both.

Thanks,

Ilya


-Original Message-
From: Greg Von Kuster [mailto:g...@bx.psu.edu] 
Sent: Friday, October 21, 2011 6:11 AM
To: Chorny, Ilya
Cc: galaxy-dev@lists.bx.psu.edu
Subject: Re: [galaxy-dev] FW: how do I pass the URL of the input and output 
files to my tool wrapper?

Ilya, you can use trans.request.host to get the base url.


On Oct 20, 2011, at 11:52 AM, Chorny, Ilya wrote:

 I thought I would add this to the list in case anyone in the galaxy :) knew 
 the answer. I get a mapping error every time I invoke  url_for. What variable 
 stores the base url for the galaxy instance?
 
 Thanks,
 
 Ilya
 
 -Original Message-
 From: Chorny, Ilya
 Sent: Wednesday, October 19, 2011 4:21 PM
 To: 'James Taylor'
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
 to my tool wrapper?
 
 Hi James,
 
 I got the code working but I can't figure out how to set the URL. I have a 
 hack right now (i.e. url = 'http://' + socket.getfqdn() + 
 config_info.cookie_path + '/datasets/' + sec.encode_id(dataset.id) + 
 '/display/?preview=True' ).  I tried using url_for() but was unable to get 
 that to work. Attached are the diff's for the files I made changes to.
 
 If you have any suggestions on how to properly set the url please let me know.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: James Taylor [mailto:ja...@jamestaylor.org]
 Sent: Tuesday, October 18, 2011 11:38 AM
 To: Chorny, Ilya
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
 to my tool wrapper?
 
 Hi Ilya, I think any case where $__app__ is used should raise red flags, it 
 is definitely breaking abstraction. In this case, you're passing a very 
 specific implementation detail of the web layer all the way down to your tool.
 
 I think the right way to do what you want is to add a 'web_display_url'
 attribute to the class DatasetFilenameWrapper in tools/__init__.py.
 Every dataset gets wrapped by this when put into the namespace for building 
 command lines. If you added an attribute it would them be available as 
 ${input.web_display_url} in the command line template. 
 
 Historically tool wrappers were designed so that they have no knowledge of 
 the UI, allowing non-web UIs to be added on top. At this point it seems 
 unlikely that this will ever happen, but it is still a good idea to avoid 
 this kind of coupling. Otherwise we can't change how the web interface does 
 security without changing individual tools.
 
 Excerpts from Chorny, Ilya's message of 2011-10-17 22:56:40 +:
 So we came up with a work around and I wouldn't mind getting your opinion on 
 it. Specifically with respect to passing cookie_path. I could not figure out 
 how to get the proxy prefix from the universe_wsgi.ini file via the $__app__ 
 call. Also you mention in the wiki the the $__app__ may get deprecated.
 
 Thanks,
 
 Ilya
 
 
 We copied the encryption code (i.e)
 
 def encode_id(dataset_id,id_secret):
id_cipher = Blowfish.new(id_secret)
s = dataset_id
s = ( ! * ( 8 - len(s) % 8 ) ) + s
encrypted_id = id_cipher.encrypt( s ).encode( 'hex' )
return encrypted_id
 
 and we passed to the too wrapperl:
 
 -i input -i $input.dataset.id
 
 as well as
 
 --id_secret=$__app__.config.id_secret
 --cookie_path=$__app__.config.cookie_path
 
 -Original Message-
 From: Chorny, Ilya
 Sent: Monday, October 17, 2011 11:10 AM
 To: Chorny, Ilya; James Taylor
 Cc: galaxy-dev
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 Would it be difficult to add the url as an attribute of the input and output 
 parameters ($param.url)? If you point me to where these values are set, I 
 can try to make the changes to the code.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: galaxy-dev-boun...@lists.bx.psu.edu
 [mailto:galaxy-dev-boun...@lists.bx.psu.edu] On Behalf Of Chorny, 
 Ilya
 Sent: Sunday, October 16, 2011 7:36 AM
 To: James Taylor
 Cc: galaxy-dev
 Subject: Re: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 PDF report.
 
 Sent from my iPhone
 
 On Oct 15, 2011, at 7:36 PM, James Taylor ja...@jamestaylor.org wrote:
 
 Excerpts from Chorny, Ilya's message of 2011-10-14 23:46:25 +:
 Anyone know if it possible to pass the url (shown in the eye ball) to a 
 tool wrapper?
 
 Ilya, this isn't currently supported because it breaks the 
 abstraction between the web interface and tools (tools shouldn't 
 know they are being invoked by a web application). What are you trying to 
 achieve with this?
 Is this for a tool generating an HTML report? 
 --
 James Taylor, Assistant Professor, Biology / Computer Science, Emory 
 University 
 ___
 Please keep all replies on the list by using reply all
 in your mail client.  To manage your 

Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-21 Thread Chorny, Ilya
Also, I do not have access to trans in the Tools class in 
lib/galaxy/tools/__init__.py.

Thanks,

Ilya


-Original Message-
From: galaxy-dev-boun...@lists.bx.psu.edu 
[mailto:galaxy-dev-boun...@lists.bx.psu.edu] On Behalf Of Chorny, Ilya
Sent: Friday, October 21, 2011 8:40 AM
To: Greg Von Kuster
Cc: galaxy-dev@lists.bx.psu.edu
Subject: Re: [galaxy-dev] FW: how do I pass the URL of the input and output 
files to my tool wrapper?

I need the base_url and the proxy. That is why I am using cookie_path. Any 
thoughts on how to get both.

Thanks,

Ilya


-Original Message-
From: Greg Von Kuster [mailto:g...@bx.psu.edu]
Sent: Friday, October 21, 2011 6:11 AM
To: Chorny, Ilya
Cc: galaxy-dev@lists.bx.psu.edu
Subject: Re: [galaxy-dev] FW: how do I pass the URL of the input and output 
files to my tool wrapper?

Ilya, you can use trans.request.host to get the base url.


On Oct 20, 2011, at 11:52 AM, Chorny, Ilya wrote:

 I thought I would add this to the list in case anyone in the galaxy :) knew 
 the answer. I get a mapping error every time I invoke  url_for. What variable 
 stores the base url for the galaxy instance?
 
 Thanks,
 
 Ilya
 
 -Original Message-
 From: Chorny, Ilya
 Sent: Wednesday, October 19, 2011 4:21 PM
 To: 'James Taylor'
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
 to my tool wrapper?
 
 Hi James,
 
 I got the code working but I can't figure out how to set the URL. I have a 
 hack right now (i.e. url = 'http://' + socket.getfqdn() + 
 config_info.cookie_path + '/datasets/' + sec.encode_id(dataset.id) + 
 '/display/?preview=True' ).  I tried using url_for() but was unable to get 
 that to work. Attached are the diff's for the files I made changes to.
 
 If you have any suggestions on how to properly set the url please let me know.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: James Taylor [mailto:ja...@jamestaylor.org]
 Sent: Tuesday, October 18, 2011 11:38 AM
 To: Chorny, Ilya
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
 to my tool wrapper?
 
 Hi Ilya, I think any case where $__app__ is used should raise red flags, it 
 is definitely breaking abstraction. In this case, you're passing a very 
 specific implementation detail of the web layer all the way down to your tool.
 
 I think the right way to do what you want is to add a 'web_display_url'
 attribute to the class DatasetFilenameWrapper in tools/__init__.py.
 Every dataset gets wrapped by this when put into the namespace for building 
 command lines. If you added an attribute it would them be available as 
 ${input.web_display_url} in the command line template. 
 
 Historically tool wrappers were designed so that they have no knowledge of 
 the UI, allowing non-web UIs to be added on top. At this point it seems 
 unlikely that this will ever happen, but it is still a good idea to avoid 
 this kind of coupling. Otherwise we can't change how the web interface does 
 security without changing individual tools.
 
 Excerpts from Chorny, Ilya's message of 2011-10-17 22:56:40 +:
 So we came up with a work around and I wouldn't mind getting your opinion on 
 it. Specifically with respect to passing cookie_path. I could not figure out 
 how to get the proxy prefix from the universe_wsgi.ini file via the $__app__ 
 call. Also you mention in the wiki the the $__app__ may get deprecated.
 
 Thanks,
 
 Ilya
 
 
 We copied the encryption code (i.e)
 
 def encode_id(dataset_id,id_secret):
id_cipher = Blowfish.new(id_secret)
s = dataset_id
s = ( ! * ( 8 - len(s) % 8 ) ) + s
encrypted_id = id_cipher.encrypt( s ).encode( 'hex' )
return encrypted_id
 
 and we passed to the too wrapperl:
 
 -i input -i $input.dataset.id
 
 as well as
 
 --id_secret=$__app__.config.id_secret
 --cookie_path=$__app__.config.cookie_path
 
 -Original Message-
 From: Chorny, Ilya
 Sent: Monday, October 17, 2011 11:10 AM
 To: Chorny, Ilya; James Taylor
 Cc: galaxy-dev
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 Would it be difficult to add the url as an attribute of the input and output 
 parameters ($param.url)? If you point me to where these values are set, I 
 can try to make the changes to the code.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: galaxy-dev-boun...@lists.bx.psu.edu
 [mailto:galaxy-dev-boun...@lists.bx.psu.edu] On Behalf Of Chorny, 
 Ilya
 Sent: Sunday, October 16, 2011 7:36 AM
 To: James Taylor
 Cc: galaxy-dev
 Subject: Re: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 PDF report.
 
 Sent from my iPhone
 
 On Oct 15, 2011, at 7:36 PM, James Taylor ja...@jamestaylor.org wrote:
 
 Excerpts from Chorny, Ilya's message of 2011-10-14 23:46:25 +:
 Anyone know if it possible to pass the url (shown in the eye ball) to a 
 tool wrapper?
 
 Ilya, this isn't currently supported because it breaks the 
 abstraction between 

Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-21 Thread Greg Von Kuster
Ilya,

Tools are not tightly coupled to the Galaxy web framework ( they can be 
executed on the command line outside of Galaxy ) so, as you've commented, you 
don't have access to the web framework from there.  It's unclear to me what you 
are trying to do.  Can you clarify a bit more?

Greg Von Kuster

On Oct 21, 2011, at 11:43 AM, Chorny, Ilya wrote:

 Also, I do not have access to trans in the Tools class in 
 lib/galaxy/tools/__init__.py.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: galaxy-dev-boun...@lists.bx.psu.edu 
 [mailto:galaxy-dev-boun...@lists.bx.psu.edu] On Behalf Of Chorny, Ilya
 Sent: Friday, October 21, 2011 8:40 AM
 To: Greg Von Kuster
 Cc: galaxy-dev@lists.bx.psu.edu
 Subject: Re: [galaxy-dev] FW: how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 I need the base_url and the proxy. That is why I am using cookie_path. Any 
 thoughts on how to get both.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: Greg Von Kuster [mailto:g...@bx.psu.edu]
 Sent: Friday, October 21, 2011 6:11 AM
 To: Chorny, Ilya
 Cc: galaxy-dev@lists.bx.psu.edu
 Subject: Re: [galaxy-dev] FW: how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 Ilya, you can use trans.request.host to get the base url.
 
 
 On Oct 20, 2011, at 11:52 AM, Chorny, Ilya wrote:
 
 I thought I would add this to the list in case anyone in the galaxy :) knew 
 the answer. I get a mapping error every time I invoke  url_for. What 
 variable stores the base url for the galaxy instance?
 
 Thanks,
 
 Ilya
 
 -Original Message-
 From: Chorny, Ilya
 Sent: Wednesday, October 19, 2011 4:21 PM
 To: 'James Taylor'
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 Hi James,
 
 I got the code working but I can't figure out how to set the URL. I have a 
 hack right now (i.e. url = 'http://' + socket.getfqdn() + 
 config_info.cookie_path + '/datasets/' + sec.encode_id(dataset.id) + 
 '/display/?preview=True' ).  I tried using url_for() but was unable to get 
 that to work. Attached are the diff's for the files I made changes to.
 
 If you have any suggestions on how to properly set the url please let me 
 know.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: James Taylor [mailto:ja...@jamestaylor.org]
 Sent: Tuesday, October 18, 2011 11:38 AM
 To: Chorny, Ilya
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 Hi Ilya, I think any case where $__app__ is used should raise red flags, it 
 is definitely breaking abstraction. In this case, you're passing a very 
 specific implementation detail of the web layer all the way down to your 
 tool.
 
 I think the right way to do what you want is to add a 'web_display_url'
 attribute to the class DatasetFilenameWrapper in tools/__init__.py.
 Every dataset gets wrapped by this when put into the namespace for building 
 command lines. If you added an attribute it would them be available as 
 ${input.web_display_url} in the command line template. 
 
 Historically tool wrappers were designed so that they have no knowledge of 
 the UI, allowing non-web UIs to be added on top. At this point it seems 
 unlikely that this will ever happen, but it is still a good idea to avoid 
 this kind of coupling. Otherwise we can't change how the web interface does 
 security without changing individual tools.
 
 Excerpts from Chorny, Ilya's message of 2011-10-17 22:56:40 +:
 So we came up with a work around and I wouldn't mind getting your opinion 
 on it. Specifically with respect to passing cookie_path. I could not figure 
 out how to get the proxy prefix from the universe_wsgi.ini file via the 
 $__app__ call. Also you mention in the wiki the the $__app__ may get 
 deprecated.
 
 Thanks,
 
 Ilya
 
 
 We copied the encryption code (i.e)
 
 def encode_id(dataset_id,id_secret):
   id_cipher = Blowfish.new(id_secret)
   s = dataset_id
   s = ( ! * ( 8 - len(s) % 8 ) ) + s
   encrypted_id = id_cipher.encrypt( s ).encode( 'hex' )
   return encrypted_id
 
 and we passed to the too wrapperl:
 
 -i input -i $input.dataset.id
 
 as well as
 
 --id_secret=$__app__.config.id_secret
 --cookie_path=$__app__.config.cookie_path
 
 -Original Message-
 From: Chorny, Ilya
 Sent: Monday, October 17, 2011 11:10 AM
 To: Chorny, Ilya; James Taylor
 Cc: galaxy-dev
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output 
 files to my tool wrapper?
 
 Would it be difficult to add the url as an attribute of the input and 
 output parameters ($param.url)? If you point me to where these values are 
 set, I can try to make the changes to the code.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: galaxy-dev-boun...@lists.bx.psu.edu
 [mailto:galaxy-dev-boun...@lists.bx.psu.edu] On Behalf Of Chorny, 
 Ilya
 Sent: Sunday, October 16, 2011 7:36 AM
 To: James Taylor
 Cc: galaxy-dev
 Subject: Re: [galaxy-dev] how do I pass the URL of the 

Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-21 Thread James Taylor
Excerpts from Chorny, Ilya's message of 2011-10-21 01:51:03 +:
 I get the following error from routes
 
 AttributeError: 'thread._local' object has no attribute 'mapper'

Okay, what I suspected. This is a product of the fact that job running
is decoupled from the web frontend. The job runner doesn't necessarily
live in the same process or even on the same machine as the web
interface. You could have multiple web interfaces serving different base
urls feeding one job runner. 

I don't have any simple answer to this. You could try to initialize
route's mapper in the job runner, but I think this would be a big
mistake. Instead you probably want to capture the URL somehow when the
job is created. I need to think about it some more.
-- 
James Taylor, Assistant Professor, Biology / Computer Science, Emory University
___
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/


Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-21 Thread James Taylor
Excerpts from Chorny, Ilya's message of 2011-10-21 15:43:35 +:
 Also, I do not have access to trans in the Tools class in 
 lib/galaxy/tools/__init__.py.

'trans' is the state of a web transaction (a single request response
cycle). It is this only accessible for code that occurs within that
scope. For tools/__init__.py there are some methods that have access and
some that don't, it depends on how they are called (all the user
interface generation related code has access to trans for example). 


-- 
James Taylor, Assistant Professor, Biology / Computer Science, Emory University
___
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/


[galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-20 Thread Chorny, Ilya
I thought I would add this to the list in case anyone in the galaxy :) knew the 
answer. I get a mapping error every time I invoke  url_for. What variable 
stores the base url for the galaxy instance?

Thanks,

Ilya

-Original Message-
From: Chorny, Ilya 
Sent: Wednesday, October 19, 2011 4:21 PM
To: 'James Taylor'
Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
to my tool wrapper?

Hi James,

I got the code working but I can't figure out how to set the URL. I have a hack 
right now (i.e. url = 'http://' + socket.getfqdn() + config_info.cookie_path + 
'/datasets/' + sec.encode_id(dataset.id) + '/display/?preview=True' ).  I tried 
using url_for() but was unable to get that to work. Attached are the diff's for 
the files I made changes to.

If you have any suggestions on how to properly set the url please let me know.

Thanks,

Ilya


-Original Message-
From: James Taylor [mailto:ja...@jamestaylor.org]
Sent: Tuesday, October 18, 2011 11:38 AM
To: Chorny, Ilya
Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
to my tool wrapper?

Hi Ilya, I think any case where $__app__ is used should raise red flags, it is 
definitely breaking abstraction. In this case, you're passing a very specific 
implementation detail of the web layer all the way down to your tool.

I think the right way to do what you want is to add a 'web_display_url'
attribute to the class DatasetFilenameWrapper in tools/__init__.py.
Every dataset gets wrapped by this when put into the namespace for building 
command lines. If you added an attribute it would them be available as 
${input.web_display_url} in the command line template. 

Historically tool wrappers were designed so that they have no knowledge of the 
UI, allowing non-web UIs to be added on top. At this point it seems unlikely 
that this will ever happen, but it is still a good idea to avoid this kind of 
coupling. Otherwise we can't change how the web interface does security without 
changing individual tools.

Excerpts from Chorny, Ilya's message of 2011-10-17 22:56:40 +:
 So we came up with a work around and I wouldn't mind getting your opinion on 
 it. Specifically with respect to passing cookie_path. I could not figure out 
 how to get the proxy prefix from the universe_wsgi.ini file via the $__app__ 
 call. Also you mention in the wiki the the $__app__ may get deprecated.
 
 Thanks,
 
 Ilya
 
 
 We copied the encryption code (i.e)
 
 def encode_id(dataset_id,id_secret):
 id_cipher = Blowfish.new(id_secret)
 s = dataset_id
 s = ( ! * ( 8 - len(s) % 8 ) ) + s
 encrypted_id = id_cipher.encrypt( s ).encode( 'hex' )
 return encrypted_id
 
 and we passed to the too wrapperl:
 
 -i input -i $input.dataset.id
 
 as well as
 
 --id_secret=$__app__.config.id_secret
 --cookie_path=$__app__.config.cookie_path
 
 -Original Message-
 From: Chorny, Ilya
 Sent: Monday, October 17, 2011 11:10 AM
 To: Chorny, Ilya; James Taylor
 Cc: galaxy-dev
 Subject: RE: [galaxy-dev] how do I pass the URL of the input and output files 
 to my tool wrapper?
 
 Would it be difficult to add the url as an attribute of the input and output 
 parameters ($param.url)? If you point me to where these values are set, I can 
 try to make the changes to the code.
 
 Thanks,
 
 Ilya
 
 
 -Original Message-
 From: galaxy-dev-boun...@lists.bx.psu.edu
 [mailto:galaxy-dev-boun...@lists.bx.psu.edu] On Behalf Of Chorny, Ilya
 Sent: Sunday, October 16, 2011 7:36 AM
 To: James Taylor
 Cc: galaxy-dev
 Subject: Re: [galaxy-dev] how do I pass the URL of the input and output files 
 to my tool wrapper?
 
 PDF report.
 
 Sent from my iPhone
 
 On Oct 15, 2011, at 7:36 PM, James Taylor ja...@jamestaylor.org wrote:
 
  Excerpts from Chorny, Ilya's message of 2011-10-14 23:46:25 +:
  Anyone know if it possible to pass the url (shown in the eye ball) to a 
  tool wrapper?
  
  Ilya, this isn't currently supported because it breaks the 
  abstraction between the web interface and tools (tools shouldn't 
  know they are being invoked by a web application). What are you trying to 
  achieve with this?
  Is this for a tool generating an HTML report? 
  --
  James Taylor, Assistant Professor, Biology / Computer Science, Emory 
  University 
  ___
  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/
 
 ___
 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/
--
James Taylor, Assistant Professor, Biology / Computer Science, Emory University


lib.galaxy.tools.__init__.py.diff
Description: lib.galaxy.tools.__init__.py.diff



Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-20 Thread James Taylor
Excerpts from Chorny, Ilya's message of 2011-10-20 15:52:03 +:
 I thought I would add this to the list in case anyone in the galaxy :)
 knew the answer. I get a mapping error every time I invoke  url_for.
 What variable stores the base url for the galaxy instance?

Can you provide the specific error you get from url_for? There is no
single variable that stores the app url, it is constructed from the
routing system which url_for is connected to. If you look in
form_builder.py for example you can see the use of url_for from non
template code.
-- 
James Taylor, Assistant Professor, Biology / Computer Science, Emory University
___
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/


Re: [galaxy-dev] FW: how do I pass the URL of the input and output files to my tool wrapper?

2011-10-20 Thread Chorny, Ilya
I get the following error from routes

AttributeError: 'thread._local' object has no attribute 'mapper'

-Original Message-
From: James Taylor [mailto:ja...@jamestaylor.org] 
Sent: Thursday, October 20, 2011 5:46 PM
To: Chorny, Ilya
Cc: galaxy-dev@lists.bx.psu.edu
Subject: Re: [galaxy-dev] FW: how do I pass the URL of the input and output 
files to my tool wrapper?

Excerpts from Chorny, Ilya's message of 2011-10-20 15:52:03 +:
 I thought I would add this to the list in case anyone in the galaxy :) 
 knew the answer. I get a mapping error every time I invoke  url_for.
 What variable stores the base url for the galaxy instance?

Can you provide the specific error you get from url_for? There is no single 
variable that stores the app url, it is constructed from the routing system 
which url_for is connected to. If you look in form_builder.py for example you 
can see the use of url_for from non template code.
--
James Taylor, Assistant Professor, Biology / Computer Science, Emory University

___
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/