コード例 #1
0
ファイル: analysis_handlers.py プロジェクト: zonca/qiita
    def post(self, analysis_id):
        analysis_id = int(analysis_id)
        rarefaction_depth = self.get_argument('rarefaction-depth')
        # convert to integer if rarefaction level given
        if rarefaction_depth:
            rarefaction_depth = int(rarefaction_depth)
        else:
            rarefaction_depth = None
        analysis = Analysis(analysis_id)
        check_analysis_access(self.current_user, analysis)

        command_args = self.get_arguments("commands")
        split = [x.split("#") for x in command_args]

        moi_user_id = get_id_from_user(self.current_user.id)
        moi_group = create_info(analysis_id, 'group', url='/analysis/',
                                parent=moi_user_id, store=True)
        moi_name = 'Creating %s' % analysis.name
        moi_result_url = '/analysis/results/%d' % analysis_id

        submit(ctx_default, moi_group['id'], moi_name,
               moi_result_url, run_analysis, analysis_id, split,
               rarefaction_depth=rarefaction_depth)

        r_client.hset('analyis-map', analysis_id, moi_group['id'])

        self.render("analysis_waiting.html",
                    group_id=moi_group['id'], aname=analysis.name)
コード例 #2
0
ファイル: analysis_handlers.py プロジェクト: yimsea/qiita
    def post(self, analysis_id):
        analysis_id = int(analysis_id)
        rarefaction_depth = self.get_argument('rarefaction-depth')
        mdsi = self.get_argument('merge-duplicated-sample-ids', default=False)
        if mdsi == 'on':
            mdsi = True

        # convert to integer if rarefaction level given
        if rarefaction_depth:
            rarefaction_depth = int(rarefaction_depth)
        else:
            rarefaction_depth = None
        analysis = Analysis(analysis_id)
        check_analysis_access(self.current_user, analysis)

        command_args = self.get_arguments("commands")
        cmd_split = [x.split("#") for x in command_args]

        moi_user_id = get_id_from_user(self.current_user.id)
        moi_group = create_info(analysis_id, 'group', url='/analysis/',
                                parent=moi_user_id, store=True)
        moi_name = ("Creating %s... When finished, please click the 'Success' "
                    "link to the right" % analysis.name)
        moi_result_url = '/analysis/results/%d' % analysis_id

        submit(ctx_default, moi_group['id'], moi_name,
               moi_result_url, run_analysis, analysis_id, cmd_split,
               rarefaction_depth=rarefaction_depth,
               merge_duplicated_sample_ids=mdsi)

        r_client.hset('analyis-map', analysis_id, moi_group['id'])

        self.render("analysis_waiting.html",
                    group_id=moi_group['id'], aname=analysis.name)
コード例 #3
0
ファイル: analysis_handlers.py プロジェクト: qiyunzhu/qiita
    def post(self, analysis_id):
        analysis_id = int(analysis_id)
        rarefaction_depth = self.get_argument('rarefaction-depth')
        mdsi = self.get_argument('merge-duplicated-sample-ids', default=False)
        if mdsi == 'on':
            mdsi = True

        # convert to integer if rarefaction level given
        if rarefaction_depth:
            rarefaction_depth = int(rarefaction_depth)
        else:
            rarefaction_depth = None
        analysis = Analysis(analysis_id)
        check_analysis_access(self.current_user, analysis)

        command_args = self.get_arguments("commands")
        cmd_split = [x.split("#") for x in command_args]

        moi_user_id = get_id_from_user(self.current_user.id)
        moi_group = create_info(analysis_id,
                                'group',
                                url='%s/analysis/' % qiita_config.portal_dir,
                                parent=moi_user_id,
                                store=True)
        moi_name = ("Creating %s... When finished, please click the 'Success' "
                    "link to the right" % analysis.name)
        moi_result_url = '%s/analysis/results/%d' % (qiita_config.portal_dir,
                                                     analysis_id)

        submit(ctx_default,
               moi_group['id'],
               moi_name,
               moi_result_url,
               run_analysis,
               analysis_id,
               cmd_split,
               rarefaction_depth=rarefaction_depth,
               merge_duplicated_sample_ids=mdsi)

        r_client.hset('analyis-map', analysis_id, moi_group['id'])

        self.render("analysis_waiting.html",
                    group_id=moi_group['id'],
                    aname=analysis.name)
