Oh, and whatever you did in the little patch, it worked...At least I have a working version of galaxy again and the database seems to be all intact..

Thanks!

Thon

On Feb 06, 2012, at 03:52 PM, Greg Von Kuster <greg@bx.psu.edu> wrote:

Can you replace lines 75 - 86 of the file ~/lib/galaxy/model/migrate/versions/0091_add_tool_version_tables.py with the following for loop and send me your paster log?

Thanks!

    for row in result:
        tool_shed_repository_id = row[0]
        try:
            repository_metadata = from_json_string( str( row[1] ) )
            # Create a new row in the tool table for each tool included in repository.  We will NOT
            # handle tool_version_associaions because we do not have the information we need to do so.
            tools = repository_metadata.get( 'tools', [] )
            for tool_dict in tools:
                cmd = "INSERT INTO tool_version VALUES (%s, %s, %s, '%s', %s)" % \
                    ( nextval( 'tool_version' ), localtimestamp(), localtimestamp(), tool_dict[ 'guid' ], tool_shed_repository_id )
                db_session.execute( cmd )
                count += 1
        except Exception, e:
            print "Repository metadata: ", str( row[1] )
            print "Exception setting tool versions for tools in tool_shed_repository with id: ", str( tool_shed_repository_id )
            print str( e )

The lines of code you are replacing look like this:

    for row in result:
        if row[1]:
            tool_shed_repository_id = row[0]
            repository_metadata = from_json_string( str( row[1] ) )
            # Create a new row in the tool table for each tool included in repository.  We will NOT
            # handle tool_version_associaions because we do not have the information we need to do so.
            tools = repository_metadata.get( 'tools', [] )
            for tool_dict in tools:
                cmd = "INSERT INTO tool_version VALUES (%s, %s, %s, '%s', %s)" % \
                    ( nextval( 'tool_version' ), localtimestamp(), localtimestamp(), tool_dict[ 'guid' ], tool_shed_repository_id )
                db_session.execute( cmd )
                count += 1


On Feb 6, 2012, at 5:23 PM, Anthonius deBoer wrote:

I manually dropped the tool_version and tool_association table in the database and I am left with the JSON error as shown below:

90 -> 91...

Migration script to create the tool_version and tool_version_association tables and drop the tool_id_guid_map table.

Traceback (most recent call last):
  File "./scripts/manage_db.py", line 63, in <module>
    main( repository=repo, url=db_url )
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/shell.py", line 150, in main
    ret = command_func(**kwargs)
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/api.py", line 221, in upgrade
    return _migrate(url, repository, version, upgrade=True, err=err, **opts)
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/api.py", line 349, in _migrate
    schema.runchange(ver, change, changeset.step)
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/schema.py", line 184, in runchange
    change.run(self.engine, step)
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/script/py.py", line 101, in run
    func()
  File "lib/galaxy/model/migrate/versions/0091_add_tool_version_tables.py", line 78, in upgrade
    repository_metadata = from_json_string( str( row[1] ) )
  File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/__init__.py", line 384, in loads
  File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/decoder.py", line 402, in decode
  File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/decoder.py", line 420, in raw_decode
simplejson.decoder.JSONDecodeError: No JSON object could be decoded: line 1 column 0 (char 0)


On Feb 06, 2012, at 02:08 PM, Anthonius deBoer <thondeboer@me.com> wrote:

Hi Greg,

I tried the downgrade/upgrade path and got the exact same message I sent before.
I am using a postgres database that is running on local host.
I did indeed install some toolshed repositories before I tried to upgrade.
I also tried to downgrade to 89 and then upgrade, with the exact same message.

Thon

On Feb 06, 2012, at 10:51 AM, Greg Von Kuster <greg@bx.psu.edu> wrote:

Hello Thon,

Attempting to run the migration script twice to the same version always poses problems.  Can you downgrade successfully as follows?

sh manage_db.sh downgrade 90

If so, downgrade, then upgrade again and send the paster log from the clean upgrade if you see a problem.  Also:
What database are you using?  
Have you installed any tool shed repositories into your local Galaxy instance?

Thanks,

Greg


On Feb 6, 2012, at 1:32 PM, Thon Deboer wrote:

