Mizzou-CBMI / COSMOS2

Python Scientific Pipeline Management System
GNU General Public License v3.0
71 stars 39 forks source link

Trying to start cosmos shell #8

Closed jakirkham closed 9 years ago

jakirkham commented 9 years ago

I tried to follow the example seen below ( http://cosmos-wfm.readthedocs.org/en/latest/shell.html#cosmos-shell ), but ran into the following error.

from cosmos import Cosmos
cosmos_app = Cosmos('sqlite:///sqlite.db')
cosmos_app.shell()

I tried creating an empty database beforehand, but that didn't fix the problem. Is there something I need to be doing to configure the database for the shell? It appears to expect some entries in the database already.

Traceback (most recent call last):
  File "./cosmos", line 10, in <module>
    cosmos_app.shell()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/cosmos/__init__.py", line 212, in shell
    executions = self.session.query(Execution).order_by('id').all()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2398, in all
    return list(self)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2515, in __iter__
    return self._execute_and_instances(context)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2530, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
    return meth(self, multiparams, params)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1332, in _handle_dbapi_exception
    exc_info
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 442, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: execution [SQL: u'SELECT execution.id AS execution_id, execution.name AS execution_name, execution.description AS execution_description, execution.successful AS execution_successful, execution.output_dir AS execution_output_dir, execution.created_on AS execution_created_on, execution.started_on AS execution_started_on, execution.finished_on AS execution_finished_on, execution.max_cpus AS execution_max_cpus, execution.max_attempts AS execution_max_attempts, execution.info AS execution_info, execution._status AS execution__status \nFROM execution ORDER BY execution.id']
egafni commented 9 years ago

You just need to do cosmos_app.initdb() to create the SQL tables

jakirkham commented 9 years ago

Thanks @egafni that works. Just to see if I am understanding this, there shouldn't be a problem running this every time one starts up the shell, correct?

jakirkham commented 9 years ago

On a separate note, I see how this starts the iPython shell, but do you have a mechanism for starting the notebook.

egafni commented 9 years ago

There's nothing magical going on with the call shell(), check out it's code it just sets up the namespace for you. Re: a notebook i always have a notebook server running on the clusters im using. I use it to debug Cosmos workflows, and analyze the data results (no need to download analysis results since the notebook is on the server)