def parse_structure(self, structure_file, timeout, model=None,
parser=RegularStructureParser):
"""
Call StructureParser.parse_structure() in a separate process and return
the output. Raise TimeoutError if the parser does not respond within
C{timeout} seconds.
@param structure_file: structure file to parse
@type structure_file: str
@param timeout: raise multiprocessing.TimeoutError if C{timeout} seconds
elapse before the parser completes its job
@type timeout: int
@param parser: any implementing L{AbstractStructureParser} class
@type parser: type
@return: parsed structure
@rtype: L{csb.structure.Structure}
"""
r = self.parse_async([structure_file], timeout, model, parser)
if len(r) > 0:
if r[0].exception is not None:
raise r[0].exception
else:
return r[0].result
return None
评论列表
文章目录