502 Server Error

amirhossein khoram
  • 27 Feb '20


I need to find the subhalos which are in the void region for TNG_300.
I am using API bu the way.
When I run my code for the total number of subhalos, I get this message: " 502 Server Error: Proxy Error for url: https://www.tng-project.org/api/TNG300-1/snapshots/99/subhalos/?limit=14000000"
this happens when I order the number of subhalos more than 4millions.
Is it the limitation for using API on TNG servers or I can do something about it to get access to all subhalos?

Thank you.

amirhossein khoram
  • 27 Feb '20

subs = get( snap['subhalos'], {'limit': 14000000 } )
or even
subs = get( snap['subhalos'], {'limit': 5000000 , 'order_by':'pos_x'} )
this is the code.

Dylan Nelson
  • 28 Feb '20


Yes I suspect the response is simply too large for the server.

I would recommend to get the results using the "pagination" feature, e.g.

num_per = 100000
for i in range(100):
    offset = num_per * i
    result = get( snap['subhalos'], {'limit':num_per, 'offset':offset}

Although, if you are working with so many subhalos, I would really suggest you just download the group catalog for TNG300-1 at z=0. You can download only a certain field using {subset_query} (see the API documentation).

  • Page 1 of 1