def __call__(self): from xssp_rest.tasks import get_task task = get_task('sequence', self.output_format) _log.debug("Calling task '{}'".format(task.__name__)) if 'hssp' in self.output_format: result = task.delay(self.sequence, self.output_format) return result.id
def __call__(self): from xssp_rest.tasks import get_task task = get_task('pdb_redo_id', self.output_format) _log.debug("Calling task '{}'".format(task.__name__)) if self.output_format == 'dssp': result = task.delay(self.pdb_redo_id) return result.id
def __call__(self): from xssp_rest.tasks import get_task task = get_task('pdb_file', self.output_format) _log.debug("Calling task '{}'".format(task.__name__)) if 'hssp' in self.output_format: result = task.delay(self.pdb_file_path, self.output_format) else: result = task.delay(self.pdb_file_path) return result.id
def get_xssp_result(input_type, output_type, id): """ Get the result of a previous job submission. :param input_type: Either 'pdb_id', 'pdb_redo_id', 'pdb_file' or 'sequence'. :param output_type: Either 'hssp_hssp', 'hssp_stockholm', or 'dssp'. :param id: The id returned by a call to the create method. :return: The output of the job. If the job status is not SUCCESS, this method returns an error. """ from xssp_rest.tasks import get_task task = get_task(input_type, output_type) _log.debug("task is {}".format(task.__name__)) response = {'result': task.AsyncResult(id).get()} return jsonify(response)
def get_xssp_status(input_type, output_type, id): """ Get the status of a previous job submission. :param input_type: Either 'pdb_id', 'pdb_redo_id', 'pdb_file' or 'sequence'. :param output_type: Either 'hssp_hssp', 'hssp_stockholm', or 'dssp'. :param id: The id returned by a call to the create method. :return: Either PENDING, STARTED, SUCCESS, FAILURE, RETRY, or REVOKED. """ from xssp_rest.tasks import get_task task = get_task(input_type, output_type) async_result = task.AsyncResult(id) response = {'status': async_result.status} if async_result.failed(): response.update({'message': async_result.traceback}) return jsonify(response)
def test_get_task(self): from xssp_rest.tasks import get_task task = get_task('pdb_id', 'dssp') eq_(task.__name__, 'get_dssp') task = get_task('pdb_id', 'hssp_hssp') eq_(task.__name__, 'get_hssp') task = get_task('pdb_id', 'hssp_stockholm') eq_(task.__name__, 'get_hssp') task = get_task('pdb_redo_id', 'dssp') eq_(task.__name__, 'get_dssp_redo') task = get_task('pdb_file', 'dssp') eq_(task.__name__, 'mkdssp_from_pdb') task = get_task('pdb_file', 'hssp_hssp') eq_(task.__name__, 'mkhssp_from_pdb') task = get_task('pdb_file', 'hssp_stockholm') eq_(task.__name__, 'mkhssp_from_pdb') task = get_task('sequence', 'hssp_hssp') eq_(task.__name__, 'mkhssp_from_sequence') task = get_task('sequence', 'hssp_stockholm') eq_(task.__name__, 'mkhssp_from_sequence')
def test_get_task_unexpected_input_type(self): from xssp_rest.tasks import get_task get_task('unexpected', 'hssp_stockholm')
def test_get_task_invalid_combination_sequence_dssp(self): from xssp_rest.tasks import get_task get_task('pdb_redo_id', 'hssp_stockholm')
def test_get_task_invalid_combination_pdb_redo_id_hssp_stockholm(self): from xssp_rest.tasks import get_task get_task('sequence', 'dssp')
def test_get_task_invalid_combination_pdb_redo_id_hssp(self): from xssp_rest.tasks import get_task get_task('pdb_redo_id', 'hssp')