コード例 #4
0
    def post(self):
        name = self.get_argument("jobname", None)
        group_name = self.get_argument("jobgroup", None)
        parent = get_id_from_user("no-user")
        job_url = "/result"

        if name is not None:
            submit(ctx_default, parent, name, job_url, say_hello, name)
        else:
            group_url = "/group"
            group = create_info(group_name, 'group', url=group_url,
                                parent=parent, store=True)
            group_id = group['id']

            for i in range(5):
                name = group_name + '-%d' % i
                submit(ctx_default, group_id, name, job_url, say_hello, name)

        self.redirect('/')
コード例 #5
0
 def test_failure_callback(self):
     """Make sure failure at file creation step doesn't hang everything"""
     # rename a needed file for creating the biom table
     base = get_db_files_base_dir()
     rename(join(base, "processed_data",
                 "1_study_1001_closed_reference_otu_table.biom"),
            join(base, "processed_data", "1_study_1001.bak"))
     analysis = Analysis(2)
     group = get_id_from_user("*****@*****.**")
     try:
         app = RunAnalysis(moi_context=ctx_default,
                           moi_parent_id=group)
         app(analysis, [], rarefaction_depth=100)
         self.assertEqual(analysis.status, 'error')
         for job_id in analysis.jobs:
             self.assertEqual(Job(job_id).status, 'error')
     finally:
         rename(join(base, "processed_data", "1_study_1001.bak"),
                join(base, "processed_data",
                     "1_study_1001_closed_reference_otu_table.biom"))
コード例 #6
0
    def post(self):
        name = self.get_argument("jobname", None)
        group_name = self.get_argument("jobgroup", None)
        parent = get_id_from_user("no-user")
        job_url = "/result"

        if name is not None:
            submit(ctx_default, parent, name, job_url, say_hello, name)
        else:
            group_url = "/group"
            group = create_info(group_name,
                                'group',
                                url=group_url,
                                parent=parent,
                                store=True)
            group_id = group['id']

            for i in range(5):
                name = group_name + '-%d' % i
                submit(ctx_default, group_id, name, job_url, say_hello, name)

        self.redirect('/')
コード例 #7
0
    def post(self, analysis_id):
        analysis_id = int(analysis_id)
        rarefaction_depth = self.get_argument('rarefaction-depth')
        # convert to integer if rarefaction level given
        if rarefaction_depth:
            rarefaction_depth = int(rarefaction_depth)
        else:
            rarefaction_depth = None
        analysis = Analysis(analysis_id)
        check_analysis_access(self.current_user, analysis)

        command_args = self.get_arguments("commands")
        split = [x.split("#") for x in command_args]

        moi_user_id = get_id_from_user(self.current_user.id)
        moi_group = create_info(analysis_id,
                                'group',
                                url='/analysis/',
                                parent=moi_user_id,
                                store=True)
        moi_name = ("Creating %s... When finished, please click the 'Success' "
                    "link to the right" % analysis.name)
        moi_result_url = '/analysis/results/%d' % analysis_id

        submit(ctx_default,
               moi_group['id'],
               moi_name,
               moi_result_url,
               run_analysis,
               analysis_id,
               split,
               rarefaction_depth=rarefaction_depth)

        r_client.hset('analyis-map', analysis_id, moi_group['id'])

        self.render("analysis_waiting.html",
                    group_id=moi_group['id'],
                    aname=analysis.name)
コード例 #8
0
 def get_current_user(self):
     user = self.get_secure_cookie("user")
     if user is None:
         raise ValueError("No user associated with the websocket!")
     else:
         return get_id_from_user(user.strip('" '))
コード例 #9
0
 def get(self):
     self.set_current_user("no-user")
     group_id = get_id_from_user("no-user")
     self.render("moi_example.html", user=self.get_current_user(),
                 group_id=group_id)
コード例 #10
0
 def get(self):
     self.set_current_user("no-user")
     group_id = get_id_from_user("no-user")
     self.render("moi_example.html",
                 user=self.get_current_user(),
                 group_id=group_id)