diff --git a/qiita_db/processing_job.py b/qiita_db/processing_job.py index 13456e871..aaa219f26 100644 --- a/qiita_db/processing_job.py +++ b/qiita_db/processing_job.py @@ -880,12 +880,30 @@ def submit(self, parent_job_id=None, dependent_jobs_list=None): # portal server that submitted the job url = "%s%s" % (qiita_config.base_url, qiita_config.portal_dir) + # if the word ENVIRONMENT is in the plugin_env_script we have a special + # case where we are going to execute some command and then wait for the + # plugin to return their own id (first implemented for + # fast-bowtie2+woltka) + if 'ENVIRONMENT' in plugin_env_script: + # the job has to be in running state so the plugin can change its` + # status + with qdb.sql_connection.TRN: + self._set_status('running') + qdb.sql_connection.TRN.commit() + + create_nested_path(job_dir) + cmd = (f'{plugin_env_script}; {plugin_start_script} ' + f'{url} {self.id} {job_dir}') + stdout, stderr, return_value = _system_call(cmd) + if return_value != 0 or stderr != '': + self._set_error(stderr) + job_id = stdout # note that dependent jobs, such as m validator jobs marshalled into # n 'queues' require the job_id returned by an external scheduler such # as Torque's MOAB, rather than a job name that can be defined within # Qiita. Hence, this method must be able to handle the case where a job # requires metadata from a late-defined and time-sensitive source. - if qiita_config.plugin_launcher in ProcessingJob._launch_map: + elif qiita_config.plugin_launcher in ProcessingJob._launch_map: launcher = ProcessingJob._launch_map[qiita_config.plugin_launcher] if launcher['execute_in_process']: # run this launcher function within this process. diff --git a/qiita_db/test/test_processing_job.py b/qiita_db/test/test_processing_job.py index c4248c634..51f957275 100644 --- a/qiita_db/test/test_processing_job.py +++ b/qiita_db/test/test_processing_job.py @@ -265,6 +265,24 @@ def test_submit_error(self): qdb.exceptions.QiitaDBOperationNotPermittedError): job.submit() + def test_submit_environment(self): + job = _create_job() + software = job.command.software + current = software.environment_script + + # temporal update and then rollback to not commit change + with qdb.sql_connection.TRN: + sql = """UPDATE qiita.software SET environment_script = %s + WHERE software_id = %s""" + qdb.sql_connection.TRN.add(sql, [ + f'{current} ENVIRONMENT', software.id]) + + job.submit() + + self.assertEqual(job.status, 'error') + + qdb.sql_connection.TRN.rollback() + def test_complete_multiple_outputs(self): # This test performs the test of multiple functions at the same # time. "release", "release_validators" and diff --git a/qiita_pet/static/js/networkVue.js b/qiita_pet/static/js/networkVue.js index efe5f1635..06f7e3a58 100644 --- a/qiita_pet/static/js/networkVue.js +++ b/qiita_pet/static/js/networkVue.js @@ -70,7 +70,7 @@ Vue.component('processing-graph', { '