# How to set the timeout value for *Data functions

I haven't measured this precisely but it seems the default timeout value for retrieving EntityValues with *Data functions is in the range of tens of seconds. This significantly impacts the execution time if the *Data function is called repeatedly, because I often get an

 EntityValue::timeout: A network operation for EntityValue timed out. Please try again later. >>


error.

Is it possible to manually set the timeout value for such functions that retrieve curated data from Wolfram servers?

You could wrap the call to the *Data function in TimeConstrained. This function will evaluate its argument for the maximum number of seconds specified. If the computation has not completed in that time, it will return $Aborted. Of course, you will probably have to manage the aborted computation somehow, but from my reading of your question that doesn't seem to be a problem. For instance: TimeConstrained[WeatherData["Chicago", "Temperature", {1950, 1}], 0.1]  returns $Aborted on my system; if I use a more lax time constrain, e.g. 1 s, I obtain my result.

This problem is particularly relevant for data that need download and initialization of a local archive / index when first accessed, such as the WeatherData results above. The TimeConstrained function will stop the loading of the database as well as the data processing in that case.

As an aside, the database loading is incremental in those cases: if you execute the same time-limited expression enough times, it will download and process a small chunk each time, until at the end it will have downloaded everything it needs and will be able to answer from local data, which will be very fast.

• Thanks for the suggestion, will test it later. And I can add another While[output === \$Aborted, repeat] to deal with timeouts.
– shrx
Jun 9 '15 at 6:18

You can increase the network timeout for WolframAlpha calls by using:

SetOptions[WolframAlpha, TimeConstraint -> 300]


for example.

• Does it work with *Data functions? Can't check right now.
– shrx
Jun 19 '15 at 21:32
• Works for me with the AirportData function. Jun 19 '15 at 21:48
• I can't find this in the Preferences GUI anywhere (10.1). Does anyone know if it's there? If not, I can imagine plenty of users wanting access to it in the frontend. Jul 10 '15 at 21:38