Skip to content

500 Server Error and JSONDecodeError When Querying chr05 with MultiQuery #21

@lyangfan

Description

@lyangfan

Description

When executing the following code using the pyrice library's MultiQuery class to query a genomic region on chromosome 5, the program encountered 500 Server Errors from external services and a subsequent JSONDecodeError during result parsing.

Steps to Reproduce

  1. Import the MultiQuery class and initialize an instance.
  2. Execute a genomic region query for chromosome 5 (positions 4,319,844 to 4,519,844) with the specified databases:
    from pyrice.multi_query import MultiQuery
    
    query = MultiQuery()
    result = query.query_by_chromosome(
        chro="chr05",
        start_pos="4319844",
        end_pos="4519844",
        number_process=1,
        multi_processing=False,
        multi_threading=False,
        dbs=['oryzabase', 'rapdb', 'gramene', 'funricegene_faminfo', 'funricegene_geneinfo']
    )

Error Output

Server Error: 500
For url:https://snp-seek.irri.org/ws/genomics/gene/osnippo/chr05?start=4319844&end=4519844&model=rap
Server Error: 500
For url:https://snp-seek.irri.org/ws/genomics/gene/osnippo/chr05?start=4319844&end=4519844&model=msu7
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
[<ipython-input-2-0b35b801d254>](https://localhost:8080/#) in <cell line: 0>()
      2 
      3 query = MultiQuery()
----> 4 result = query.query_by_chromosome(chro="chr05", start_pos="4319844", end_pos="4519844", 
      5                                    number_process = 1, multi_processing=False,
      6                                    multi_threading=False, dbs=['oryzabase', 'rapdb', 'gramene', 'funricegene_faminfo', 'funricegene_geneinfo'])

10 frames
[/usr/local/lib/python3.11/dist-packages/pyrice/multi_query.py](https://localhost:8080/#) in query_by_chromosome(self, chro, start_pos, end_pos, number_process, multi_processing, multi_threading, dbs, query_expansion)
    464         #Query in multi_database
    465         i=1
--> 466         file_id = self.search_on_chromosome(chro=chro,start_pos=start_pos,end_pos=end_pos,number_process = number_process)
    467         self.result = dict()
    468         if query_expansion:

[/usr/local/lib/python3.11/dist-packages/pyrice/multi_query.py](https://localhost:8080/#) in search_on_chromosome(self, chro, start_pos, end_pos, number_process, save_path, dbs)
   1096             p = ThreadPoolExecutor(max_workers=number_process)
   1097             tmp = p.map(self.query,list_key,list_dbs,list_ids)
-> 1098             for t in tmp:
   1099                 if t != None:
   1100                     self.result[t[0]].setdefault(t[1], t[2])

[/usr/lib/python3.11/concurrent/futures/_base.py](https://localhost:8080/#) in result_iterator()
    617                     # Careful not to keep a reference to the popped future
    618                     if timeout is None:
--> 619                         yield _result_or_cancel(fs.pop())
    620                     else:
    621                         yield _result_or_cancel(fs.pop(), end_time - time.monotonic())

[/usr/lib/python3.11/concurrent/futures/_base.py](https://localhost:8080/#) in _result_or_cancel(***failed resolving arguments***)
    315     try:
    316         try:
--> 317             return fut.result(timeout)
    318         finally:
    319             fut.cancel()

[/usr/lib/python3.11/concurrent/futures/_base.py](https://localhost:8080/#) in result(self, timeout)
    454                     raise CancelledError()
    455                 elif self._state == FINISHED:
--> 456                     return self.__get_result()
    457                 else:
    458                     raise TimeoutError()

[/usr/lib/python3.11/concurrent/futures/_base.py](https://localhost:8080/#) in __get_result(self)
    399         if self._exception:
    400             try:
--> 401                 raise self._exception
    402             finally:
    403                 # Break a reference cycle with the exception in self._exception

[/usr/lib/python3.11/concurrent/futures/thread.py](https://localhost:8080/#) in run(self)
     56 
     57         try:
---> 58             result = self.fn(*self.args, **self.kwargs)
     59         except BaseException as exc:
     60             self.future.set_exception(exc)

[/usr/local/lib/python3.11/dist-packages/pyrice/multi_query.py](https://localhost:8080/#) in query(self, iricname, db, qfields, verbose)
    113             if len(res.content) > 3:
    114                 if iricname == "snpseek":
--> 115                     return [iricname,qfields[-1],json.loads(res.content.decode('utf-8'))]
    116                 elif db == "ic4r":
    117                     return [iricname,db,json.loads(res.content.decode('utf-8'))[0][1]]

[/usr/lib/python3.11/json/__init__.py](https://localhost:8080/#) in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    344             parse_int is None and parse_float is None and
    345             parse_constant is None and object_pairs_hook is None and not kw):
--> 346         return _default_decoder.decode(s)
    347     if cls is None:
    348         cls = JSONDecoder

[/usr/lib/python3.11/json/decoder.py](https://localhost:8080/#) in decode(self, s, _w)
    335 
    336         """
--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338         end = _w(s, end).end()
    339         if end != len(s):

[/usr/lib/python3.11/json/decoder.py](https://localhost:8080/#) in raw_decode(self, s, idx)
    353             obj, end = self.scan_once(s, idx)
    354         except StopIteration as err:
--> 355             raise JSONDecodeError("Expecting value", s, err.value) from None
    356         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions