Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared Data, Data Libraries - Uncaught exception in exposed API method #1619

Closed
gad83 opened this issue Jan 29, 2016 · 15 comments
Closed

Shared Data, Data Libraries - Uncaught exception in exposed API method #1619

gad83 opened this issue Jan 29, 2016 · 15 comments

Comments

@gad83
Copy link

gad83 commented Jan 29, 2016

Hello,

When I click on Shared Data --> Data Libraries a message appears: "Uncaught exception in exposed API method" (ref. picture attached).

Here is the logs:
192.168.0.1 - - [29/Jan/2016:13:13:18 -0400] "GET /galaxy-prod/library/list HTTP/1.1" 200 - "http://my.galaxy.my.network.com:8081/galaxy-prod/library/list" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36" 192.168.0.1 - - [29/Jan/2016:13:13:19 -0400] "GET /galaxy-prod/api/datatypes?extension_only=False& HTTP/1.1" 200 - "http://my.galaxy.my.network.com:8081/galaxy-prod/library/list" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36" 192.168.0.1 - - [29/Jan/2016:13:13:19 -0400] "GET /galaxy-prod/api/genomes HTTP/1.1" 200 - "http://my.galaxy.my.network.com:8081/galaxy-prod/library/list" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36" galaxy.web.framework.decorators ERROR 2016-01-29 13:13:19,311 Uncaught exception in exposed API method: Traceback (most recent call last): File "/home/galaxy/galaxy-prod/lib/galaxy/web/framework/decorators.py", line 260, in decorator rval = func( self, trans, *args, **kwargs) File "/home/galaxy/galaxy-prod/lib/galaxy/webapps/galaxy/api/libraries.py", line 43, in index libraries.append( self.library_manager.get_library_dict( trans, library ) ) File "/home/galaxy/galaxy-prod/lib/galaxy/managers/libraries.py", line 189, in get_library_dict library_dict[ 'create_time_pretty'] = pretty_print_time_interval( library_dict[ 'create_time' ], precise=True ) File "/home/galaxy/galaxy-prod/lib/galaxy/util/__init__.py", line 355, in pretty_print_time_interval time = datetime.strptime( time, "%Y-%m-%dT%H:%M:%S.%f" ) File "/usr/lib64/python2.6/_strptime.py", line 325, in _strptime (data_string, format)) ValueError: time data '2015-01-30T13:37:07' does not match format '%Y-%m-%dT%H:%M:%S.%f' 192.168.0.1 - - [29/Jan/2016:13:13:19 -0400] "GET /galaxy-prod/api/libraries HTTP/1.1" 500 - "http://my.galaxy.my.network.com:8081/galaxy-prod/library/list" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36"

I believe it's a simple typo (because the T is next to the %)

untitled

@gad83
Copy link
Author

gad83 commented Feb 17, 2016

If you look at the following code:
pretty_print_time_interval time = datetime.strptime( time, "%Y-%m-%dT%H:%M:%S.%f" )
you will notice an extra 'T' where it shouldn't belong.

@martenson
Copy link
Member

@gad83 I think this depends on locale because it works on our instances and in all my tests :/
I will look more into this.

@nsoranzo
Copy link
Member

@gad83 The problem is not the T, but the final .%f. What database are you using? Not PostgreSQL, I guess.

@gad83
Copy link
Author

gad83 commented Feb 17, 2016

thanks guys for the reply!
database mysql @nsoranzo

@nsoranzo
Copy link
Member

@gad83 What MySQL version? https://bugs.mysql.com/bug.php?id=8523 should be fixed in 5.6.4

@nsoranzo
Copy link
Member

@gad83 Can you try the following patch:

index d7cea71..6be669b 100644
--- a/lib/galaxy/util/__init__.py
+++ b/lib/galaxy/util/__init__.py
@@ -361,7 +361,11 @@ def pretty_print_time_interval( time=False, precise=False ):
     elif isinstance( time, datetime ):
         diff = now - time
     elif isinstance( time, string_types ):
-        time = datetime.strptime( time, "%Y-%m-%dT%H:%M:%S.%f" )
+        try:
+            time = datetime.strptime( time, "%Y-%m-%dT%H:%M:%S.%f" )
+        except ValueError:
+            # MySQL may not support microseconds precision
+            time = datetime.strptime( time, "%Y-%m-%dT%H:%M:%S" )
         diff = now - time
     else:
         diff = now - now

@martenson
Copy link
Member

@nsoranzo very defensive, very nice

@nsoranzo
Copy link
Member

@gad83 If you can confirm that the above patch works for you, I can open a pull request. What version of Galaxy are you using?

@gad83
Copy link
Author

gad83 commented Feb 18, 2016

Hello @nsoranzo

Sorry but I have another uncaught exceptions:

galaxy.web.framework.decorators ERROR 2016-02-18 14:17:43,524 Uncaught exception in exposed API method:
Traceback (most recent call last):
  File "/home/galaxy/galaxy/lib/galaxy/web/framework/decorators.py", line 260, in decorator
    rval = func( self, trans, *args, **kwargs)
  File "/home/galaxy/galaxy/lib/galaxy/webapps/galaxy/api/libraries.py", line 43, in index
    libraries.append( self.library_manager.get_library_dict( trans, library ) )
  File "/home/galaxy/galaxy/lib/galaxy/managers/libraries.py", line 189, in get_library_dict
    library_dict[ 'create_time_pretty'] = pretty_print_time_interval( library_dict[ 'create_time' ], precise=True )
  File "/home/galaxy/galaxy/lib/galaxy/util/__init__.py", line 355, in pretty_print_time_interval
    try:
  File "/usr/lib64/python2.6/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data '2015-01-30T13:37:07' does not match format '%Y-%m-%dT%H:%M:%S.%f'

@nsoranzo
Copy link
Member

@gad83 Did you restart the Galaxy instance?

@gad83
Copy link
Author

gad83 commented Feb 18, 2016

oops!
fix confirmed!
it works!

@nsoranzo
Copy link
Member

@gad83 Thanks for testing!

What version of Galaxy are you using? I want to be sure I'm fixing the release you are on.

@gad83
Copy link
Author

gad83 commented Feb 18, 2016

release_15.10

@nsoranzo
Copy link
Member

@gad83 See pull request #1761.

@martenson
Copy link
Member

fixed, thanks @nsoranzo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants