diff --git a/.travis.yml b/.travis.yml index 09bb31864..960c63889 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,8 @@ before_install: - wget ftp://ftp.microbio.me/pub/qiita/ascp-install-3.5.4.102989-linux-64-qiita.sh -O ascp-install-3.5.4.102989-linux-64-qiita.sh - chmod +x ascp-install-3.5.4.102989-linux-64-qiita.sh - ./ascp-install-3.5.4.102989-linux-64-qiita.sh - - if [ ${TRAVIS_PULL_REQUEST} == "false" ]; then openssl aes-256-cbc -K $encrypted_a2e23aea5f14_key -iv $encrypted_a2e23aea5f14_iv -in qiita_core/support_files/config_test_travis.cfg.enc -out qiita_core/support_files/config_test_travis.cfg -d ; fi + # once we have ebi testing we should uncomment this line + # - if [ ${TRAVIS_PULL_REQUEST} == "false" ]; then openssl aes-256-cbc -K $encrypted_a2e23aea5f14_key -iv $encrypted_a2e23aea5f14_iv -in qiita_core/support_files/config_test_travis.cfg.enc -out qiita_core/support_files/config_test_travis.cfg -d ; fi install: # install a few of the dependencies that pip would otherwise try to install # when intalling scikit-bio diff --git a/qiita_core/testing.py b/qiita_core/testing.py index bde147825..22bc9201c 100644 --- a/qiita_core/testing.py +++ b/qiita_core/testing.py @@ -58,5 +58,5 @@ def wait_for_processing_job(job_id): """ job = ProcessingJob(job_id) while job.status not in ('success', 'error'): - sleep(0.5) - sleep(0.5) + sleep(1.2) + sleep(1.2) diff --git a/qiita_db/analysis.py b/qiita_db/analysis.py index 53d836b4f..aa66f9f39 100644 --- a/qiita_db/analysis.py +++ b/qiita_db/analysis.py @@ -773,8 +773,7 @@ def build_files(self, merge_duplicated_sample_ids): # different stages and possible errors. samples = self.samples # gettin the info of all the artifacts to save SQL time - bioms_info = qdb.util.get_artifacts_bioms_information( - samples.keys()) + bioms_info = qdb.util.get_artifacts_information(samples.keys()) # figuring out if we are going to have duplicated samples, again # doing it here cause it's computational cheaper diff --git a/qiita_db/test/test_util.py b/qiita_db/test/test_util.py index 5af9576a4..eb8da3d52 100644 --- a/qiita_db/test/test_util.py +++ b/qiita_db/test/test_util.py @@ -843,10 +843,10 @@ def test_generate_study_list(self): obs_info = qdb.util.generate_study_list([1, 2, 3, 4], False) self.assertEqual(obs_info, exp_info) - def test_get_artifacts_bioms_information(self): + def test_get_artifacts_information(self): # we are gonna test that it ignores 1 and 2 cause they are not biom, # 4 has all information and 7 and 8 don't - obs = qdb.util.get_artifacts_bioms_information([1, 2, 4, 7, 8]) + obs = qdb.util.get_artifacts_information([1, 2, 4, 7, 8]) # not testing timestamp for i in range(len(obs)): del obs[i]['timestamp'] diff --git a/qiita_db/util.py b/qiita_db/util.py index edb8c25c9..23b820200 100644 --- a/qiita_db/util.py +++ b/qiita_db/util.py @@ -1324,18 +1324,20 @@ def generate_study_list(study_ids, public_only=False): return infolist -def get_artifacts_bioms_information(artifact_ids): - """Returns processing information about the bioms in the artifact +def get_artifacts_information(artifact_ids, only_biom=True): + """Returns processing information about the artifact ids Parameters ---------- artifact_ids : list of ints The artifact ids to look for. Non-existing ids will be ignored + only_biom : bool + If true only the biom artifacts are retrieved Returns ------- dict - The info of the bioms if artifact_type is BIOM or None if not. + The info of the artifacts """ if not artifact_ids: return {} @@ -1348,10 +1350,13 @@ def get_artifacts_bioms_information(artifact_ids): array_agg(parent_info.command_parameters), array_agg(filepaths.filepath), qiita.find_artifact_roots(a.artifact_id) AS root_id - FROM qiita.artifact a + FROM qiita.artifact a""" + if only_biom: + sql += """ JOIN qiita.artifact_type at ON ( a.artifact_type_id = at .artifact_type_id - AND artifact_type = 'BIOM') + AND artifact_type = 'BIOM')""" + sql += """ LEFT JOIN qiita.parent_artifact pa ON ( a.artifact_id = pa.artifact_id) LEFT JOIN qiita.data_type dt USING (data_type_id) diff --git a/qiita_pet/handlers/analysis_handlers/sharing_handlers.py b/qiita_pet/handlers/analysis_handlers/sharing_handlers.py index b06335083..e296455ee 100644 --- a/qiita_pet/handlers/analysis_handlers/sharing_handlers.py +++ b/qiita_pet/handlers/analysis_handlers/sharing_handlers.py @@ -30,7 +30,7 @@ def _get_shared_for_study(self, analysis, callback): @execute_as_transaction def _share(self, analysis, user, callback): user = User(user) - add_message('Analysis \'%s\' ' + add_message('Analysis \'%s\' ' 'has been shared with you.' % (qiita_config.portal_dir, analysis.id, analysis.name), [user]) diff --git a/qiita_pet/handlers/analysis_handlers/tests/test_sharing_handlers.py b/qiita_pet/handlers/analysis_handlers/tests/test_sharing_handlers.py index 551385358..8edaeaaeb 100644 --- a/qiita_pet/handlers/analysis_handlers/tests/test_sharing_handlers.py +++ b/qiita_pet/handlers/analysis_handlers/tests/test_sharing_handlers.py @@ -45,9 +45,9 @@ def test_get(self): self.assertEqual(a.shared_with, [u]) # Make sure shared message added to the system - self.assertEqual('Analysis \'SomeAnalys' - 'is\' has been shared with you.', - u.messages()[0][1]) + self.assertEqual( + 'Analysis \'SomeAnalysis\' ' + 'has been shared with you.', u.messages()[0][1]) def test_get_no_access(self): args = {'selected': 'demo@microbio.me', 'id': 2} diff --git a/qiita_pet/handlers/api_proxy/__init__.py b/qiita_pet/handlers/api_proxy/__init__.py index 294661c7a..e28118cce 100644 --- a/qiita_pet/handlers/api_proxy/__init__.py +++ b/qiita_pet/handlers/api_proxy/__init__.py @@ -31,7 +31,7 @@ from .artifact import (artifact_graph_get_req, artifact_types_get_req, artifact_post_req, artifact_get_req, artifact_status_put_req, artifact_get_prep_req, - artifact_patch_request, artifact_get_biom_info) + artifact_patch_request, artifact_get_info) from .ontology import ontology_patch_handler from .processing import ( list_commands_handler_get_req, process_artifact_handler_get_req, @@ -53,7 +53,7 @@ 'prep_template_get_req', 'study_delete_req', 'study_prep_get_req', 'sample_template_get_req', 'artifact_graph_get_req', 'artifact_types_get_req', - 'artifact_post_req', 'artifact_get_biom_info', + 'artifact_post_req', 'artifact_get_info', 'sample_template_meta_cats_get_req', 'sample_template_samples_get_req', 'prep_template_samples_get_req', 'sample_template_category_get_req', 'new_prep_template_get_req', diff --git a/qiita_pet/handlers/api_proxy/artifact.py b/qiita_pet/handlers/api_proxy/artifact.py index 6fe8c62ed..34226da6e 100644 --- a/qiita_pet/handlers/api_proxy/artifact.py +++ b/qiita_pet/handlers/api_proxy/artifact.py @@ -22,7 +22,7 @@ from qiita_db.user import User from qiita_db.metadata_template.prep_template import PrepTemplate from qiita_db.util import ( - get_mountpoint, get_visibilities, get_artifacts_bioms_information) + get_mountpoint, get_visibilities, get_artifacts_information) from qiita_db.software import Command, Parameters from qiita_db.processing_job import ProcessingJob @@ -110,7 +110,7 @@ def artifact_get_prep_req(user_id, artifact_ids): @execute_as_transaction -def artifact_get_biom_info(user_id, artifact_ids): +def artifact_get_info(user_id, artifact_ids, only_biom=True): """Returns all artifact info for the given artifact_ids Parameters @@ -119,6 +119,8 @@ def artifact_get_biom_info(user_id, artifact_ids): user making the request artifact_ids : list of int list of artifact ids + only_biom : bool + If true only the biom artifacts are retrieved Returns ------- @@ -130,7 +132,7 @@ def artifact_get_biom_info(user_id, artifact_ids): """ artifact_info = {} - artifact_info = get_artifacts_bioms_information(artifact_ids) + artifact_info = get_artifacts_information(artifact_ids, only_biom) return {'status': 'success', 'msg': '', 'data': artifact_info} diff --git a/qiita_pet/handlers/api_proxy/prep_template.py b/qiita_pet/handlers/api_proxy/prep_template.py index 506162ded..f71a525f7 100644 --- a/qiita_pet/handlers/api_proxy/prep_template.py +++ b/qiita_pet/handlers/api_proxy/prep_template.py @@ -122,16 +122,19 @@ def prep_template_ajax_get_req(user_id, prep_id): alert_msg = (job.log.msg.replace('\n', '') if job.log is not None else "") else: - redis_info = loads(r_client.get(job_id)) - processing = redis_info['status_msg'] == 'Running' - success = redis_info['status_msg'] == 'Success' - if redis_info['return'] is not None: - alert_type = redis_info['return']['status'] - alert_msg = redis_info['return']['message'].replace( - '\n', '') - else: - alert_type = 'info' - alert_msg = '' + alert_type = 'info' + alert_msg = '' + # this is not actually necessary but in case of a system + # failure this will avoid the error + ji = r_client.get(job_id) + if ji: + redis_info = loads(ji) + processing = redis_info['status_msg'] == 'Running' + success = redis_info['status_msg'] == 'Success' + if redis_info['return'] is not None: + alert_type = redis_info['return']['status'] + alert_msg = redis_info['return']['message'].replace( + '\n', '') if processing: alert_type = 'info' diff --git a/qiita_pet/handlers/api_proxy/tests/test_artifact.py b/qiita_pet/handlers/api_proxy/tests/test_artifact.py index 15e774bf5..23ff33302 100644 --- a/qiita_pet/handlers/api_proxy/tests/test_artifact.py +++ b/qiita_pet/handlers/api_proxy/tests/test_artifact.py @@ -26,7 +26,7 @@ from qiita_pet.handlers.api_proxy.artifact import ( artifact_get_req, artifact_status_put_req, artifact_graph_get_req, artifact_types_get_req, artifact_post_req, artifact_patch_request, - artifact_get_prep_req, artifact_get_biom_info) + artifact_get_prep_req, artifact_get_info) class TestArtifactAPIReadOnly(TestCase): @@ -219,8 +219,8 @@ def test_artifact_get_prep_req(self): 'message': 'User does not have access to study'} self.assertEqual(obs, exp) - def test_artifact_get_biom_info(self): - obs = artifact_get_biom_info('test@foo.bar', [5, 6, 7]) + def test_artifact_get_info(self): + obs = artifact_get_info('test@foo.bar', [5, 6, 7]) data = [ {'files': ['1_study_1001_closed_reference_otu_table_Silva.biom'], 'target_subfragment': ['V4'], 'algorithm': ( diff --git a/qiita_pet/handlers/study_handlers/__init__.py b/qiita_pet/handlers/study_handlers/__init__.py index 0832aebb2..464f31271 100644 --- a/qiita_pet/handlers/study_handlers/__init__.py +++ b/qiita_pet/handlers/study_handlers/__init__.py @@ -21,8 +21,7 @@ ListOptionsHandler, WorkflowHandler, WorkflowRunHandler, JobAJAX) from .artifact import (ArtifactGraphAJAX, NewArtifactHandler, - ArtifactAdminAJAX, ArtifactGetSamples, - ArtifactGetBIOMInfo) + ArtifactAdminAJAX, ArtifactGetSamples, ArtifactGetInfo) from .sample_template import SampleTemplateAJAX, SampleAJAX __all__ = ['ListStudiesHandler', 'StudyApprovalList', 'ShareStudyAJAX', @@ -36,4 +35,4 @@ 'DataTypesMenuAJAX', 'StudyFilesAJAX', 'PrepTemplateSummaryAJAX', 'WorkflowHandler', 'WorkflowRunHandler', 'JobAJAX', 'AutocompleteHandler', 'StudyGetTags', 'StudyTags', - 'ArtifactGetSamples', 'ArtifactGetBIOMInfo'] + 'ArtifactGetSamples', 'ArtifactGetInfo'] diff --git a/qiita_pet/handlers/study_handlers/artifact.py b/qiita_pet/handlers/study_handlers/artifact.py index 4539c3a17..51d18d32e 100644 --- a/qiita_pet/handlers/study_handlers/artifact.py +++ b/qiita_pet/handlers/study_handlers/artifact.py @@ -15,7 +15,7 @@ from qiita_pet.handlers.api_proxy import ( artifact_graph_get_req, artifact_types_get_req, artifact_post_req, artifact_status_put_req, artifact_get_req, artifact_get_prep_req, - artifact_get_biom_info) + artifact_get_info) from qiita_core.util import execute_as_transaction from qiita_core.qiita_settings import qiita_config @@ -69,12 +69,13 @@ def get(self): self.write(response) -class ArtifactGetBIOMInfo(BaseHandler): +class ArtifactGetInfo(BaseHandler): @authenticated def get(self): aids = map(int, self.request.arguments.get('ids[]', [])) + only_biom = self.get_argument('only_biom', 'True') == 'True' - response = artifact_get_biom_info(self.current_user.id, aids) + response = artifact_get_info(self.current_user.id, aids, only_biom) self.write(response) diff --git a/qiita_pet/handlers/study_handlers/tests/test_artifact.py b/qiita_pet/handlers/study_handlers/tests/test_artifact.py index 8cc26db63..7cc8339fd 100644 --- a/qiita_pet/handlers/study_handlers/tests/test_artifact.py +++ b/qiita_pet/handlers/study_handlers/tests/test_artifact.py @@ -158,7 +158,7 @@ def test_get(self): self.assertEqual(loads(response.body), exp) -class ArtifactGetBIOMInfoTest(TestHandlerBase): +class ArtifactGetInfoTest(TestHandlerBase): def test_get(self): response = self.get('/artifact/info/', {'ids[]': [6, 7]}) self.assertEqual(response.code, 200) diff --git a/qiita_pet/templates/list_analyses.html b/qiita_pet/templates/list_analyses.html index 9fb69dee8..9498d825e 100644 --- a/qiita_pet/templates/list_analyses.html +++ b/qiita_pet/templates/list_analyses.html @@ -8,8 +8,74 @@ {% if analyses %} $('#no-analyses').hide() $('#analyses-table').dataTable({ - "order": [[ 2, "desc" ]] + "order": [[ 2, "desc" ]], + columnDefs: [ + {"render": function ( data, type, row, meta ) { + data = JSON.parse(data); + if (data !== null && data !== undefined && data.length != 0){ + return '

| Name | '; + proc_data_table += 'Processing method | '; + proc_data_table += 'Parameters | '; + proc_data_table += 'Files | '; + proc_data_table += '
|---|---|---|---|
| ' + info.name + ' (' + info.artifact_id + ' - ' + info.timestamp.split('.')[0] + ') | '; + proc_data_table += '' + info.algorithm + ' | '; + var params = ''; + for (var key in info.parameters) { + params += '' + key + ': ' + info.parameters[key] + '' + params + ' | '; + proc_data_table += '' + info.files.join(' ') + ' | ';
+ proc_data_table += '