-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix #1505 * improving some GUI stuff * improving some GUI stuff - missing lines * addressing all comments * ready for review * fix #1987 * initial commit * requested changes * fix filter job list * Fixing server cert (#2051) * fix get_studies * flake8 * fix #503 * fix #2010 * fix #1913 * fix errors * addressing @josenavas comment * flake8 * fix #1010 * fix #1066 (#2058) * addressing @josenavas comments * fix #1961 * fix #1837 * Automatic jobs & new stats (#2057) * fix #814, fix #1636 * fixing error in test-env * fixing stats.html call * adding img * addressing @josenavas comments * rm for loops * addresssing @ElDeveloper comments * generalizing this functionality * fix #1816 * fix #1959 * addressing @josenavas comments * addressing @josenavas comments * fixing error * fixed? * addressing @josenavas comments * addressing @wasade comments * fix flake8 * generate biom and metadata release (#2066) * initial commit * adding portal * addressing @josenavas comments * pid -> qiita_artifact_id * addressing @josenavas comments * addressing @ElDeveloper comments * rm 50.sql * database changes to fix 969 * adding delete * addressing @josenavas comments * addressing @ElDeveloper comments * duh! * fix generate_biom_and_metadata_release (#2072) * fix generate_biom_and_metadata_release * addressing @ElDeveloper comment * Removing qiita ware code that will not be used anymore * Organizing the handlers and new analysis description page * fixing timestamp * rm formats * st -> pt * Connecting the analysis creation and making interface responsive * Addressing @antgonza's comments * Initial artifact GUI refactor * Removing unused code * moving to ISO 8601 - wow :'( * fix errors * addressing @wasade comments * Adding can_edit call to the analysis * Fixing artifact rest API since not all artifacts have study * Adding can_be_publicized call to analysis * Adding QiitaHTTPError to handle errors gracefully * Adding safe_execution contextmanager * Fixing typo * Adding qiita test checker * Adapting some artifact handlers * Abstracting the graph reloading and adding some documentation * Fixing typo * Fixing changing artifact visibility * Fixing delete * Fixing artifact deletion * Adding default parameters to the commands * Fixing processing page * Fixing variable name * fixing private/public studies * Changing bdiv metrics to single choice * sanbox-to-sandbox * flake8 * Fixing patch * fixing other issues * adding share documentation * psycopg2 <= 2.7 * psycopg2 < 2.7 * Various small fixes to be able to run tests on the plugins * Adding private module * Fixing processing job completion * Fixing patch 52 * Fixing call * Fixing complete * small fixes * Adding processing handlers * Fixing url and bug on processing job workflow * Adding the private script runner * Adding is_analysis column to the command * Adding retrieval of commands excluding analysis commands * Addressing bug on retrieving information from redis * Enabling the command register endpoint to provide if the command is analysis only * Addressing @antgonza's comments * Addressing @wasade's comments
- Loading branch information
Showing
18 changed files
with
809 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# ----------------------------------------------------------------------------- | ||
# Copyright (c) 2014--, The Qiita Development Team. | ||
# | ||
# Distributed under the terms of the BSD 3-clause License. | ||
# | ||
# The full license is in the file LICENSE, distributed with this software. | ||
# ----------------------------------------------------------------------------- | ||
|
||
from json import dumps | ||
from sys import exc_info | ||
from time import sleep | ||
import traceback | ||
|
||
import qiita_db as qdb | ||
|
||
|
||
def build_analysis_files(job): | ||
"""Builds the files for an analysis | ||
Parameters | ||
---------- | ||
job : qiita_db.processing_job.ProcessingJob | ||
The processing job with the information for building the files | ||
""" | ||
with qdb.sql_connection.TRN: | ||
params = job.parameters.values | ||
analysis_id = params['analysis'] | ||
merge_duplicated_sample_ids = params['merge_dup_sample_ids'] | ||
analysis = qdb.analysis.Analysis(analysis_id) | ||
biom_files = analysis.build_files(merge_duplicated_sample_ids) | ||
|
||
cmd = qdb.software.Command.get_validator('BIOM') | ||
val_jobs = [] | ||
for dtype, biom_fp in biom_files: | ||
validate_params = qdb.software.Parameters.load( | ||
cmd, values_dict={'files': dumps({'biom': [biom_fp]}), | ||
'artifact_type': 'BIOM', | ||
'provenance': dumps({'job': job.id, | ||
'data_type': dtype}), | ||
'analysis': analysis_id}) | ||
val_jobs.append(qdb.processing_job.ProcessingJob.create( | ||
analysis.owner, validate_params)) | ||
|
||
job._set_validator_jobs(val_jobs) | ||
|
||
for j in val_jobs: | ||
j.submit() | ||
sleep(1) | ||
|
||
|
||
TASK_DICT = {'build_analysis_files': build_analysis_files} | ||
|
||
|
||
def private_task(job_id): | ||
"""Complets a Qiita private task | ||
Parameters | ||
---------- | ||
job_id : str | ||
The job id | ||
""" | ||
if job_id == 'register': | ||
# We don't need to do anything here if Qiita is registering plugins | ||
return | ||
|
||
job = qdb.processing_job.ProcessingJob(job_id) | ||
job.update_heartbeat_state() | ||
task_name = job.command.name | ||
|
||
try: | ||
TASK_DICT[task_name](job) | ||
except Exception: | ||
job.complete(False, error="Error executing private task: %s" | ||
% traceback.format_exception(*exc_info())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.