Update analysis job objects

This adds some functionality to job objects that is needed for the commands selection page. Exists now properly checks the data used for the job, and delete now works for jobs.
I think we should not tackle this right now since we are demoing tomorrow
and represents a rather large effort to do codebase-wide.  @wasade, can we
create an issue table the discussion until later (i.e., after STAMPS at
least)?


On Fri, Aug 8, 2014 at 4:56 PM, Daniel McDonald <notifications@github.com>
wrote:

> In qiita_db/job.py:
>
> >          datatype_id = convert_to_id(datatype, "data_type", conn_handler)
> >          sql = "SELECT command_id FROM qiita.command WHERE name = %s"
> >          command_id = conn_handler.execute_fetchone(sql, (command, ))[0]
> >          opts_json = dumps(options, sort_keys=True, separators=(',', ':'))
> > -        sql = ("SELECT EXISTS(SELECT * FROM  qiita.{0} WHERE data_type_id = %s"
> > -               " AND command_id = %s AND options = %s)".format(cls._table))
> > -        return conn_handler.execute_fetchone(
> > -            sql, (datatype_id, command_id, opts_json))[0]
> > +        sql = ("SELECT DISTINCT aj.analysis_id FROM qiita.analysis_job aj "
> > +               "JOIN qiita.{0} j ON aj.job_id = j.job_id WHERE j.data_type_id"
> > +               " = %s AND j.command_id = %s "
> > +               "AND j.options = %s".format(cls._table))
> > +        analyses = conn_handler.execute_fetchall(
> > +            sql, (datatype_id, command_id, opts_json))
> > +        if not analyses:
>
> Agree, though this is not the first time its been suggested...
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/biocore/qiita/pull/208/files#r16016019>.
>