Hi,

I updated to the latest galaxy-central version but got this error when trying to upgrade...

Any ideas? It seems the table had already been created (this was the second time I run upgrade) but the JSON error was one that showed up the first time...)

Thanks

Thon

 sh manage_db.sh upgrade
90 -> 91...

Migration script to create the tool_version and tool_version_association tables and drop the tool_id_guid_map table.

0091_add_tool_version_tables DEBUG 2012-02-06 10:23:39,847 Creating tool_version table failed: (ProgrammingError) relation "tool_version" already exists
 '\nCREATE TABLE tool_version (\n\tid SERIAL NOT NULL, \n\tcreate_time TIMESTAMP WITHOUT TIME ZONE, \n\tupdate_time TIMESTAMP WITHOUT TIME ZONE, \n\ttool_id VARCHAR(255), \n\ttool_shed_repository_id INTEGER, \n\tPRIMARY KEY (id), \n\t FOREIGN KEY(tool_shed_repository_id) REFERENCES tool_shed_repository (id)\n)\n\n' {}
0091_add_tool_version_tables DEBUG 2012-02-06 10:23:39,847 Creating tool_version table failed: (ProgrammingError) relation "tool_version" already exists
 '\nCREATE TABLE tool_version (\n\tid SERIAL NOT NULL, \n\tcreate_time TIMESTAMP WITHOUT TIME ZONE, \n\tupdate_time TIMESTAMP WITHOUT TIME ZONE, \n\ttool_id VARCHAR(255), \n\ttool_shed_repository_id INTEGER, \n\tPRIMARY KEY (id), \n\t FOREIGN KEY(tool_shed_repository_id) REFERENCES tool_shed_repository (id)\n)\n\n' {}
0091_add_tool_version_tables DEBUG 2012-02-06 10:23:39,863 Creating tool_version_association table failed: (ProgrammingError) relation "tool_version_association" already exists
 '\nCREATE TABLE tool_version_association (\n\tid SERIAL NOT NULL, \n\ttool_id INTEGER NOT NULL, \n\tparent_id INTEGER NOT NULL, \n\tPRIMARY KEY (id), \n\t FOREIGN KEY(tool_id) REFERENCES tool_version (id), \n\t FOREIGN KEY(parent_id) REFERENCES tool_version (id)\n)\n\n' {}
0091_add_tool_version_tables DEBUG 2012-02-06 10:23:39,863 Creating tool_version_association table failed: (ProgrammingError) relation "tool_version_association" already exists
 '\nCREATE TABLE tool_version_association (\n\tid SERIAL NOT NULL, \n\ttool_id INTEGER NOT NULL, \n\tparent_id INTEGER NOT NULL, \n\tPRIMARY KEY (id), \n\t FOREIGN KEY(tool_id) REFERENCES tool_version (id), \n\t FOREIGN KEY(parent_id) REFERENCES tool_version (id)\n)\n\n' {}
Traceback (most recent call last):
  File "./scripts/manage_db.py", line 63, in <module>
    main( repository=repo, url=db_url )
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/shell.py", line 150, in main
    ret = command_func(**kwargs)
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/api.py", line 221, in upgrade
    return _migrate(url, repository, version, upgrade=True, err=err, **opts)
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/api.py", line 349, in _migrate
    schema.runchange(ver, change, changeset.step)
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/schema.py", line 184, in runchange
    change.run(self.engine, step)
  File "/home/tdeboer/code/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/script/py.py", line 101, in run
    func()
  File "lib/galaxy/model/migrate/versions/0091_add_tool_version_tables.py", line 78, in upgrade
    repository_metadata = from_json_string( str( row[1] ) )
  File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/__init__.py", line 384, in loads
  File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/decoder.py", line 402, in decode
  File "/home/tdeboer/code/galaxy-central/eggs/simplejson-2.1.1-py2.6-linux-x86_64-ucs2.egg/simplejson/decoder.py", line 420, in raw_decode
simplejson.decoder.JSONDecodeError: No JSON object could be decoded: line 1 column 0 (char 0)



Regards,

Thon de Boer, Ph.D.
Bioinformatics Guru
+1-650-799-6839




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